The AS/400 creates a message queue for each display device and user on the system. These message queues can grow in size if the user does not clear received messages. The program, MSG00CL, and two other associated programs, MSG01CL and MSG01, will save the messages of each message queue to a file and then will clear the queue.
The CL program MSG00CL uses the DSPOBJD command to create a file of all type of *MSGQ objects within the library list. The program reads the created file and will call MSG01CL to process each message queue. Program MSG01CL is called using the message queue and message queue library as parameters. MSG01CL will create a file (WRKF) in the current library (if the file does not exist), and will receive the messages from the top of the message queue, removing each message so the next message becomes the top message. For each message, a call is made to an RPG program (MSG01) with the message text, message queue library, and message queue as parameters. The RPG program writes each message to file WRKF. MSG01CL will not process the QHST message queue or message queues that are allocated to other users. Running the CLRMSGQ command after all messages have been removed reduces the size of the queue.
The program MSG01CL can be called from the command line or from any other program using the message queue and library as parameters.
Alon Fluxman Highlands Ranch, Colorado
TechTalk: Keeping Your Message Files Under Contro
Figure 1 RPG program MSG01
FWRKF O F 152 DISK C *ENTRY PLIST C PARM MSG 132 C PARM MSGQ 10 C PARM MSGQL 10 C EXCPT#OUT C SETON LR OWRKF E #OUT O MSGQ 10 O MSGQL 20 O MSG 152
TechTalk: Keeping Your Message Files Under Contro
Figure 2 CL program MSG00CL
MSG00CL: + PGM DCLF FILE(QSYS/QADSPOBJ) DLTF FILE(QTEMP/WRKF1) MONMSG MSGID(CPF2105) DSPOBJD OBJ(*ALL) OBJTYPE(*MSGQ) OUTPUT(*OUTFILE) + OUTFILE(QTEMP/WRKF1) OUTMBR(*FIRST *ADD) OVRDBF FILE(QADSPOBJ) TOFILE(QTEMP/WRKF1) MBR(*ALL) LOOP: + RCVF MONMSG MSGID(CPF0864) EXEC(RETURN) CALL PGM(MSG01CL) PARM(&ODOBNM &ODLBNM) GOTO CMDLBL(LOOP) ENDPGM
TechTalk: Keeping Your Message Files Under Contro
Figure 3 CL program MSG01CL
MSG01CL: + PGM PARM(&MSGQ &MSGQLIB) DCL VAR(&MSGQ) TYPE(*CHAR) LEN(10) DCL VAR(&MSGQLIB) TYPE(*CHAR) LEN(10) DCL VAR(&MSG) TYPE(*CHAR) LEN(10) DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(10) MONMSG MSGID(CPF2451 CPF2433) EXEC(GOTO CMDLBL(END)) CRTPF FILE(*CURLIB/WRKF) RCDLEN(152) MONMSG MSGID(CPF5813 CPF7302) EXEC(GOTO CMDLBL(OVR)) OVR: + OVRDBF FILE(WRKF) TOFILE(*CURLIB/WRKF) LOOP: + RCVMSG MSGQ(&MSGQLIB/&MSGQ) MSGTYPE(*NEXT) MSGKEY(*TOP) + RMV(*YES) MSG(&MSG) IF COND(&MSG *EQ ' ') THEN(DO) CLRMSGQ MSGQ(&MSGQLIB/&MSGQ) RETURN ENDDO CALL PGM(MSG01) PARM(&MSG &MSGQ &MSGQLIB) GOTO CMDLBL(LOOP) END: + RETURN ENDPGM
LATEST COMMENTS
MC Press Online