/* PROGRAM: V99_CL */ /* AUTHOR : Victor Voilevitch */ /* DATE : 15 Nov 1998 */ /* */ /* DESCRIPTION: */ /* Utility program that counts total */ /* number of records in all members of physical file */ /* */ /* PARAMETERS: */ /* &LIB - library */ /* &FILE - physical file */ /* &TOTAL - total records (return value) */ /* &PERR - error flag */ /* return '0' if successful complete */ /* '1' if error */ /* '2' if file not exist */ /* '3' if file has no members */ /* */ /* MONITORED MESSAGES: */ /* CPF0864 End of file detected for file &1 in &2 */ /* CPF3012 File &1 in library &2 not found */ /* CPF9864 Override not found at specified level */ /* */ /* ================================================================= */ PGM PARM(&LIB &FILE &TOTAL &PERR) DCL VAR(&LIB) TYPE(*CHAR) LEN(10) DCL VAR(&FILE) TYPE(*CHAR) LEN(10) DCL VAR(&TOTAL) TYPE(*DEC) LEN(15 0) DCL VAR(&PERR) TYPE(*CHAR) LEN(1) DCL VAR(&START) TYPE(*CHAR) LEN(1) DCLF QSYS/QAFDMBRL /********************************************************************/ /* Start Of Program */ /********************************************************************/ CHGVAR VAR(&PERR) VALUE('0') CHGVAR VAR(&START) VALUE('Y') CHGVAR VAR(&TOTAL) VALUE(0) DSPFD FILE(&LIB/&FILE) TYPE(*MBRLIST) + OUTPUT(*OUTFILE) FILEATR(*PF) + OUTFILE(QTEMP/V99_CL) OUTMBR(&FILE + *REPLACE) MONMSG MSGID(CPF3012) EXEC(GOTO CMDLBL(FILENOTEX)) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(FILEERROR)) OVRDBF FILE(QAFDMBRL) TOFILE(QTEMP/V99_CL) + MBR(&FILE) OVRSCOPE(*JOB) START: RCVF MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(ENDOFFILE)) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(FILEERROR)) IF COND(&MLNOMB = 0) THEN(GOTO CMDLBL(FILENOMBR)) CHGVAR VAR(&START) VALUE('N') CHGVAR VAR(&TOTAL) VALUE(&TOTAL + &MLNRCD) GOTO CMDLBL(START) ENDOFFILE: IF COND(&START = 'Y') THEN(GOTO CMDLBL(FILEERROR)) GOTO CMDLBL(END) FILEERROR: CHGVAR VAR(&PERR) VALUE('1') GOTO CMDLBL(END) FILENOTEX: CHGVAR VAR(&PERR) VALUE('2') GOTO CMDLBL(END) FILENOMBR: CHGVAR VAR(&PERR) VALUE('3') GOTO CMDLBL(END) END: DLTOVR FILE(QAFDMBRL) LVL(*JOB) MONMSG MSGID(CPF9841) ENDPGM