Work Station Message Ticker

The AS/400 has a feature that enables a program to execute whenever a message arrives on a message queue. The programs are called 'break-handling' programs. You can attach a break-handling program to your work-station message queue and whenever a message arrives it appears moving from right to left along the status message line at the bottom of the screen, just like a stock-quotes ticker line.


Message Example:

stsmsg.gif (42243 bytes)

 

The code for the break-handling program is detailed below.


QCLSRC source:               STSMSG

                    PGM             PARM(&MSGQ &MSGL &MSGK)
                    DCL              VAR(&MSGQ) TYPE(*CHAR) LEN(10)
                    DCL              VAR(&MSGL) TYPE(*CHAR) LEN(10)
                    DCL              VAR(&MSGK) TYPE(*CHAR) LEN(4)
                    DCL              VAR(&BLANK) TYPE(*CHAR) LEN(75)
                    DCL              VAR(&I) TYPE(*DEC) LEN(2 0) VALUE(75)

                    DCL              VAR(&MSG) TYPE(*CHAR) LEN(200)
                    DCL              VAR(&MSGDTA) TYPE(*CHAR) LEN(200)
                    DCL              VAR(&MSGID) TYPE(*CHAR) LEN(7)
                    DCL              VAR(&MSGF) TYPE(*CHAR) LEN(10)
                    DCL              VAR(&MSGL) TYPE(*CHAR) LEN(10)
                    MONMSG      MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR))

                    RCVMSG         MSGQ(&MSGQ) MSGKEY(&MSGK) RMV(*NO) MSG(&MSG)
LOOP:               SNDPGMMSG   MSGID(CPF9898) MSGF(QCPFMSG) +
                                        MSGDTA(%SST(&BLANK 1 &I) || &MSG) +
                                       TOPGMQ(*EXT) MSGTYPE(*STATUS)
                    IF                COND(&I *GT 1) THEN(DO)
                    CHGVAR       VAR(&I) VALUE(&I -5)
                    GOTO           CMDLBL(LOOP)
                    ENDDO

                    SNDPGMMSG   MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&MSG) +
                                        TOPGMQ(*EXT) MSGTYPE(*STATUS)
                    RETURN

ERROR:
 MSGD:             RCVMSG      MSGTYPE(*DIAG) MSG(&MSG) MSGDTA(&MSGDTA) +
                                        MSGID(&MSGID) MSGF(&MSGF) MSGFLIB(&MSGL)
                   IF                   COND(&MSGID *NE ' ') THEN(DO)
                   SNDPGMMSG MSGID(&MSGID) MSGF(&MSGL/&MSGF) +
                                        MSGDTA(&MSGDTA) MSGTYPE(*DIAG)
                   GOTO             CMDLBL(MSGD)
                   ENDDO 
 MSGE:             RCVMSG        MSGTYPE(*EXCP) MSG(&MSG) MSGDTA(&MSGDTA) +
                                         MSGID(&MSGID) MSGF(&MSGF) MSGFLIB(&MSGL)
                   IF                    COND(&MSGID *NE ' ') THEN(SNDPGMMSG +
                                         MSGID(&MSGID) MSGF(&MSGL/&MSGF) +
                                         MSGDTA(&MSGDTA) MSGTYPE(*ESCAPE))

                   ENDPGM   



To activate the message ticker, the break-handling program needs to be attached to the message queue. Insert the following code into your initial program to set up the message ticker feature.



QCLSRC source:            (initial program)


                DCL VAR(&USER) TYPE(*CHAR) LEN(10)

    /* Retrieve USER */
                RTVJOBA USER(&USER) 

   /* Change USER message queue for Ticker Line */
                CHGMSGQ MSGQ(&USER) DLVRY(*BREAK) PGM(@COMMON/STSMSG)





Home | Software Solutions | iSeries Security | Tips & Techniques | Consulting | About us | Contact Us



Sentinex Inc.
379 Hamilton Drive
Stewartsville, NJ, 08886

Telephone: (800) 822 1004
Outside USA: (908) 213 8650
FAX: (908) 213 8652
e-Mail: info@sentinex.com
Member of PartnerWorld for Developers
IBM is a registered trademark of IBM Corporation.

All content copyright 2002, Sentinex Inc. All rights reserved.