A utility to list the last time source members were modified.
All day long you've been making program changes in several source files. Now it's 4:30 p.m. and, in order to go home with a clear conscience, you need to recompile all the members affected; the trouble is that you cannot remember what members you changed. Or maybe you suspect that one of your programmers has edited source members but has not recompiled some of them. In either case, you need a way to identify the source members that have been edited.
Wouldn't it be nice to run a command that listed all edited source members to show where work had been done? Or to check that the programming staff is putting descriptions on all new source members? Or just to see what's changed during the week you were away?
The List Edited Source (LSTEDTSRC) command can do that and much more; a sample listing is shown in 1.
The List Edited Source (LSTEDTSRC) command can do that and much more; a sample listing is shown in Figure 1.
Four parameters allow the command to select various edited source members on the system. The member (MBR) parameter allows entry of a generic name. For example, if you wanted to see all the edited source for Parts Order Entry, you could specify POE* to list them.
A single library, a group of libraries, the job's library list, or all user (*ALLUSR) libraries can be searched for source files. Libraries entered in the list must exist on your system or the command will issue an error message. If *ALLUSR is used, this command may take some time to finish because a Display File Description (DSPFD) command is executed against all user files.
Additionally, a date range may be specified. Both dates must be valid, and the beginning date must be earlier than or the same as the ending date.
When the command is executed, a validity checking program makes sure the libraries are valid (unless special values *LIBL or *ALLUSR are entered). This program also checks the beginning and ending dates.
In the command processing program, copies of IBM-supplied files QAFDBASI and QAFDMBRL in QTEMP are used to receive the output from the DSPFD command. Using these files means that they do not have to be created to compile the command. This program also uses QUSRTOOL's Convert Binary to Decimal (CVTBINDEC) command. To install this tool, refer to page 26.
For each library or special value entered, the command displays all files and adds them to QAFDBASI in QTEMP. Once all files in the library have been displayed, the command opens the outfile, selecting all files with a data type of S (for source).
For each source file in the selected libraries, a DSPFD puts member information in an outfile. From this output, the command processing program selects records whose last change date is in the range selected when the command was entered.
The report that the command produces shows the library, source file, member, source type, member description, date created, date changed and the number of records. We have found this report useful in many situations.
List Source Maintenance Activity
Figure 1 Sample report, unable to reproduce
List Source Maintenance Activity
Figure 2 Command LSTEDTSRC
LSTEDTSRC: CMD PROMPT('List Edited Source Members') PARM KWD(MBR) TYPE(*GENERIC) LEN(10) DFT(*ALL) + SPCVAL((*ALL)) PROMPT('Member') PARM KWD(LIB) TYPE(*NAME) LEN(10) DFT(*ALLUSR) + SPCVAL((*ALLUSR) (*LIBL)) MAX(20) + PROMPT('Library') PARM KWD(BGNDAT) TYPE(*DATE) PROMPT('Beginning + date') PARM KWD(ENDDAT) TYPE(*DATE) PROMPT('Ending date')
List Source Maintenance Activity
Figure 3 Validity checking CL program EDT001CL
EDT001CL: + PGM PARM(&MBR &LIBS &BGNDAT &ENDDAT) DCL VAR(&BGNDAT) TYPE(*CHAR) LEN(7) DCL VAR(&BIN) TYPE(*CHAR) LEN(2) DCL VAR(&COUNT) TYPE(*DEC) LEN(3 0) DCL VAR(&ENDDAT) TYPE(*CHAR) LEN(7) DCL VAR(&ERROR) TYPE(*LGL) LEN(1) DCL VAR(&LIB) TYPE(*CHAR) LEN(10) DCL VAR(&LIBS) TYPE(*CHAR) LEN(252) DCL VAR(LIBS) TYPE(*DEC) LEN(5 0) DCL VAR(&MBR) TYPE(*CHAR) LEN(10) DCL VAR(&MSG) TYPE(*CHAR) LEN(80) DCL VAR(&START) TYPE(*DEC) LEN(3 0) CHGVAR VAR(&BIN) VALUE(%SST(&LIBS 1 2)) CVTBINDEC FROMBIN(&BIN) TODEC(LIBS) /* This tests for generic entry as the first library */ IF COND(%SST(&LIBS 3 10) *EQ '*ALLUSR' *OR %SST(&LIBS 3 10) *EQ + '*LIBL') THEN(DO) IF COND(LIBS *GT 1) THEN(DO) SNDPGMMSG MSGID(CPD0006) MSGF(QCPFMSG) MSGDTA('0000 + Only one library may be entered when + *ALLUSR or *LIBL selected.') MSGTYPE(*DIAG) CHGVAR VAR(&ERROR) VALUE('1') ENDDO GOTO CMDLBL(DATCHK) ENDDO START: + CHGVAR VAR(&START) VALUE(&COUNT * 10 + 3) CHGVAR VAR(&LIB) VALUE(%SST(&LIBS &START 10)) /* Check for the existence of the entered libraries */ CHKOBJ OBJ(&LIB) OBJTYPE(*LIB) MONMSG MSGID(CPF9801) EXEC(DO) SNDPGMMSG MSGID(CPD0006) MSGF(QCPFMSG) MSGDTA('0000 + Library' *BCAT &LIB *BCAT 'not found.') + MSGTYPE(*DIAG) CHGVAR VAR(&ERROR) VALUE('1') ENDDO CHGVAR VAR(&COUNT) VALUE(&COUNT + 1) IF COND(&COUNT *LT LIBS) THEN(GOTO CMDLBL(START)) /* Make sure beginning date is less than ending date */ DATCHK: + IF COND(&BGNDAT *GT &ENDDAT) THEN(DO) SNDPGMMSG MSGID(CPD0006) MSGF(QCPFMSG) MSGDTA('0000 + Beginning date is greater than ending + date.') MSGTYPE(*DIAG) CHGVAR VAR(&ERROR) VALUE('1') ENDDO ERRCHK: + IF COND(&ERROR) THEN(SNDPGMMSG MSGID(CPF0002) MSGF(QCPFMSG) + MSGTYPE(*ESCAPE)) ENDPGM
List Source Maintenance Activity
Figure 4 Command Processing CL program EDT001CLA
EDT001CLA: + PGM PARM(&MBR &LIBS &BGNDAT &ENDDAT) DCLF FILE(QAFDBASI) DCL VAR(&BGNDAT) TYPE(*CHAR) LEN(7) DCL VAR(&BGNDAT6) TYPE(*CHAR) LEN(6) DCL VAR(&BIN) TYPE(*CHAR) LEN(2) DCL VAR(&COUNT) TYPE(*DEC) LEN(3 0) DCL VAR(&ENDDAT) TYPE(*CHAR) LEN(7) DCL VAR(&ENDDAT6) TYPE(*CHAR) LEN(6) DCL VAR(&INCLUDE) TYPE(*DEC) LEN(3 0) DCL VAR(&LIB) TYPE(*CHAR) LEN(10) DCL VAR(&LIBLIST) TYPE(*CHAR) LEN(250) DCL VAR(&LIBS) TYPE(*CHAR) LEN(252) DCL VAR(LIBS) TYPE(*DEC) LEN(5 0) DCL VAR(&MBR) TYPE(*CHAR) LEN(10) DCL VAR(&START) TYPE(*DEC) LEN(3 0) CHGVAR VAR(&BIN) VALUE(%SST(&LIBS 1 2)) CVTBINDEC FROMBIN(&BIN) TODEC(LIBS) CHGVAR VAR(&COUNT) VALUE(1) CLRPFM FILE(QTEMP/QAFDBASI) MBR(*FIRST) MONMSG MSGID(CPF0000) CLRPFM FILE(QTEMP/QAFDMBRL) MBR(*FIRST) MONMSG MSGID(CPF0000) LOOP_FILE: + CHGVAR VAR(&START) VALUE(&COUNT * 10 - 7) CHGVAR VAR(&LIB) VALUE(%SST(&LIBS &START 10)) DSPFD FILE(&LIB/*ALL) TYPE(*BASATR) OUTPUT(*OUTFILE) + OUTFILE(QTEMP/QAFDBASI) OUTMBR(*FIRST *ADD) IF COND(&COUNT *LT LIBS) THEN(DO) CHGVAR VAR(&COUNT) VALUE(&COUNT + 1) GOTO CMDLBL(LOOP_FILE) ENDDO OPNQRYF FILE((QTEMP/QAFDBASI)) QRYSLT('ATDTAT *EQ ''S''') + KEYFLD((ATLIB) (ATFILE)) OVRDBF FILE(QAFDBASI) TOFILE(QTEMP/QAFDBASI) SHARE(*YES) LOOP_MBR: + RCVF MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END_MBR)) DSPFD FILE(&ATLIB/&ATFILE) TYPE(*MBRLIST) OUTPUT(*OUTFILE) + OUTFILE(QTEMP/QAFDMBRL) OUTMBR(*FIRST *ADD) GOTO CMDLBL(LOOP_MBR) END_MBR: + CHGVAR VAR(&BGNDAT6) VALUE(%SST(&BGNDAT 2 6)) CHGVAR VAR(&ENDDAT6) VALUE(%SST(&ENDDAT 2 6)) IF COND(&MBR *EQ '*ALL') THEN(CHGVAR VAR(&MBR) VALUE('*')) OPNQRYF FILE((QTEMP/QAFDMBRL)) QRYSLT('MLCHGD *EQ %RANGE(''' + *CAT &BGNDAT6 *CAT ''' ''' *CAT &ENDDAT6 *CAT ''') *AND + MLNAME *EQ %WLDCRD(''' *CAT &MBR *TCAT ''')') OVRDBF FILE(QAFDMBRL) TOFILE(QTEMP/QAFDMBRL) SHARE(*YES) IF COND(&MBR *EQ '*') THEN(CHGVAR VAR(&MBR) VALUE(*ALL)) CHGVAR VAR(&INCLUDE) VALUE(LIBS * 10) CHGVAR VAR(&LIBLIST) VALUE(%SST(&LIBS 3 &INCLUDE)) CALL PGM(EDT001RG) PARM(&MBR &LIBLIST &BGNDAT6 &ENDDAT6) ENDPGM
List Source Maintenance Activity
Figure 5 Printer file EDT001P1
A REF(QAFDMBRL) * A R HDR1 SKIPB(2) A 1DATE EDTCDE(Y) A 11TIME A 52'List Edited Source Members' A 112'LSTEDTSRC - Page' A 129PAGNBR EDTCDE(3) A SPACEA(1) A 1'Member:' A MBR 10 10 A 50'From' A BGNDAT 6 0 55EDTCDE(Y) A 69'To' A ENDDAT 6 0 72EDTCDE(Y) A 113'Library:' A LIBNAM 10 123 A SPACEA(3) * A R HDR2 A 1'Report Options:' A 23'Member:' A MBR 10 40 A SPACEA(2) A 23'Libraries:' A SPACEA(0) * A R HDR3 SPACEA(1) A LIB 10 40 * A R HDR4 A 1'Library' A 13'Src File' A 25'Member' A 37'Src Type' A 48'Text Description' A 100'Crt Date' A 110'Chg Date' A 122'Nbr Records' A SPACEA(2) * A R DETAIL SPACEA(1) A MLLIB R 1 A MLFILE R 13 A MLNAME R 25 A MLSEU2 R 37 A MLMTXT R 48 A CRTDAT 6 0 100EDTCDE(Y) A CHGDAT 6 0 110EDTCDE(Y) A MLNRCD R 120EDTCDE(1)
List Source Maintenance Activity
Figure 6 RPG program EDT001RG
FQAFDMBRLIP E K DISK FEDT001P1O E 98 PRINTER * C *IN98 IFEQ *ON C WRITEHDR1 C WRITEHDR4 C MOVE *OFF *IN98 C ENDIF * C MOVE MLCDAT CRTDAT C MULT 100.0001 CRTDAT C MOVE MLCHGD CHGDAT C MULT 100.0001 CHGDAT C WRITEDETAIL * C *INZSR BEGSR C *ENTRY PLIST C PARM MBR C PARM LIBS 250 C PARM BGNDT@ 6 C PARM ENDDT@ 6 C MOVE BGNDT@ BGNDAT C MOVE ENDDT@ ENDDAT C MULT 100.0001 BGNDAT C MULT 100.0001 ENDDAT C 10 SUBSTLIBS:11 TEST10 10 C TEST10 IFNE *BLANK C MOVEL'*LIST' LIBNAM C ELSE C MOVELLIBS LIBNAM C ENDIF C WRITEHDR1 C WRITEHDR2 C 1 DO 25 J 20 C J MULT 10 K 30 C SUB 9 K C 10 SUBSTLIBS:K LIB C LIB IFEQ *BLANK C LEAVE C ENDIF C WRITEHDR3 C ENDDO C WRITEHDR1 C WRITEHDR4 C ENDSR
LATEST COMMENTS
MC Press Online