CL & display files

CLPs may be used with display files.

Confirming Using Prompt Display

This program shows CL using a display file to prompt a user to confirm an operation. The file is declared (DCLF), a device file (DSPF) defined with DDS. In a HLL such as RPG there would be a write/read operation or the EXFMT op code. However, in CL I/O to the display file is performed with the SNDRCVF command. In the example the code specifies the name of the record format that is to be used to pass the data between the CL program or ILE CL procedure and the user. The format contains all the fields in the record. The example is coded with a record format name since there is more than one record format in defined in the DDS. The first attempt to receive the file is to the first format to confirm the action. If the request is not confirmed, the program ends. Otherwise, the second format is displayed requesting data input from the operator.

/*********************************************************************/
/* Program Name - BBT050CL                                           */
/*                                                                   */
/* Function     - This program was designed as an operator interface */
/*                to send credit request files to BB&T.              */
/*                                                                   */
/* Programmer   - Steve Croy                      02/03/2009         */
/*********************************************************************/
/*********************************************************************/
/*                   Modification log                                */
/*                                                                   */
/*   Date    Programmer      Description                             */
/*                                                                   */
/*********************************************************************/
             PGM
             DCLF       FILE(BBT050DF)
             DCL        VAR(&USER) TYPE(*CHAR) LEN(10)
             CHGVAR     VAR(&PRGNAM) VALUE('BBT050CL')
             CHGVAR     VAR(&FMTNAM) VALUE('BBT05001')
             CHGVAR     VAR(&ZFSEQ1) VALUE('  BB&T Send Credit +
                          Requests   ')
             RTVJOBA    JOB(&JOBNAM) USER(&USER) NBR(&JOBNBR)
INIT:
             CHGVAR     VAR(&ZFINTF) VALUE('0')
             CHGVAR     VAR(&ZFCMP1) VALUE('X')
             CHGVAR     VAR(&ZFCMP3) VALUE('X')
             CHGVAR     VAR(&ZFCMP4) VALUE('X')
             CHGVAR     VAR(&ZFCMP9) VALUE('X')
START:
             SNDRCVF    RCDFMT(BBT05001)
             IF         COND(&IN03) THEN(GOTO CMDLBL(EXIT))
             IF         COND(&IN10) THEN(GOTO CMDLBL(CONFIRM))

             GOTO       START

CONFIRM:
             IF         COND(&ZFINTF *EQ '0') THEN(CHGVAR +
                          VAR(&ZFMODE) VALUE('Batch'))
             ELSE       CMD(CHGVAR VAR(&ZFMODE) VALUE('Interact'))

             IF         COND(&ZFCMP1 *EQ 'X') THEN(CHGVAR +
                          VAR(&ZFSEL1) VALUE('Selected'))
             ELSE       CMD(CHGVAR VAR(&ZFSEL1) VALUE('Omitted'))

             IF         COND(&ZFCMP3 *EQ 'X') THEN(CHGVAR +
                          VAR(&ZFSEL3) VALUE('Selected'))
             ELSE       CMD(CHGVAR VAR(&ZFSEL3) VALUE('Omitted'))

             IF         COND(&ZFCMP4 *EQ 'X') THEN(CHGVAR +
                          VAR(&ZFSEL4) VALUE('Selected'))
             ELSE       CMD(CHGVAR VAR(&ZFSEL4) VALUE('Omitted'))

             IF         COND(&ZFCMP9 *EQ 'X') THEN(CHGVAR +
                          VAR(&ZFSEL9) VALUE('Selected'))
             ELSE       CMD(CHGVAR VAR(&ZFSEL9) VALUE('Omitted'))

             SNDRCVF    RCDFMT(BBT05002)

             IF         COND(&IN03) THEN(GOTO CMDLBL(EXIT))
             IF         COND(&IN12) THEN(GOTO CMDLBL(START))

             IF         COND(&IN10) THEN(DO)
             IF         COND(&ZFCMP1 *EQ 'X') THEN(BBTCRDREQ +
                          MODE(&ZFINTF) COMPANY(01))
             IF         COND(&ZFCMP3 *EQ 'X') THEN(BBTCRDREQ +
                          MODE(&ZFINTF) COMPANY(03))
             IF         COND(&ZFCMP4 *EQ 'X') THEN(BBTCRDREQ +
                          MODE(&ZFINTF) COMPANY(04))
             IF         COND(&ZFCMP9 *EQ 'X') THEN(BBTCRDREQ +
                          MODE(&ZFINTF) COMPANY(09))

             IF         COND(&ZFINTF *EQ '0') THEN(GOTO CMDLBL(EXIT))
             ELSE       CMD(GOTO CMDLBL(START))

             ENDDO

             GOTO       CONFIRM
EXIT:
             RETURN
             ENDPGM

CLP Menus

In the sample above the display file is a simple prompt. However, CLPs are sometimes used as menu programs. CL is competent to build a menu process, though more sophisticated menus may be created with a HLL or UIM. CLPs are a quick and easy method of building a user menu. The display file provides the text and the option field. The CL provides the program/procedure actions directed by the option selected.

/*********************************************************************/
/* Program Name - ACT040CL                                           */
/*                                                                   */
/* Function     - This program was designed as a temporary menu.     */
/*                                                                   */
/* Programmer   - Steve Croy                      xx/xx/xxxx         */
/*********************************************************************/
/*********************************************************************/
/*                   Modification log                                */
/*                                                                   */
/*   Date    Programmer      Description                             */
/*********************************************************************/
             PGM
             DCLF       FILE(ACT040DF)
             CHGVAR     VAR(&PRGNAM) VALUE('ACT040CL')
             CHGVAR     VAR(&FMTNAM) VALUE('ACT04001')
             CHGVAR     VAR(&Z$SEQ1) VALUE(' Accounting Temporary +
                          Menu ')
             RTVJOBA    JOB(&JOBNAM) USER(&USER) NBR(&JOBNBR)
 START:      SNDRCVF    RCDFMT(ACT04001)
             IF         COND(&IN99) THEN(GOTO CMDLBL(EXIT))

             IF         COND(&OPTION *EQ 1) THEN(CALL PGM(JKCS0300))
             IF         COND(&OPTION *EQ 2) THEN(CALL PGM(YSCHJK00))
             IF         COND(&OPTION *EQ 3) THEN(CALL PGM(WHIPJK00))
             IF         COND(&OPTION *EQ 4) THEN(CALL PGM(GOF020))
             IF         COND(&OPTION *EQ 5) THEN(CALL PGM(GBK010))
             IF         COND(&OPTION *EQ 6) THEN(DO)
                ?CLBLD401K
                MONMSG CPF6801
             ENDDO

             IF         COND(&OPTION *EQ 7) THEN(CALL PGM(YASCL300))
             IF         COND(&OPTION *EQ 8) THEN(CALL PGM(NPAYRL04))
             IF         COND(&OPTION *EQ 9) THEN(CALL PGM(FIC010))
             IF         COND(&OPTION *EQ 10) THEN(CALL PGM(PYC947S))
             IF         COND(&OPTION *EQ 11) THEN(CALL PGM(PYC010))

             IF         COND(&OPTION *EQ 13) THEN(DSPMSG)
             IF         COND(&OPTION *EQ 14) THEN(WRKSPLF)
             IF         COND(&OPTION *EQ 16) THEN(CALL PGM(OER210) +
                          PARM('          '))
             IF         COND(&OPTION *EQ 17) THEN(CALL PGM(CSR095DU))
             IF         COND(&OPTION *EQ 18) THEN(CALL PGM(IN0500R))
             IF         COND(&OPTION *EQ 19) THEN(DO)
                       ?SNDSLSRPT
             MONMSG     MSGID(CPF6801)
             ENDDO
             IF         COND(&OPTION *EQ 24) THEN(OVRPRTF +
                          FILE(QPQUPRFIL) OUTQ(RICOH650))
             IF         (&OPTION *EQ 25) GO ACT010MN
             IF         COND(&OPTION *EQ 26) THEN(CALL PGM(UT009RSTC))
             IF         COND(&OPTION *EQ 27) THEN(CALL PGM(ACD010RP))

             IF         (&OPTION *EQ 90) SIGNOFF
             IF         COND(&OPTION *EQ 99) THEN(GOTO CMDLBL(EXIT))
             GOTO       START

EXIT:
             RETURN
             ENDPGM