Tip

Copying a range of message IDs

Note:
Compile first the CLP program then the command program. When compiling the command program, make sure that the program to command process is pointing to the CPYMSGFL.


CPYMSGF (CMD)
CMD PROMPT('Copy Message File')
PARM KWD(FROMMSGF) TYPE(*NAME) LEN(10) +
PROMPT('From message file')
PARM KWD(FROMMSGL) TYPE(*NAME) LEN(10) DFT(*LIBL) +
SPCVAL((*LIBL) (*CURLIB)) PROMPT(' Library')
PARM KWD(TOMSGF) TYPE(*NAME) LEN(10) PROMPT('To +
message file')
PARM KWD(TOMSGL) TYPE(*NAME) LEN(10) DFT(*LIBL) +
SPCVAL((*LIBL) (*CURLIB)) PROMPT(' Library')
PARM KWD(FROM) TYPE(*NAME) LEN(7) DFT(*ALL) +
SPCVAL((*ALL)) PROMPT('From Message ID')
PARM KWD(TO) TYPE(*NAME) LEN(7) FULL(*YES) +
PROMPT(' To Message ID')
***** end of command source *****

CPYMSGFL (CLP)
/********************************************************************/
/*  Copy range of message ID to message file                        */
/********************************************************************/
/*  Parameters to be passed:                                        */
/*      From Message File                                           */
/*      From Message File Library                                   */
/*      To   Message File                                           */
/*      To   Message File Library                                   */
/*      From Message ID                                             */
/*      To   Message ID                                             */
/********************************************************************/
             PGM        PARM(&FMMSGF                                 +
                             &FMMSGL                                 +
                             &TOMSGF                                 +
                             &TOMSGL                                 +
                             &FMMSGI                                 +
                             &TOMSGI)

             DCL        VAR(&FMMSGF) TYPE(*CHAR) LEN(10)
             DCL        VAR(&FMMSGL) TYPE(*CHAR) LEN(10)
             DCL        VAR(&FMMSGI) TYPE(*CHAR) LEN(7)

             DCL        VAR(&TOMSGF) TYPE(*CHAR) LEN(10)
             DCL        VAR(&TOMSGL) TYPE(*CHAR) LEN(10)
             DCL        VAR(&TOMSGI) TYPE(*CHAR) LEN(7)

             DCL        VAR(&MSGID)  TYPE(*CHAR) LEN(7)
             DCL        VAR(&MOD)    TYPE(*CHAR) LEN(1)
             DCL        VAR(&USR)    TYPE(*CHAR) LEN(10)
             DCL        VAR(&JBD)    TYPE(*CHAR) LEN(10)

             DCLF       FILE(CPYMSGF)

 RTV:        RTVJOBA    USER(&USR) TYPE(&MOD)
             IF         COND(&MOD = '1') THEN(DO)
                        RTVDTAARA  DTAARA(BCMJOBD) RTNVAR(&JBD)
                        SBMJOB     CMD(CALL PGM(CPYMSGFL) PARM(&FMMSGF +
                          &FMMSGL &TOMSGF &TOMSGL &FMMSGI &TOMSGI)) +
                          JOB(CPYMSGF) JOBD(&JBD) LOG(4 0 +
                          *NOLIST) LOGCLPGM(*NO) HOLD(*NO)
                        GOTO       CMDLBL(END)
             ENDDO

 CRT:        CRTPF      FILE(QTEMP/CPYMSGF) RCDLEN(150)

 DSP:        DSPMSGD    RANGE(*ALL) MSGF(&FMMSGL/&FMMSGF) +
                          DETAIL(*BASIC) OUTPUT(*PRINT)

 CHG:        CHGJOB     RUNPTY(50)

 CPY:        CPYSPLF    FILE(QPMSGD) TOFILE(QTEMP/CPYMSGF) +
                          SPLNBR(*LAST)

 DLT:        DLTSPLF    FILE(QPMSGD) SPLNBR(*LAST)

 RCV:        RCVF
             MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(END))

             CHGVAR     VAR(&MSGID) VALUE(%SST(&CPYMSGF 2 7))

             IF         COND(&MSGID = '       ' *OR +
                             &MSGID = '5763SS1' *OR +
                             &MSGID = 'Message' *OR +
                             &MSGID = 'Start m' *OR +
                             &MSGID = 'MSGID  ')    +
                        THEN(GOTO CMDLBL(RCV))

             IF         COND(&FMMSGI = '*ALL   ') THEN(GOTO +
                          CMDLBL(MRG))

             IF         COND((&MSGID >= &FMMSGI) *AND +
                             (&MSGID <= &TOMSGI))     +
                           THEN(GOTO CMDLBL(MRG))

             GOTO       CMDLBL(RCV)

 MRG:        MRGMSGF    FROMMSGF(&FMMSGL/&FMMSGF) +
                          TOMSGF(&TOMSGL/&TOMSGF) SELECT(&MSGID)

             GOTO       CMDLBL(RCV)

 END:        RETURN
             ENDPGM
***** end of CLP source *****

This was first published in April 2001

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.