/* PROGRAM: V98_CL */ /* AUTHOR : Victor Voilevitch */ /* DATE : 15 Nov 1998 */ /* */ /* DESCRIPTION: */ /* Utility program that clears */ /* all members in physical file */ /* */ /* PARAMETERS: */ /* &LIB - library */ /* &FILE - file */ /* &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 &PERR) DCL VAR(&LIB) TYPE(*CHAR) LEN(10) DCL VAR(&FILE) TYPE(*CHAR) LEN(10) DCL VAR(&PERR) TYPE(*CHAR) LEN(1) DCLF QSYS/QAFDMBRL /********************************************************************/ /* Start Of Program */ /********************************************************************/ CHGVAR VAR(&PERR) VALUE('0') DSPFD FILE(&LIB/&FILE) TYPE(*MBRLIST) + OUTPUT(*OUTFILE) FILEATR(*PF) + OUTFILE(QTEMP/V98_CL) OUTMBR(&FILE *REPLACE) MONMSG MSGID(CPF3012) EXEC(GOTO CMDLBL(FILENOTEX)) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(FILEERROR)) OVRDBF FILE(QAFDMBRL) TOFILE(QTEMP/V98_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)) CLRPFM FILE(&LIB/&FILE) MBR(&MLNAME) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(FILEERROR)) GOTO CMDLBL(START) ENDOFFILE: 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