IBM gave us two ways to send a message to all users: SNDMSG to *ALLWS, and SNDBRKMSG to *ALLACT. These methods, however, leave it to the receiving user to remove the messages from their message queues after reading them. Most users, though, forget to do so. The result is that message queues steadily increase in size unless periodically cleaned up.
Using the sign-on display is a better way to distribute a "newsletter." After all, every user must see the sign-on display. The technique presented here discusses that approach.
First, customize your sign-on display in such a way that messages are shown on it. Execute the following commands:
CRTMSGF MSGF(lib_name/SGN001MF) + TEXT('Message file for + Sign-On Newsletter') ADDMSGD MSGID(SGN0001) + MSGF(lib_name/SGN001MF) + MSG(' ')
Notice that the message file was created in library "lib_name." This must be the name of a library that is part of the system portion of the library list. Repeat the last command 15 more times, using MSGIDs SGN0002 to SGN0016. Now copy the sign-on display source code:
CPYSRCF FROMFILE(QGPL/QDDSSRC) + TOFILE(lib_name/QDDSSRC) + FROMMBR(QDSIGNON) + TOMBR(SGN001DF) + MBROPT(*ADD)
Start SEU to edit member SGN001DF in source file lib_name/QDDSSRC, changing it to match 4a. Please notice that the last field, MSG16, is only 78 characters long (while MSG1 to MSG15 are 79 characters long). This is needed to allow the system to display the error messages on the sign-on display; if MSG16 were enlarged to 79 characters, the last byte would "eat" the attribute byte of the error message. When you're done with this change, create the display file and make it the sign-on display file for subsystem QINTER:
Start SEU to edit member SGN001DF in source file lib_name/QDDSSRC, changing it to match Figure 4a. Please notice that the last field, MSG16, is only 78 characters long (while MSG1 to MSG15 are 79 characters long). This is needed to allow the system to display the error messages on the sign-on display; if MSG16 were enlarged to 79 characters, the last byte would "eat" the attribute byte of the error message. When you're done with this change, create the display file and make it the sign-on display file for subsystem QINTER:
CRTDSPF FILE(lib_name/SGN001DF) + SRCFILE(lib_name/QDDSSRC) + MAXDEV(256) CHGSBSD SBSD(QINTER) + SGNDSPF(lib_name/SGN001DF)
QINTER will show the new sign-on display the next time it is started.
You can now create display file NWS001DF, CL program NWS001CL, and command CHGNWSLTR (Figures 4b, 4c, and 4d, respectively), which are used to change the newsletter area of QINTER's sign-on display. As in the modified sign-on display, display file NWS001DF has a MSG16 field which must be only 78 characters long in order to match the last message line of the sign-on newsletter.
Simply execute command CHGNWSLTR (no parameters), which displays a facsimile of QINTER's sign-on display, presenting the current newsletter text. Type over it (or blank it out, as you wish), and press Enter. Your users will see the newsletter as soon as the sign-on display is redisplayed -- such as when a user signs off, or when QINTER is started.
TechTalk: Sign-on Newsletter
Figure 4A Customized Sign-On display (SGN001DF)
A DSPSIZ(24 80 *DS3) A R SIGNON A CLEAR A BLINK A 1 23' Sign On ' A DSPATR(HI) A 2 2'System . . . . . :' A SYSNAME 8A O 2 23 A 3 2'Subsystem . . . . :' A SBSNAME 10A O 3 23 A 4 2'Display . . . . . :' A DEVNAME 10A O 4 23 A 2 36'User . . . . . . . . . . . . . .' A USERID 10A B 2 71 A 01 3 36'Password . . . . . . . . . . . .' A 01 PASSWRD 10A I 3 71DSPATR(ND) A 4 36'Program/procedure . . . . . . . .' A PROGRAM 10A B 4 71CHECK(LC) A 5 36'Menu . . . . . . . . . . . . . .' A MENU 10A B 5 71CHECK(LC) A 6 36'Current library . . . . . . . . .' A CURLIB 10A B 6 71CHECK(LC) A 02 QSNERROR 80A O 24 1DSPATR(HI RI) A COPYRIGHT 40A O 24 40DSPATR(HI) A UBUFFER 128A H A MSG1 79A O 8 2MSGID(SGN 0001 SGN001MF) A DSPATR(HI) A MSG2 79A O 9 2MSGID(SGN 0002 SGN001MF) A DSPATR(HI) A MSG3 79A O 10 2MSGID(SGN 0003 SGN001MF) A DSPATR(HI) A MSG4 79A O 11 2MSGID(SGN 0004 SGN001MF) A DSPATR(HI) A MSG5 79A O 12 2MSGID(SGN 0005 SGN001MF) A DSPATR(HI) A MSG6 79A O 13 2MSGID(SGN 0006 SGN001MF) A DSPATR(HI) A MSG7 79A O 14 2MSGID(SGN 0007 SGN001MF) A DSPATR(HI) A MSG8 79A O 15 2MSGID(SGN 0008 SGN001MF) A DSPATR(HI) A MSG9 79A O 16 2MSGID(SGN 0009 SGN001MF) A DSPATR(HI) A MSG10 79A O 17 2MSGID(SGN 0010 SGN001MF) A DSPATR(HI) A MSG11 79A O 18 2MSGID(SGN 0011 SGN001MF) A DSPATR(HI) A MSG12 79A O 19 2MSGID(SGN 0012 SGN001MF) A DSPATR(HI) A MSG13 79A O 20 2MSGID(SGN 0013 SGN001MF) A DSPATR(HI) A MSG14 79A O 21 2MSGID(SGN 0014 SGN001MF) A DSPATR(HI) A MSG15 79A O 22 2MSGID(SGN 0015 SGN001MF) A DSPATR(HI) A MSG16 78A O 23 2MSGID(SGN 0016 SGN001MF) A DSPATR(HI)
TechTalk: Sign-on Newsletter
Figure 4B Display file NWS001DF
A* 91/01/17 13:07:52 MALERN REL-R03M00 5728-PW1 A DSPSIZ(24 80 *DS3) A PRINT A INDARA A CHECK(AB) A R ENTER A* 91/01/17 13:07:52 MALERN REL-R03M00 5728-PW1 A CF03(03 'EXIT') A CF12(12 'CANCEL') A CF21(21 'Command line') A BLINK A 1 2'UPDNWSBLT' A COLOR(BLU) A 1 31'Update News Bulletin' A COLOR(WHT) A 3 2'Type text of this news bulletin:' A COLOR(BLU) A 4 2'Use' A COLOR(BLU) A 4 6'*' A COLOR(WHT) A 4 8'on left margin to highlight the A line in' A COLOR(BLU) A 4 48'white.' A COLOR(WHT) A LINE01 75A B 5 2CHECK(LC) A LINE02 75A B 6 2CHECK(LC) A LINE03 75A B 7 2CHECK(LC) A LINE04 75A B 8 2CHECK(LC) A LINE05 75A B 9 2CHECK(LC) A LINE06 75A B 10 2CHECK(LC) A LINE07 75A B 11 2CHECK(LC) A LINE08 75A B 12 2CHECK(LC) A LINE09 75A B 13 2CHECK(LC) A LINE10 75A B 14 2CHECK(LC) A LINE11 75A B 15 2CHECK(LC) A LINE12 75A B 16 2CHECK(LC) A LINE13 75A B 17 2CHECK(LC) A LINE14 75A B 18 2CHECK(LC) A LINE15 75A B 19 2CHECK(LC) A LINE16 75A B 20 2CHECK(LC) A LINE17 75A B 21 2CHECK(LC) A LINE18 75A B 22 2CHECK(LC) A 23 2'F3=Exit F12=Cancel A Enter=Store- A F21=Cmd line' A COLOR(BLU)
TechTalk: Sign-on Newsletter
Figure 4C CL program NWS001CL
nws001cl: + pgm dclf file(nws001df) dcl var(&dtaara) type(*char) len(10) /* If data area does not exist, create it. */ chgvar var(&dtaara) value($nwsblt) chkobj obj(nwsbltlib/$nwsblt) objtype(*dtaara) monmsg msgid(cpf9801) exec(do) chgvar var(&dtaara) value($$nwsblt) crtdtaara dtaara(nwsbltlib/$$nwsblt) type(*char) len(1350) + text('News Bulletin data area') aut(*all) enddo /* Retrieve current text of news bulletin before displaying */ rtvdtaara dtaara(nwsbltlib/&dtaara (0001 75)) rtnvar(&line01) rtvdtaara dtaara(nwsbltlib/&dtaara (0076 75)) rtnvar(&line02) rtvdtaara dtaara(nwsbltlib/&dtaara (0151 75)) rtnvar(&line03) rtvdtaara dtaara(nwsbltlib/&dtaara (0226 75)) rtnvar(&line04) rtvdtaara dtaara(nwsbltlib/&dtaara (0301 75)) rtnvar(&line05) rtvdtaara dtaara(nwsbltlib/&dtaara (0376 75)) rtnvar(&line06) rtvdtaara dtaara(nwsbltlib/&dtaara (0451 75)) rtnvar(&line07) rtvdtaara dtaara(nwsbltlib/&dtaara (0526 75)) rtnvar(&line08) rtvdtaara dtaara(nwsbltlib/&dtaara (0601 75)) rtnvar(&line09) rtvdtaara dtaara(nwsbltlib/&dtaara (0676 75)) rtnvar(&line10) rtvdtaara dtaara(nwsbltlib/&dtaara (0751 75)) rtnvar(&line11) rtvdtaara dtaara(nwsbltlib/&dtaara (0826 75)) rtnvar(&line12) rtvdtaara dtaara(nwsbltlib/&dtaara (0901 75)) rtnvar(&line13) rtvdtaara dtaara(nwsbltlib/&dtaara (0976 75)) rtnvar(&line14) rtvdtaara dtaara(nwsbltlib/&dtaara (1051 75)) rtnvar(&line15) rtvdtaara dtaara(nwsbltlib/&dtaara (1126 75)) rtnvar(&line16) rtvdtaara dtaara(nwsbltlib/&dtaara (1201 75)) rtnvar(&line17) rtvdtaara dtaara(nwsbltlib/&dtaara (1276 75)) rtnvar(&line18) again: + sndrcvf if cond(&in21) then(do) call pgm(quscmdln) goto cmdlbl(again) enddo if cond(&in03 *or &in12) then(do) if cond(&dtaara *eq '$$NWSBLT') then(do) dltdtaara dtaara(nwsbltlib/$$nwsblt) enddo goto cmdlbl(endpgm) enddo /* Update data area */ chgdtaara dtaara(nwsbltlib/&dtaara (0001 75)) value(&line01) chgdtaara dtaara(nwsbltlib/&dtaara (0076 75)) value(&line02) chgdtaara dtaara(nwsbltlib/&dtaara (0151 75)) value(&line03) chgdtaara dtaara(nwsbltlib/&dtaara (0226 75)) value(&line04) chgdtaara dtaara(nwsbltlib/&dtaara (0301 75)) value(&line05) chgdtaara dtaara(nwsbltlib/&dtaara (0376 75)) value(&line06) chgdtaara dtaara(nwsbltlib/&dtaara (0451 75)) value(&line07) chgdtaara dtaara(nwsbltlib/&dtaara (0526 75)) value(&line08) chgdtaara dtaara(nwsbltlib/&dtaara (0601 75)) value(&line09) chgdtaara dtaara(nwsbltlib/&dtaara (0676 75)) value(&line10) chgdtaara dtaara(nwsbltlib/&dtaara (0751 75)) value(&line11) chgdtaara dtaara(nwsbltlib/&dtaara (0826 75)) value(&line12) chgdtaara dtaara(nwsbltlib/&dtaara (0901 75)) value(&line13) chgdtaara dtaara(nwsbltlib/&dtaara (0976 75)) value(&line14) chgdtaara dtaara(nwsbltlib/&dtaara (1051 75)) value(&line15) chgdtaara dtaara(nwsbltlib/&dtaara (1126 75)) value(&line16) chgdtaara dtaara(nwsbltlib/&dtaara (1201 75)) value(&line17) chgdtaara dtaara(nwsbltlib/&dtaara (1276 75)) value(&line18) if cond(&dtaara *eq '$$NWSBLT') then(do) rnmobj obj(nwsbltlib/$$nwsblt) objtype(*dtaara) newobj($nwsblt) enddo /* End program */ endpgm: + endpgm
TechTalk: Sign-on Newsletter
Figure 4D Command CHGNWSLTR
CHGNWSLTR: CMD PROMPT('Change Sign-On Newsletter')
LATEST COMMENTS
MC Press Online