Trying to find completion messages or an error message in a message queue can be troublesome. When scrolling through pages of messages, you not only get tired of visually scanning the messages, but you also may overlook what your searching for. I created the Search Message Queue (SCHMSGQ) command in 4, to search for a selected string of information. This command lets you enter a specific message queue that you want to search, along with the search string you want to search for.
Trying to find completion messages or an error message in a message queue can be troublesome. When scrolling through pages of messages, you not only get tired of visually scanning the messages, but you also may overlook what your searching for. I created the Search Message Queue (SCHMSGQ) command in Figure 4, to search for a selected string of information. This command lets you enter a specific message queue that you want to search, along with the search string you want to search for.
Once you've entered the desired parameters and pressed Enter, a screen will appear as if you ran a Display Physical File Member (DSPPFM) command. The search argument will be highlighted, and you can continue to scan by pressing F16. The search argument is not case-sensitive since you're using the Find String PDM (FNDSTRPDM) command. This can be a big benefit if you do not know how the message is formatted. The CPP (MSG015CL) for the SCHMSGQ command is illustrated in 5.
Once you've entered the desired parameters and pressed Enter, a screen will appear as if you ran a Display Physical File Member (DSPPFM) command. The search argument will be highlighted, and you can continue to scan by pressing F16. The search argument is not case-sensitive since you're using the Find String PDM (FNDSTRPDM) command. This can be a big benefit if you do not know how the message is formatted. The CPP (MSG015CL) for the SCHMSGQ command is illustrated in Figure 5.
A shortcoming to this approach is that the command runs interactively, so if the message queue is large, running the command could take some time. Most message queues are cleared periodically, so this may not be an issue.
Search Message Queue
Figure 4 The SCHMSGQ Command Definition
/*==================================================================*/ /* To compile: */ /* */ /* CRTCMD CMD(XXX/SCHMSGQ) PGM(XXX/MSG015CL) + */ /* SRCFILE(XXX/QCMDSRC) */ /* */ /*==================================================================*/ CMD PROMPT('Search Message Queues') PARM KWD(MSGQ) TYPE(QUAL1) MIN(1) PROMPT('Message + queue name') QUAL1: QUAL TYPE(*NAME) LEN(10) DFT(' ') QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) SPCVAL((*LIBL)) PARM KWD(ARGUMENT) TYPE(*CHAR) LEN(50) + DFT(MESSAGES) PROMPT('Search')
Search Message Queue
Figure 5 CPP MSG015CL for SCHMSGQ Command
/*==================================================================*/ /* To compile: */ /* */ /* CRTCLPGM PGM(XXX/MSG015CL) SRCFILE(XXX/QCLSRC) */ /* */ /*==================================================================*/ MSG015CL: + PGM PARM(&MSGQLIB &ARGU) DCL VAR(&MSGQLIB) TYPE(*CHAR) LEN(20) DCL VAR(&MSGQ) TYPE(*CHAR) LEN(10) DCL VAR(&ARGU) TYPE(*CHAR) LEN(50) DCL VAR(&LIB) TYPE(*CHAR) LEN(10) DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(100) CHGVAR VAR(&MSGQ) VALUE(&MSGQLIB) CHGVAR VAR(&LIB) VALUE(%SST(&MSGQLIB 11 10)) DSPMSG MSGQ(&LIB/&MSGQ) OUTPUT(*PRINT) MONMSG MSGID(CPF2403) EXEC(DO) CHGVAR VAR(&MSGDTA) VALUE('''Message Queue'' *BCAT &MSGQ + *BCAT ''in'' *BCAT ''Library'' *BCAT &LIB *BCAT ''Not + Found'')') GOTO CMDLBL(ERROR) ENDDO CRTPF FILE(QTEMP/MSGQF) RCDLEN(132) SIZE(*NOMAX) MONMSG MSGID(CPF7302) EXEC(CLRPFM FILE(QTEMP/MSGQF)) CPYSPLF FILE(QPDSPMSG) TOFILE(QTEMP/MSGQF) SPLNBR(*LAST) DLTSPLF FILE(QPDSPMSG) SPLNBR(*LAST) FNDSTRPDM STRING(&ARGU) FILE(QTEMP/MSGQF) MBR(*ALL) OPTION(*DSP + *NOPROMPT) DLTF FILE(QTEMP/MSGQF) GOTO CMDLBL(END) ERROR: + SNDPGMMSG MSG(&MSGDTA) MSGTYPE(*COMP) END: + ENDPGM
LATEST COMMENTS
MC Press Online