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

Dig deeper on Integrated File System (IFS)

0 comments

Oldest 

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:

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close