When we're looking at a program, one of the things we often wonder is what the keys for a certain file are. We've written a small utility that we use from the command line window in SEU (you can get this by pressing F21). When you run the command DSPKEY, it shows the keys for the file on the message line (See 4). The source for the command and the programs it uses is in5, 6, and 7.
When we're looking at a program, one of the things we often wonder is what the keys for a certain file are. We've written a small utility that we use from the command line window in SEU (you can get this by pressing F21). When you run the command DSPKEY, it shows the keys for the file on the message line (See Figure 4). The source for the command and the programs it uses is in Figures 5, 6, and 7.
Show File Keys Utility
Figure 4 Using the DSPKEY Command
UNABLE TO REPRODUCE GRAPHICS
Show File Keys Utility
Figure 5 DSPKEY Command Source
/*==================================================================*/ /* To compile: */ /* */ /* CRTCMD CMD(XXX/DSPKEY) PGM(XXX/KEY002CL) + */ /* SRCFILE(XXX/QCMDSRC) */ /* */ /*==================================================================*/ DSPKEY: CMD PROMPT('Display Keys in a File') PARM KWD(FILE) TYPE(QUAL1) MIN(1) PROMPT('File') QUAL1: QUAL TYPE(*NAME) LEN(10) QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) + SPCVAL((*LIBL)) PROMPT('Library')
Show File Keys Utility
Figure 6 KEY002CL Source
/*===============================================================*/ /* To compile: */ /* */ /* CRTCLPGM PGM(XXX/KEY002CL) SRCFILE(XXX/QCLSRC) */ /* */ /*===============================================================*/ KEY002CL: + PGM PARM(&LIBFILE) DCL VAR(&LIBFILE) TYPE(*CHAR) LEN(20) DCL VAR(&FILE) TYPE(*CHAR) LEN(10) DCL VAR(&LIB) TYPE(*CHAR) LEN(10) DCL VAR(&MSG) TYPE(*CHAR) LEN(133) DCL VAR(&TXT) TYPE(*CHAR) LEN(150) DCL VAR(&MSGID) TYPE(*CHAR) LEN(7) DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(80) CHGVAR VAR(&LIB) VALUE(%SST(&LIBFILE 11 10)) CHGVAR VAR(&FILE) VALUE(%SST(&LIBFILE 1 10)) CHKOBJ OBJ(&LIB/&FILE) OBJTYPE(*FILE) AUT(*OBJOPR) MONMSG MSGID(CPF0000) EXEC(DO) RCVMSG MSGDTA(&MSGDTA) MSGID(&MSGID) RTVMSG MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) MSG(&TXT) GOTO CMDLBL(MSG) ENDDO DSPFD FILE(&LIB/&FILE) TYPE(*ACCPTH) OUTPUT(*OUTFILE) + OUTFILE(QTEMP/KEYF) OUTMBR(*FIRST *REPLACE) OVRDBF FILE(QAFDACCP) TOFILE(QTEMP/KEYF) CALL PGM(KEY002RG) PARM(&MSG) DLTOVR FILE(QAFDACCP) CHGVAR VAR(%SST(&TXT 1 10)) VALUE(&FILE) CHGVAR VAR(%SST(&TXT 12 4)) VALUE('KEY:') CHGVAR VAR(%SST(&TXT 17 133)) VALUE(&MSG) MSG: + SNDPGMMSG MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA(&TXT) MSGTYPE(*INFO) ENDPGM
Show File Keys Utility
Figure 7 KEY002RG Source
*=============================================================== * To compile: * * CRTRPGPGM PGM(XXX/KEY002RG) SRCFILE(XXX/QRPGSRC) * *=============================================================== *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 FQAFDACCPIP E DISK C *ENTRY PLIST C PARM WKMSG 133 C CAT APKEYF:1 WKMSG
LATEST COMMENTS
MC Press Online