Search Message Queue

General
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

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 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: