/* PROGRAM: DSPFAC */
/* THIS PROGRAM DISPLAYS THE FILE ATTRIBUTES OF A FILE USING */
/* OUTPUT FILES FROM THE DSPFFD AND DSPFD COMMANDS. */
/* FILE = QADSPFFD, FORMAT QWHDRFFD */
/* QAFDACCP QWHFDACP */
/* QADSPDBR QWHDRDBR */
/* QADSPFD QWHFD */
PGM PARM(&FILELIBR &OUTPUT)
DCLF FILE(QADSPOBJ)
DCL VAR(&FILELIBR) TYPE(*CHAR) LEN(20)
DCL VAR(&FILE) TYPE(*CHAR) LEN(10)
DCL VAR(&LIBR) TYPE(*CHAR) LEN(10)
DCL VAR(&OUTPUT) TYPE(*CHAR) LEN(5)
DCL VAR(&IDX) TYPE(*DEC) LEN(2 0) VALUE(0)
DCL VAR(&ERRORSW) TYPE(*LGL)
DCL VAR(&MSGID) TYPE(*CHAR) LEN(7)
DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(100)
DCL VAR(&MSGF) TYPE(*CHAR) LEN(10)
DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10)
MONMSG MSGID(CPF0000) EXEC(GOTO STDERR1)
CHGVAR VAR(&FILE) VALUE(%SST(&FILELIBR 01 10))
CHGVAR VAR(&LIBR) VALUE(%SST(&FILELIBR 11 10))
/* IF *GENERIC WAS NOT SELECTED – DO */
/* IF *ALL WAS NOT SELECTED – DO */
LOOP:
CHGVAR VAR(&IDX) VALUE(&IDX + 1)
IF COND(%SST(&FILE &IDX 1) *EQ ‘*’) +
THEN(GOTO GENERIC)
IF COND(&IDX < 10) THEN(GOTO LOOP)
/* ASSUME ONLY 1 ENTRY */
CHKOBJ OBJ(&LIBR/&FILE) OBJTYPE(*FILE) AUT(*OBJEXIST)
MONMSG MSGID(CPF0000) EXEC(GOTO STDERR1)
CALL PGM(DSPFAC2) PARM(&FILELIBR &OUTPUT)
GOTO END
/* IF *ALL OR *GENERIC SELECTED */
/* DSPOBJD OF ALL FILES IN LIBRARY */
GENERIC:
DSPOBJD OBJ(&LIBR/&FILE) OBJTYPE(*FILE) +
OUTPUT(*OUTFILE) OUTFILE(QTEMP/XDSPOBJD)
OVRDBF FILE(QADSPOBJ) TOFILE(QTEMP/XDSPOBJD)
READ:
RCVF
MONMSG MSGID(CPF0864) EXEC(DO)
END:
DLTF FILE(QTEMP/X*)
RETURN
ENDDO
IF COND(%SST(&ODOBNM 1 1) = ‘Q’) THEN(GOTO READ)
IF COND(&ODOBAT *EQ ‘PF ‘ +
*OR &ODOBAT *EQ ‘LF ‘) THEN(DO)
CHGVAR VAR(%SST(&FILELIBR 01 10)) VALUE(&ODOBNM)
CHGVAR VAR(%SST(&FILELIBR 11 10)) VALUE(&ODLBNM)
CALL PGM(DSPFAC2) PARM(&FILELIBR &OUTPUT)
ENDDO
GOTO READ
STDERR1:
/* Standard error handling routine */
IF COND(&ERRORSW) THEN(SNDPGMMSG MSGID(CPF9999) +
MSGF(QCPFMSG) MSGTYPE(*ESCAPE)) /* Func +
chk */
CHGVAR VAR(&ERRORSW) VALUE(‘1’) /* Set to fail ir +
error occurs */
STDERR2:
RCVMSG MSGTYPE(*DIAG) MSGDTA(&MSGDTA) MSGID(&MSGID) +
MSGF(&MSGF) MSGFLIB(&MSGFLIB)
IF COND(&MSGID *EQ ‘ ‘) THEN(GOTO +
CMDLBL(STDERR3))
SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) MSGTYPE(*DIAG)
GOTO STDERR2 /* Loop back for addl diagnostics */
STDERR3:
RCVMSG MSGTYPE(*EXCP) MSGDTA(&MSGDTA) MSGID(&MSGID) +
MSGF(&MSGF) MSGFLIB(&MSGFLIB)
SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) MSGTYPE(*ESCAPE)
ENDPGM