TechTalk: Duplicate RPG Members Utility

RPG
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

A programmer from our shop wanted to modify an RPG III program. Because he wanted to use some new ILE functions, he converted it from Original Program Model (OPM) RPG to ILE RPG with the Convert RPG Source (CVTRPGSRC) command. Then he modified the new source in QRPGLESRC and compiled it. However, he made a big mistake: he didn't delete the old RPG source from QRPGSRC!

A few weeks later, another programmer needed to modify the same program. He looked in QRPGSRC and found the source. (He didn't know that the latest version was in QRPGLESRC.) He modified the RPG source and compiled it. As a result, we ended up with two different versions of the same program.

To avoid this situation, I wrote a utility called the Display Duplicate RPG Members (DSPDUPRPGM) command (see Figures 1 and 2). This utility checks a single library or all user libraries for QRPGLESRC files and looks for corresponding member names in QRPGSRC within the same library. If it finds any members with the same name in both source files, it displays them in a list.

? Helmut Salzer


TechTalk: Duplicate RPG Members Utility

Figure 1: The DSPDUPRPGM Command

 /*===============================================================*/ /* To compile: */ /* */ /* CRTCMD CMD(XXX/DSPDUPRPGM) PGM(XXX/DUP001CL) + */ /* SRCFILE(XXX/QCMDSRC) */ /* */ /*===============================================================*/ CMD PROMPT('Display Duplicate RPG Members') PARM KWD(LIB) TYPE(*NAME) DFT(*ALLUSR) + SPCVAL((*ALLUSR)) PROMPT('Library') 
TechTalk: Duplicate RPG Members Utility

Figure 2: CL Program DUP001CL

 /*===============================================================*/ /* To compile: */ /* */ /* CRTCLPGM PGM(XXX/DUP001CL) SRCFILE(XXX/QCLSRC) */ /* */ /*===============================================================*/ PGM PARM(&LIB) DCL VAR(&LIB) TYPE(*CHAR) LEN(10) DCL VAR(&DUPS) TYPE(*LGL) DCLF FILE(QAFDMBRL) RMVMSG PGMQ(*EXT) CLEAR(*ALL) DSPFD FILE(&LIB/QRPGLESRC) TYPE(*MBRLIST) + OUTPUT(*OUTFILE) OUTFILE(QTEMP/DSPRPGLE) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(DONE)) OVRDBF FILE(QAFDMBRL) TOFILE(QTEMP/DSPRPGLE) READ: RCVF MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(DONE)) CHKOBJ OBJ(&MLLIB/QRPGSRC) OBJTYPE(*FILE) + MBR(&MLNAME) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(READ)) SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) + MSGDTA('Duplicate RPG member' *BCAT + &MLNAME *BCAT 'found in library' *BCAT + &MLLIB) TOPGMQ(*EXT) MSGTYPE(*DIAG) CHGVAR VAR(&DUPS) VALUE('1') GOTO CMDLBL(READ) DONE: IF COND(&DUPS) THEN(SNDUSRMSG MSGID(CPF9897) + MSGF(QCPFMSG) MSGTYPE(*INFO) TOMSGQ(*EXT)) ELSE CMD(SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) + MSGDTA('No duplicate RPG members found in + library' *BCAT &LIB)) ENDPGM 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: