Show completion messages on message line
Search400.com member John Blenkinsop provides a program that displays completion messages on the message line no matter what application the user is running.
Users like to know when a job they submitted has finished, but they don't like a message breaking on their screens....
Continue Reading This Article
Enjoy this article as well as all of our content, including E-Guides, news, tips and more.
This program displays completion messages on the message line no matter what application the user is running.
Once the CL program has been created, change the SBMJOB commands you are interested in so that they will send their completion messages to the workstation message queue. You do this inside the interactive CL (or other) programs that run your SBMJOB commands by getting the job name, which will be the workstation name. Then use the variable containing that name on the MSGQ parameter of the SBMJOB command.
Lastly, add the CHGMSGQ command to whatever initial program you use to specify the break message-handling program. The command would look like this:
CHGMSGQ MSGQ(*WRKSTN) DLVRY(*BREAK) PGM(name of program)
NOTE: The job must allow status messages to appear on the screen. This is controlled either by the system value QSTSMSG, by specifying USROPT(*STSMSG) on the User Profile, or by specifying STSMSG(*NORMAL) on a CHGJOB command.
What happens in operation
When the submitted job finishes, its completion message will be sent to the specified queue. The break handling program will run, and if the message is a *COMP message it will be redisplayed on line 24 or 27 as a *STATUS message.
All other types of message sent to that queue will be ignored; they will remain on the queue where the user can see them by using DSPMSG from that interactive job.
PGM PARM(&MSGQ &MSGQLIB &MSGK) DCL VAR(&MSGQ) TYPE(*CHAR) LEN(10) DCL VAR(&MSGQLIB) TYPE(*CHAR) LEN(10) DCL VAR(&MSGK) TYPE(*CHAR) LEN(4) DCL VAR(&TYPE) TYPE(*CHAR) LEN(2) DCL VAR(&MSGI) TYPE(*CHAR) LEN(7) DCL VAR(&MSGD) TYPE(*CHAR) LEN(256) DCL VAR(&MSGF) TYPE(*CHAR) LEN(10) DCL VAR(&MSGL) TYPE(*CHAR) LEN(10) /* Get the message that caused the break : */ RCVMSG MSGQ(&MSGQLIB/&MSGQ) MSGKEY(&MSGK) + RMV(*NO) MSGDTA(&MSGD) MSGID(&MSGI) + RTNTYPE(&TYPE) MSGF(&MSGF) SNDMSGFLIB(&MSGL) /* All completion messages must be displayed; others are ignored : */ IF COND(&TYPE *NE '01') THEN(GOTO + CMDLBL(ENDBRKPGM)) RCVMSG MSGQ(&MSGQLIB/&MSGQ) MSGKEY(&MSGK) RMV(*YES) SNDPGMMSG MSGID(&MSGI) MSGF(&MSGL/&MSGF) MSGDTA(&MSGD) + TOPGMQ(*EXT) MSGTYPE(*STATUS) ENDBRKPGM: ENDPGM