TechTalk: Expanding ADDMSGD

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

I have begun adding help text and messages into applications that I am developing. My preferred method is to store the text for the help in message files. I like this because I can have first and second levels of messages, and also because the programming for retrieving a message is straightforward.

The problem that I encountered was that the Add Message Description (ADDMSGD) and Change Message Description (CHGMSGD) commands (and also the option on the WRKMSGD display) only allow up to 512 characters for the second-level text. A message can hold up to 3000 characters in the second-level text, and I wanted more than 512, so that I could write longer help messages.

The EDTMSGD (Edit Message Description) command presented here (Figures 4a, 4b, and 4c) lets you enter or review and change the first- and second-level text for a message. I expanded the second-level text to allow up to 1,200 characters, which in the context of a help display, will fill about two-thirds of a display. I use the command exclusively for "text only" messages, since I have not made provisions for additional message options, such as substitution variables.

To create the command, you enter the source for the display file, the CL program and the command, then create the objects in that order.

To use the command, you enter the message identifier and the message file name. If the message is not in the message file, you can enter the first- and second-level text into the blank display. If the message is in the message file, the first- and second-level text are displayed, and you can then make any changes you want to the message.

-- Craig Pelkie


TechTalk: Expanding ADDMSGD

Figure 4A Display file MSG001DF

 A* 91/04/30 13:40:42 MALERN REL-R03M00 5728-PW1 A DSPSIZ(24 80 *DS3) A PRINT A R EDTMSG A* 91/04/30 13:40:42 MALERN REL-R03M00 5728-PW1 A TEXT('DISPLAY FORMAT FOR EDTMSGD') A CF03(03 'Exit') A CF12(12 'Cancel') A BLINK A 1 24'Edit Message Description (EDTMSGD)' A DSPATR(HI) A 2 1'Message identifier:' A XMIC 7A O 2 22TEXT('MIC number') A DSPATR(HI) A COLOR(WHT) A 4 1'First level text:' A XFIRST 80A B 5 1TEXT('First level text') A CHECK(LC) A 7 1'Second level text:' A XSEC 1200A B 8 1TEXT('Second level text') A CHECK(LC) A 23 2'F3=Exit F12=Cancel' A COLOR(BLU) 
TechTalk: Expanding ADDMSGD

Figure 4B CL program MSG001CL

 MSG001CL: + PGM PARM(&MSGID &MSGFLIB) DCL VAR(&MSGID) TYPE(*CHAR) LEN(7) DCL VAR(&MSGDATA1) TYPE(*CHAR) LEN(80) DCL VAR(&MSGDATA2) TYPE(*CHAR) LEN(1200) DCL VAR(&MSGF) TYPE(*CHAR) LEN(10) DCL VAR(&LIB) TYPE(*CHAR) LEN(10) DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(20) DCL VAR(&NOTFOUND) TYPE(*LGL) LEN(1) VALUE('0') DCLF FILE(MSG001DF) CHGVAR VAR(&MSGF) VALUE(%SST(&MSGFLIB 1 10)) CHGVAR VAR(&LIB) VALUE(%SST(&MSGFLIB 11 10)) RTVMSG MSGID(&MSGID) MSGF(&LIB/&MSGF) MSG(&MSGDATA1) + SECLVL(&MSGDATA2) MONMSG MSGID(CPF0000) EXEC(CHGVAR VAR(&NOTFOUND) VALUE('1')) CHGVAR VAR(&XMIC) VALUE(&MSGID) CHGVAR VAR(&XFIRST) VALUE(&MSGDATA1) CHGVAR VAR(&XSEC) VALUE(&MSGDATA2) SNDRCVF RCDFMT(EDTMSG) IF COND(&IN03 *OR &IN12) THEN(RETURN) IF COND(&NOTFOUND) THEN(DO) ADDMSGD MSGID(&MSGID) MSGF(&LIB/&MSGF) MSG(&XFIRST) + SECLVL(&XSEC) MONMSG MSGID(CPF0000) RETURN ENDDO CHGMSGD MSGID(&MSGID) MSGF(&LIB/&MSGF) MSG(&XFIRST) SECLVL(&XSEC) MONMSG MSGID(CPF0000) ENDPGM 
TechTalk: Expanding ADDMSGD

Figure 4C Command EDTMSGD

 EDTMSGD: CMD PROMPT('Edit Message Description') PARM KWD(MSGID) TYPE(*NAME) LEN(7) MIN(1) + PROMPT('Message ID') PARM KWD(MSGF) TYPE(QUAL1) MIN(1) PROMPT('Message + file name') QUAL1: QUAL TYPE(*NAME) LEN(10) EXPR(*YES) QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) + SPCVAL((*LIBL)) EXPR(*YES) + PROMPT('Library name') 
BLOG COMMENTS POWERED BY DISQUS