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
LATEST COMMENTS
MC Press Online