Article

Transfer group job menu tools -- Code

Vengoal Chang
/**     GRPJOBMNU -- Group Job Utility                    **/
/**     Author: Vengoal Chang                             **/
/**     2002/04/08                                        **/
/**     GRPJOBDFTC : Create Default Dataarea in QUSRTEMP  **/
GRPJOBDFTC: +
     PGM
             DCL        VAR(&USER) TYPE(*CHAR) LEN(10)
             CHGVAR     &USER 'GRPJOBDFT'
             CRTDTAARA  DTAARA(QUSRTEMP/GRPJOBDFT) TYPE(*CHAR) +
                          LEN(1200) TEXT('Group Job Default +
                          DataArea for Job & Comand')
             MONMSG CPF0000

CMDKEY:
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (1 25)) VALUE('WRKSPLF')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (26 25)) +
                          VALUE('?WRKJOBQ QBATCH')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (51 25)) +
                          VALUE('WRKACTJOB SBS(QBATCH)')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (76 25)) +
                          VALUE('WRKACTJOB SBS(*ALL)')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (101 25)) +
                          VALUE('WRKSBMJOB')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (126 25)) VALUE('WRKMSG')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (151 25)) VALUE('WRKJOB')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (176 25)) VALUE(' ')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (201 25)) VALUE('CALL +
                          QUSCMDLN')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (226 25)) VALUE('CALL +
                          QEZSNDMG')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (251 25)) VALUE(' ')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (276 25)) +
                          VALUE('SIGNOFF')
JOB:
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (301 20)) VALUE('Group +
                          Job 1')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (321 30)) VALUE('CALL +
                          QCMD')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (902 1)) VALUE('Y')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (351 20)) VALUE('Group +
                          Job 2')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (371 30)) VALUE('CALL +
                          QCMD')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (903 1)) VALUE('Y')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (401 20)) VALUE('Group +
                          Job 3')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (421 30)) VALUE('CALL +
                          QCMD')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (904 1)) VALUE('Y')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (451 20)) VALUE('Group +
                          Job 4')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (471 30)) VALUE('CALL +
                          QCMD')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (905 1)) VALUE('Y')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (501 20)) VALUE('Group +
                          Job 5')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (521 30)) VALUE('CALL +
                          QCMD')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (906 1)) VALUE('Y')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (551 20)) VALUE('Group +
                          Job 6')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (571 30)) VALUE('CALL +
                          QCMD')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (907 1)) VALUE('Y')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (601 20)) VALUE('Group +
                          Job 7')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (521 30)) VALUE('CALL +
                          QCMD')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (908 1)) VALUE('Y')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (651 20)) VALUE('Group +
                          Job 8')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (671 30)) VALUE('CALL +
                          QCMD')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (909 1)) VALUE('Y')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (701 20)) VALUE('Work +
                          Query(s)')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (721 30)) VALUE('WRKQRY')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (910 1)) VALUE('Y')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (751 20)) VALUE('Query +
                          Manager')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (771 30)) VALUE('STRQM')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (911 1)) VALUE('Y')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (801 20)) VALUE(SQL)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (821 30)) VALUE('STRSQL')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (912 1)) VALUE('Y')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (851 20)) VALUE('STRPDM')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (871 30)) VALUE('STRPDM')
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (913 1)) VALUE('Y')
COLOR:
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (901 1)) VALUE('1')
             RETURN
             ENDPGM

========================================

      *     GRPJOBMNU -- Group Job Utility   
      *     Author: Vengoal Chang            
      *     2002/04/08                       
      *     GRPJOBMNUD -- TRANSFER GROUP JOB AND COMMAND WINDOW
      *     COMPILED WTIH  RSTDSP(*YES)
      *
     A                                      DSPSIZ(24 80 *DS3)
     A                                      CA03(03 'EXIT')
     A                                      CA01(01 'EXIT')
     A                                      CA02(02 'ALT')
     A                                      CF04(04 'PROMPT')
     A                                      CA05(05 'REFRESH')
     A                                      CF06(06 'JOBS')
     A                                      CF07(07 'FKEYS')
     A                                      CF08(08 'PREV')
     A                                      CF09(09 'NEXT')
     A                                      CA10(10 'ABOUT')
     A                                      CA11(11 'COLOR')
     A                                      CA12(12 'CANCEL')
     A
     A          R OPTIONS                   WINDOW(2 9 17 60 *NOMSGLIN)
     A*         R OPTIONS                   WINDOW(2 9 18 60)
     A  81                                  WDWBORDER((*COLOR BLU) +
     A                                                (*DSPATR RI) +
     A                                                (*CHAR '        '))
     A  82                                  WDWBORDER((*COLOR GRN) +
     A                                                (*DSPATR RI) +
     A                                                (*CHAR '        '))
     A  83                                  WDWBORDER((*COLOR WHT) +
     A                                                (*DSPATR RI) +
     A                                                (*CHAR '        '))
     A  84                                  WDWBORDER((*COLOR RED) +
     A                                                (*DSPATR RI) +
     A                                                (*CHAR '        '))
     A  85                                  WDWBORDER((*COLOR TRQ) +
     A                                                (*DSPATR RI) +
     A                                                (*CHAR '        '))
     A  86                                  WDWBORDER((*COLOR YLW) +
     A                                                (*DSPATR RI) +
     A                                                (*CHAR '        '))
     A  87                                  WDWBORDER((*COLOR PNK) +
     A                                                (*DSPATR RI) +
     A                                                (*CHAR '        '))
     A                                      OVERLAY
     A                                      CF13(13)
     A                                      CF14(14)
     A                                      CF15(15)
     A                                      CF16(16)
     A                                      CF17(17)
     A                                      CF18(18)
     A                                      CF19(19)
     A                                      CF20(20)
     A                                      CF21(21)
     A                                      CF22(22)
     A                                      CF23(23)
     A                                      CF24(24)
     A                                  1  1USER
     A                                  1 12'Transfer to Group Job/Co-
     A                                      mmand Key Window'
     A                                      DSPATR(RI)
     A                                  1 53SYSNAME
     A                                      COLOR(BLU)
     A  91                             17  1'F1/F3=Exit F2=Alt-Keys F4=Prompt -
     A                                      F5=Rsfresh F6=Jobs F7=FKeys'
     A                                      DSPATR(RI)
     A N91                             17  1'F2=Alt F8=Rtv-Prev F9=Rtv-Nxt -
     A                                      F10=About F11=Color F12=Cancel'
     A                                      DSPATR(RI)
      * BORDER END
     A                                  2  1' 1)'
     A  31                                  COLOR(RED) DSPATR(BL)
     A  61                                  COLOR(PNK)
     A                                  3  1' 2)'
     A  32                                  COLOR(RED) DSPATR(BL)
     A  62                                  COLOR(PNK)
     A                                  4  1' 3)'
     A  33                                  COLOR(RED) DSPATR(BL)
     A  63                                  COLOR(PNK)
     A                                  5  1' 4)'
     A  34                                  COLOR(RED) DSPATR(BL)
     A  64                                  COLOR(PNK)
     A                                  6  1' 5)'
     A  35                                  COLOR(RED) DSPATR(BL)
     A  65                                  COLOR(PNK)
     A                                  7  1' 6)'
     A  36                                  COLOR(RED) DSPATR(BL)
     A  66                                  COLOR(PNK)
     A                                  8  1' 7)'
     A  37                                  COLOR(RED) DSPATR(BL)
     A  67                                  COLOR(PNK)
     A                                  9  1' 8)'
     A  38                                  COLOR(RED) DSPATR(BL)
     A  68                                  COLOR(PNK)
     A                                 10  1' 9)'
     A  39                                  COLOR(RED) DSPATR(BL)
     A  69                                  COLOR(PNK)
     A                                 11  1'10)'
     A  40                                  COLOR(RED) DSPATR(BL)
     A  70                                  COLOR(PNK)
     A                                 12  1'11)'
     A  41                                  COLOR(RED) DSPATR(BL)
     A  71                                  COLOR(PNK)
     A                                 13  1'12)'
     A  42                                  COLOR(RED) DSPATR(BL)
     A  72                                  COLOR(PNK)
     A                                 14  1'Selection or command:'
     A                                 14 53TIME COLOR(GRN) DSPATR(RI)
     A                                 15  1' ===>'
     A            CMDLINE       51   B 15  7
     A            MSGLINE       56   O 16  2DSPATR(HI)
      *
     A            JOB1          20   B  2  5CHGINPDFT
     A  30                                  COLOR(WHT)
     A N30                                  DSPATR(UL) COLOR(TRQ)
     A  30 80
     AO 30N80                               DSPATR(PR)
     A N30        JOB1CMD       30   B  2 26COLOR(TRQ)
     A N30        RTRN01         1   B  2 57COLOR(TRQ)
     A  30                              2 28'F13='
     A                                      COLOR(BLU)
     A  30        CMD13         25   B  2 33
     A     80                               DSPATR(PR) COLOR(YLW)
     A    N80                               COLOR(TRQ)
      *
     A            JOB2          20   B  3  5CHGINPDFT
     A  30                                  COLOR(WHT)
     A N30                                  DSPATR(UL) COLOR(TRQ)
     A  30 80
     AO 30N80                               DSPATR(PR)
     A N30        JOB2CMD       30   B  3 26COLOR(TRQ)
     A N30        RTRN02         1   B  3 57COLOR(TRQ)
     A  30                              3 28'F14='
     A                                      COLOR(BLU)
     A  30        CMD14         25   B  3 33
     A     80                               DSPATR(PR) COLOR(YLW)
     A    N80                               COLOR(TRQ)
      *
     A            JOB3          20   B  4  5CHGINPDFT
     A  30                                  COLOR(WHT)
     A N30                                  DSPATR(UL) COLOR(TRQ)
     A  30 80
     AO 30N80                               DSPATR(PR)
     A N30        JOB3CMD       30   B  4 26COLOR(TRQ)
     A N30        RTRN03         1   B  4 57COLOR(TRQ)
     A  30                              4 28'F15='
     A                                      COLOR(BLU)
     A  30        CMD15         25   B  4 33
     A     80                               DSPATR(PR) COLOR(YLW)
     A    N80                               COLOR(TRQ)
      *
     A            JOB4          20   B  5  5CHGINPDFT
     A  30                                  COLOR(WHT)
     A N30                                  DSPATR(UL) COLOR(TRQ)
     A  30 80
     AO 30N80                               DSPATR(PR)
     A N30        JOB4CMD       30   B  5 26COLOR(TRQ)
     A N30        RTRN04         1   B  5 57COLOR(TRQ)
     A  30                              5 28'F16='
     A                                      COLOR(BLU)
     A  30        CMD16         25   B  5 33
     A     80                               DSPATR(PR) COLOR(YLW)
     A    N80                               COLOR(TRQ)
      *
     A            JOB5          20   B  6  5CHGINPDFT
     A  30                                  COLOR(WHT)
     A N30                                  DSPATR(UL) COLOR(TRQ)
     A  30 80
     AO 30N80                               DSPATR(PR)
     A N30        JOB5CMD       30   B  6 26COLOR(TRQ)
     A N30        RTRN05         1   B  6 57COLOR(TRQ)
     A  30                              6 28'F17='
     A                                      COLOR(BLU)
     A  30        CMD17         25   B  6 33
     A     80                               DSPATR(PR) COLOR(YLW)
     A    N80                               COLOR(TRQ)
      *
     A            JOB6          20   B  7  5CHGINPDFT
     A  30                                  COLOR(WHT)
     A N30                                  DSPATR(UL) COLOR(TRQ)
     A  30 80
     AO 30N80                               DSPATR(PR)
     A N30        JOB6CMD       30   B  7 26COLOR(TRQ)
     A N30        RTRN06         1   B  7 57COLOR(TRQ)
     A  30                              7 28'F18='
     A                                      COLOR(BLU)
     A  30        CMD18         25   B  7 33
     A     80                               DSPATR(PR) COLOR(YLW)
     A    N80                               COLOR(TRQ)
      *
     A            JOB7          20   B  8  5CHGINPDFT
     A  30                                  COLOR(WHT)
     A N30                                  DSPATR(UL) COLOR(TRQ)
     A  30 80
     AO 30N80                               DSPATR(PR)
     A N30        JOB7CMD       30   B  8 26COLOR(TRQ)
     A N30        RTRN07         1   B  8 57COLOR(TRQ)
     A  30                              8 28'F19='
     A                                      COLOR(BLU)
     A  30        CMD19         25   B  8 33
     A     80                               DSPATR(PR) COLOR(YLW)
     A    N80                               COLOR(TRQ)
      *
     A            JOB8          20   B  9  5CHGINPDFT
     A  30                                  COLOR(WHT)
     A N30                                  DSPATR(UL) COLOR(TRQ)
     A  30 80
     AO 30N80                               DSPATR(PR)
     A N30        JOB8CMD       30   B  9 26COLOR(TRQ)
     A N30        RTRN08         1   B  9 57COLOR(TRQ)
     A  30                              9 28'F20='
     A                                      COLOR(BLU)
     A  30        CMD20         25   B  9 33
     A     80                               DSPATR(PR) COLOR(YLW)
     A    N80                               COLOR(TRQ)
      *
     A            JOB9          20   B 10  5CHGINPDFT
     A  30                                  COLOR(WHT)
     A N30                                  DSPATR(UL) COLOR(TRQ)
     A  30 80
     AO 30N80                               DSPATR(PR)
     A N30        JOB9CMD       30   B 10 26COLOR(TRQ)
     A N30        RTRN09         1   B 10 57COLOR(TRQ)
     A  30                             10 28'F21='
     A                                      COLOR(BLU)
     A  30        CMD21         25   B 10 33
     A     80                               DSPATR(PR) COLOR(YLW)
     A    N80                               COLOR(TRQ)
      *
     A            JOB10         20   B 11  5CHGINPDFT
     A  30                                  COLOR(WHT)
     A N30                                  DSPATR(UL) COLOR(TRQ)
     A  30 80
     AO 30N80                               DSPATR(PR)
     A N30        JOB10CMD      30   B 11 26COLOR(TRQ)
     A N30        RTRN10         1   B 11 57COLOR(TRQ)
     A  30                             11 28'F22='
     A                                      COLOR(BLU)
     A  30        CMD22         25   B 11 33
     A     80                               DSPATR(PR) COLOR(YLW)
     A    N80                               COLOR(TRQ)
      *
     A            JOB11         20   B 12  5CHGINPDFT
     A  30                                  COLOR(WHT)
     A N30                                  DSPATR(UL) COLOR(TRQ)
     A  30 80
     AO 30N80                               DSPATR(PR)
     A N30        JOB11CMD      30   B 12 26COLOR(TRQ)
     A N30        RTRN11         1   B 12 57COLOR(TRQ)
     A  30                             12 28'F23='
     A                                      COLOR(BLU)
     A  30        CMD23         25   B 12 33
     A     80                               DSPATR(PR) COLOR(YLW)
     A    N80                               COLOR(TRQ)
      *
     A            JOB12         20   B 13  5CHGINPDFT
     A  30                                  COLOR(WHT)
     A N30                                  DSPATR(UL) COLOR(TRQ)
     A  30 80
     AO 30N80                               DSPATR(PR)
     A N30        JOB12CMD      30   B 13 26COLOR(TRQ)
     A N30        RTRN12         1   B 13 57COLOR(TRQ)
     A                                 13 28'F24='
     A                                      COLOR(BLU)
     A            CMD24         25   B 13 33
     A     80                               DSPATR(PR) COLOR(YLW)
     A    N80                               COLOR(TRQ)
     A*
     A
     A          R DUMMY
     A*                                     KEEP
     A                                      ASSUME
     A                                  1  3' '
=======================================

/**     GRPJOBMNU -- Group Job Utility      **/
/**     Author: Vengoal Chang               **/
/**     2002/04/08                          **/
/**     GRPJOBTFRC : TFRGRPJOB initial PGM  **/

GRPTFRTFRC: +
     PGM
     DCL VAR(&JOB) TYPE(*CHAR) LEN(1)
     DCL VAR(&USER) TYPE(*CHAR) LEN(10)
     DCL VAR(&PGM) TYPE(*CHAR) LEN(10)
     DCL VAR(&PGMLIB) TYPE(*CHAR) LEN(10)
     DCL VAR(&GRPJOB) TYPE(*CHAR) LEN(10)
     DCL VAR(&GRPJOBCMD) TYPE(*CHAR) LEN(30)
     DCL VAR(&CMDLEN) TYPE(*CHAR) LEN(2) VALUE('30')
     DCL VAR(&MSGTXT) TYPE(*CHAR) LEN(100)
     DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(100)
     DCL VAR(&MSGKEY) TYPE(*CHAR) LEN(4)
     DCL VAR(&MSGID) TYPE(*CHAR) LEN(7)
     DCL VAR(&MSGID) TYPE(*CHAR) LEN(7)
     DCL VAR(&MSGF) TYPE(*CHAR) LEN(10)
     DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10)
INIT:
     SETATNPGM  PGM(GRPJOBMNUC)
     RTVJOBA USER(&USER)
     RTVGRPA GRPJOB(&GRPJOB)
     CHKOBJ OBJ(QUSRTEMP/&USER) OBJTYPE(*DTAARA)
     MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(CALLPGM))
CHKJOBID:
     IF COND(&GRPJOB *EQ 'JOB1') THEN(RTVDTAARA DTAARA(QUSRTEMP/&USER-
 (321 30)) RTNVAR(&GRPJOBCMD))
     IF COND(&GRPJOB *EQ 'JOB2') THEN(RTVDTAARA DTAARA(QUSRTEMP/&USER-
 (371 30)) RTNVAR(&GRPJOBCMD))
     IF COND(&GRPJOB *EQ 'JOB3') THEN(RTVDTAARA DTAARA(QUSRTEMP/&USER-
 (421 30)) RTNVAR(&GRPJOBCMD))
     IF COND(&GRPJOB *EQ 'JOB4') THEN(RTVDTAARA DTAARA(QUSRTEMP/&USER-
 (471 30)) RTNVAR(&GRPJOBCMD))
     IF COND(&GRPJOB *EQ 'JOB5') THEN(RTVDTAARA DTAARA(QUSRTEMP/&USER-
 (521 30)) RTNVAR(&GRPJOBCMD))
     IF COND(&GRPJOB *EQ 'JOB6') THEN(RTVDTAARA DTAARA(QUSRTEMP/&USER-
 (571 30)) RTNVAR(&GRPJOBCMD))
     IF COND(&GRPJOB *EQ 'JOB7') THEN(RTVDTAARA DTAARA(QUSRTEMP/&USER-
 (621 30)) RTNVAR(&GRPJOBCMD))
     IF COND(&GRPJOB *EQ 'JOB8') THEN(RTVDTAARA DTAARA(QUSRTEMP/&USER-
 (671 30)) RTNVAR(&GRPJOBCMD))
     IF COND(&GRPJOB *EQ 'JOB9') THEN(RTVDTAARA DTAARA(QUSRTEMP/&USER-
 (721 30)) RTNVAR(&GRPJOBCMD))
     IF COND(&GRPJOB *EQ 'JOB10') THEN(RTVDTAARA DTAARA(QUSRTEMP/&USE-
R (771 30)) RTNVAR(&GRPJOBCMD))
     IF COND(&GRPJOB *EQ 'JOB11') THEN(RTVDTAARA DTAARA(QUSRTEMP/&USE-
R (821 30)) RTNVAR(&GRPJOBCMD))
     IF COND(&GRPJOB *EQ 'JOB12') THEN(RTVDTAARA DTAARA(QUSRTEMP/&USE-
R (871 30)) RTNVAR(&GRPJOBCMD))

CALLPGM:
     IF COND(&GRPJOBCMD *EQ '*NONE') THEN(DO)
     ENDGRPJOB
     GOTO CMDLBL(EOJ)
     ENDDO
     IF COND(&GRPJOBCMD *EQ ' ') THEN(CALL PGM(QSYS/QCMD))
     ELSE CMD(DO)
     CALL PGM(QCMDCHK) PARM(&GRPJOBCMD 30)
     MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(STDERR))
     CALL PGM(QCMDEXC) PARM(&GRPJOBCMD 30)
     MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(STDERR))
     ENDDO
     GOTO EOJ

STDERR: +
     RCVMSG MSGTYPE(*LAST) MSGDTA(&MSGDTA) MSGID(&MSGID) MSGF(&MSGF) -
SNDMSGFLIB(&MSGFLIB)
     IF COND(&MSGID *EQ '       ') THEN(GOTO CMDLBL(EOJ))
     SNDUSRMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) MSGDTA(&MSGDTA) -
MSGTYPE(*INFO)
     GOTO CMDLBL(STDERR)
     GOTO CMDLBL(EOJ)
EOJ: +
     RETURN
     ENDPGM
=======================================

/**     GRPJOBMNU -- Group Job Utility   **/
/**     Author: Vengoal Chang            **/
/**     2002/04/08                       **/
/**     GRPJOBMNUC : Attention Program   **/
GRPJOBMNUC: +
     PGM
     DCL VAR(&JOB)       TYPE(*CHAR) LEN(1)
     DCL VAR(&USER)      TYPE(*CHAR) LEN(10)
     DCL VAR(&PGM)       TYPE(*CHAR) LEN(10)
     DCL VAR(&PGMLIB)    TYPE(*CHAR) LEN(10)
     DCL VAR(&GRPJOB)    TYPE(*CHAR) LEN(10)
     DCL VAR(&GRPJOBN)   TYPE(*CHAR) LEN(10)
     DCL VAR(&GRPJOBL)   TYPE(*CHAR) LEN(1056)
     DCL VAR(&JOBLST)    TYPE(*DEC) LEN(4 0)
     DCL VAR(&GRPJOBCNT) TYPE(*DEC) LEN(3 0)
     DCL VAR(&GRPJOBCMD) TYPE(*CHAR) LEN(30)
     DCL VAR(&CMDLEN)    TYPE(*CHAR) LEN(2) VALUE('30')
     DCL VAR(&MSGTXT)    TYPE(*CHAR) LEN(100)
     DCL VAR(&MSGDTA)    TYPE(*CHAR) LEN(100)
     DCL VAR(&MSGKEY)    TYPE(*CHAR) LEN(4)
     DCL VAR(&MSGID)     TYPE(*CHAR) LEN(7)
     DCL VAR(&MSGF)      TYPE(*CHAR) LEN(10)
     DCL VAR(&MSGFLIB)   TYPE(*CHAR) LEN(10)
     DCL VAR(&MSGQ)      TYPE(*CHAR) LEN(10)
     DCL VAR(&USRTXT)    TYPE(*CHAR) LEN(50)
     DCL VAR(&CMDKEY)    TYPE(*CHAR) LEN(25)
     DCL VAR(&COLOR)     TYPE(*CHAR) LEN(1)
     DCL VAR(&COLORD)    TYPE(*DEC) LEN(1 0)
     DCL VAR(&EXTMNU)    TYPE(*CHAR) LEN(1) VALUE('Y')
     dcl  &CmdString     *char 2000     /* Command string */
     dcl  &CmdMsgKey     *char 4        /* Command message key */

        /* API parameters */
     dcl  &APIdata       *char 2000     /* Retrieved API data */
     dcl  &APIMsgType    *char 10       /* Request message type */
     dcl  &APIoptions    *char 20       /* Format CPOP0100 options */
     dcl  &APIlength     *char 4        /* Data length returned */

        /* Other variables */

     dcl  &MsgKey        *char 4        /* Message key */
     dcl  &Length        *dec (9 0)     /* Data length */

     DCLF GRPJOBMNUD
INIT:

             RTVJOBA    USER(&USER)
             RTVUSRPRF  RTNUSRPRF(&USER) MSGQ(&MSGQ) TEXT(&USRTXT)

             CHKOBJ     OBJ(QUSRTEMP/&USER) OBJTYPE(*DTAARA)
             MONMSG     MSGID(CPF9801) EXEC(DO)
             CRTDUPOBJ  OBJ(GRPJOBDFT) FROMLIB(QUSRTEMP) +
                          OBJTYPE(*DTAARA) NEWOBJ(&USER)
             ENDDO

             RTVDTAARA  DTAARA(QUSRTEMP/&USER (301 20)) +
                          RTNVAR(&JOB1)

             RTVGRPA    GRPJOB(&GRPJOB)
             IF (&GRPJOB = '*NONE') DO
                CHGGRPA    GRPJOB(JOB1) MSGQ(&MSGQ) TEXT(&JOB1)
                MONMSG     MSGID(CPF1305)
                RTVGRPA    GRPJOB(&GRPJOB)
                CHGDTAARA  DTAARA(*GDA (121 12)) VALUE('100000000000')
             ENDDO

             RTVDTAARA  DTAARA(QUSRTEMP/&USER (321 30)) +
                          RTNVAR(&JOB1CMD)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (902 1)) +
                          RTNVAR(&RTRN01)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (351 20)) +
                          RTNVAR(&JOB2)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (371 30)) +
                          RTNVAR(&JOB2CMD)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (903 1)) +
                          RTNVAR(&RTRN02)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (401 20)) +
                          RTNVAR(&JOB3)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (421 30)) +
                          RTNVAR(&JOB3CMD)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (904 1)) +
                          RTNVAR(&RTRN03)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (451 20)) +
                          RTNVAR(&JOB4)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (471 30)) +
                          RTNVAR(&JOB4CMD)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (905 1)) +
                          RTNVAR(&RTRN04)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (501 20)) +
                          RTNVAR(&JOB5)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (521 30)) +
                          RTNVAR(&JOB5CMD)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (906 1)) +
                          RTNVAR(&RTRN05)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (551 20)) +
                          RTNVAR(&JOB6)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (571 30)) +
                          RTNVAR(&JOB6CMD)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (907 1)) +
                          RTNVAR(&RTRN06)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (601 20)) +
                          RTNVAR(&JOB7)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (521 30)) +
                          RTNVAR(&JOB7CMD)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (908 1)) +
                          RTNVAR(&RTRN07)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (651 20)) +
                          RTNVAR(&JOB8)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (671 30)) +
                          RTNVAR(&JOB8CMD)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (909 1)) +
                          RTNVAR(&RTRN08)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (701 20)) +
                          RTNVAR(&JOB9)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (721 30)) +
                          RTNVAR(&JOB9CMD)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (910 1)) +
                          RTNVAR(&RTRN09)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (751 20)) +
                          RTNVAR(&JOB10)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (771 30)) +
                          RTNVAR(&JOB10CMD)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (911 1)) +
                          RTNVAR(&RTRN10)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (801 20)) +
                          RTNVAR(&JOB11)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (821 30)) +
                          RTNVAR(&JOB11CMD)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (912 1)) +
                          RTNVAR(&RTRN11)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (851 20)) +
                          RTNVAR(&JOB12)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (871 30)) +
                          RTNVAR(&JOB12CMD)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (913 1)) +
                          RTNVAR(&RTRN12)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (1  25)) RTNVAR(&CMD13)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (26 25)) RTNVAR(&CMD14)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (51 25)) RTNVAR(&CMD15)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (76 25)) RTNVAR(&CMD16)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (101 25)) RTNVAR(&CMD17)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (126 25)) RTNVAR(&CMD18)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (151 25)) RTNVAR(&CMD19)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (176 25)) RTNVAR(&CMD20)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (201 25)) RTNVAR(&CMD21)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (226 25)) RTNVAR(&CMD22)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (251 25)) RTNVAR(&CMD23)
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (276 25)) RTNVAR(&CMD24)

     /* SET CURRENT GRPJOB DSPATR */
     IF (&GRPJOB = 'JOB1') CHGVAR &IN31 '1'
     IF (&GRPJOB = 'JOB2') CHGVAR &IN32 '1'
     IF (&GRPJOB = 'JOB3') CHGVAR &IN33 '1'
     IF (&GRPJOB = 'JOB4') CHGVAR &IN34 '1'
     IF (&GRPJOB = 'JOB5') CHGVAR &IN35 '1'
     IF (&GRPJOB = 'JOB6') CHGVAR &IN36 '1'
     IF (&GRPJOB = 'JOB7') CHGVAR &IN37 '1'
     IF (&GRPJOB = 'JOB8') CHGVAR &IN38 '1'
     IF (&GRPJOB = 'JOB9') CHGVAR &IN39 '1'
     IF (&GRPJOB = 'JOB10') CHGVAR &IN40 '1'
     IF (&GRPJOB = 'JOB11') CHGVAR &IN41 '1'
     IF (&GRPJOB = 'JOB12') CHGVAR &IN42 '1'


      /* 30 80                    */
      /*  1  0  MODIFY COMMAND KEY*/
      /*  1  1  OPTION INPUT      */
      /*  0  1  MODIFY JOB AND JOB COMMAND */
      /*  0  0  MODIFY JOB AND JOB COMMAND */
             CHGVAR     &IN30 '1'
             CHGVAR     &IN80 '1'
/*           CHGVAR     VAR(&TTL1) VALUE('Transfer to Group +
                          Job/Command Key Window')            */
/* DEFAULT KEYS */
             CHGVAR     &IN91 '1'             /* ALT KEYS */
START:
/* DEFAULT BORDER COLOR */
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (901 1)) RTNVAR(&COLOR)
             CHGVAR &IN81 '0'
             CHGVAR &IN82 '0'
             CHGVAR &IN83 '0'
             CHGVAR &IN84 '0'
             CHGVAR &IN85 '0'
             CHGVAR &IN86 '0'
             CHGVAR &IN87 '0'
             IF (&COLOR = '1') CHGVAR &IN81 '1'
             IF (&COLOR = '2') CHGVAR &IN82 '1'
             IF (&COLOR = '3') CHGVAR &IN83 '1'
             IF (&COLOR = '4') CHGVAR &IN84 '1'
             IF (&COLOR = '5') CHGVAR &IN85 '1'
             IF (&COLOR = '6') CHGVAR &IN86 '1'
             IF (&COLOR = '7') CHGVAR &IN87 '1'

/* RETRIEVE ACTIVE GRPJOB COLOR */
             RTVDTAARA  DTAARA(*GDA (121 1)) RTNVAR(&IN61)
             MONMSG     CPF0000 EXEC(CHGVAR &IN61 '0')
             RTVDTAARA  DTAARA(*GDA (122 1)) RTNVAR(&IN62)
             MONMSG     CPF0000 EXEC(CHGVAR &IN62 '0')
             RTVDTAARA  DTAARA(*GDA (123 1)) RTNVAR(&IN63)
             MONMSG     CPF0000 EXEC(CHGVAR &IN63 '0')
             RTVDTAARA  DTAARA(*GDA (124 1)) RTNVAR(&IN64)
             MONMSG     CPF0000 EXEC(CHGVAR &IN64 '0')
             RTVDTAARA  DTAARA(*GDA (125 1)) RTNVAR(&IN65)
             MONMSG     CPF0000 EXEC(CHGVAR &IN65 '0')
             RTVDTAARA  DTAARA(*GDA (126 1)) RTNVAR(&IN66)
             MONMSG     CPF0000 EXEC(CHGVAR &IN66 '0')
             RTVDTAARA  DTAARA(*GDA (127 1)) RTNVAR(&IN67)
             MONMSG     CPF0000 EXEC(CHGVAR &IN67 '0')
             RTVDTAARA  DTAARA(*GDA (128 1)) RTNVAR(&IN68)
             MONMSG     CPF0000 EXEC(CHGVAR &IN68 '0')
             RTVDTAARA  DTAARA(*GDA (129 1)) RTNVAR(&IN69)
             MONMSG     CPF0000 EXEC(CHGVAR &IN69 '0')
             RTVDTAARA  DTAARA(*GDA (130 1)) RTNVAR(&IN70)
             MONMSG     CPF0000 EXEC(CHGVAR &IN70 '0')
             RTVDTAARA  DTAARA(*GDA (131 1)) RTNVAR(&IN71)
             MONMSG     CPF0000 EXEC(CHGVAR &IN71 '0')
             RTVDTAARA  DTAARA(*GDA (132 1)) RTNVAR(&IN72)
             MONMSG     CPF0000 EXEC(CHGVAR &IN72 '0')

             SNDRCVF    RCDFMT(OPTIONS)
             CHGVAR     &MSGLINE ' '

             IF ((&IN01 = '1') *OR (&IN03 = '1') *OR +
                 (&IN12 = '1') ) GOTO END

             IF (&IN02 = '1') DO
                IF (&IN91 = '1') +
                   CHGVAR &IN91 '0'
                ELSE  +
                   CHGVAR &IN91 '1'
             GOTO START
             ENDDO

Retrieve:
             IF ((&IN08 = '1') *OR (&IN09 = '1')) DO

             IF (&IN08 = '1' *AND &CmdMsgKey = ' ') +
                       chgvar    &APIMsgType    *FIRST
             Else IF (&IN08 = '1') +
                       chgvar    &APIMsgType    *NEXT
             Else IF (&IN09 = '1' *AND &CmdMsgKey = ' ') +
                       chgvar    &APIMsgType    *LAST
             Else IF (&IN09 = '1') +
                       chgvar    &APIMsgType    *PRV

             CHGVAR &APIDATA ' '

             call QMHRTVRQ  (+
                       &APIdata       /* Returned data */ +
                       X'000007D0'    /* Data length:  2000 */ +
                       'RTVQ0100'     /* Data format */ +
                       &APIMsgType    /* Type *LAST|*PRV */ +
                       &CmdMsgKey     /* Message key */ +
                       X'00000000'    /* No error data returned */ +
                       )

             /* Exit if no data is returned */

             CHGVAR     &APILENGTH  %SST(&APIDATA 5 4)

             CHGVAR     &LENGTH     %BIN(&APILENGTH)
             /* If no data exist, reset to beginning */
             IF         (&LENGTH *LE 0) DO
               CHGVAR &CMDMSGKEY '    '
               GOTO START
             ENDDO

             /* Retrieve command string from API data and exit */

             CHGVAR     &CMDSTRING  %SST(&APIDATA 41 &LENGTH)
             CHGVAR     &CMDMSGKEY  %SST(&APIDATA 9 4)
             CHGVAR     &CMDLINE    %SST(&CMDSTRING 1 &LENGTH)
             GOTO START
             ENDDO
COLOR:
             IF (&IN11 = '1') DO
             RTVDTAARA  DTAARA(QUSRTEMP/&USER (901 1)) RTNVAR(&COLOR)
             CHGVAR &COLORD &COLOR
               IF (&COLORD <= 6) DO
                  CHGVAR &COLORD (&COLORD + 1)
                  CHGVAR &COLOR &COLORD
               ENDDO
               ELSE DO
                  CHGVAR &COLOR '1'
               ENDDO
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (901 1)) VALUE(&COLOR)
             GOTO START
             ENDDO

/* FUNCTION KEY */
             IF ((&IN13 = '1')  *OR (&IN14 = '1') *OR +
                 (&IN15 = '1')  *OR (&IN16 = '1') *OR +
                 (&IN17 = '1')  *OR (&IN18 = '1') *OR +
                 (&IN19 = '1')  *OR (&IN20 = '1') *OR +
                 (&IN21 = '1')  *OR (&IN22 = '1') *OR +
                 (&IN23 = '1')  *OR (&IN24 = '1')) DO

             IF (&IN13 = '1') CHGVAR &CMDKEY &CMD13
             IF (&IN14 = '1') CHGVAR &CMDKEY &CMD14
             IF (&IN15 = '1') CHGVAR &CMDKEY &CMD15
             IF (&IN16 = '1') CHGVAR &CMDKEY &CMD16
             IF (&IN17 = '1') CHGVAR &CMDKEY &CMD17
             IF (&IN18 = '1') CHGVAR &CMDKEY &CMD18
             IF (&IN19 = '1') CHGVAR &CMDKEY &CMD19
             IF (&IN20 = '1') CHGVAR &CMDKEY &CMD20
             IF (&IN21 = '1') CHGVAR &CMDKEY &CMD21
             IF (&IN22 = '1') CHGVAR &CMDKEY &CMD22
             IF (&IN23 = '1') CHGVAR &CMDKEY &CMD23
             IF (&IN24 = '1') CHGVAR &CMDKEY &CMD24

             IF         COND(&CMDKEY *EQ ' ') THEN(CHGVAR +
                          VAR(&CMDKEY) VALUE('CALL PGM(QSYS/QCMD)'))

             CHGVAR     &CMDSTRING  &CMDKEY

             GOTO EXCCMD
             ENDDO   /* ENDIF CMDKEY */

             IF (&IN07 = '1') DO
                CHGVAR &IN30 '1'
                IF (&IN80='1') DO
                    CHGVAR &IN80 '0'
                 ENDDO
                ELSE  DO
                    GOTO UPDKEY
                 ENDDO
             GOTO START
             ENDDO

             IF (&IN06 = '1') DO
                CHGVAR &IN80 '1'
                IF (&IN30='1') DO
                    CHGVAR &IN30 '0'
                 ENDDO
                ELSE  DO
                    GOTO UPDJOB
                 ENDDO
             GOTO START
             ENDDO
UPDKEY:
             IF ((&IN80 = '0') *AND (&IN30 = '1')) DO
             CHGVAR &IN80 '1'
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (1 25)) VALUE(&CMD13)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (26 25)) VALUE(&CMD14)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (51 25)) VALUE(&CMD15)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (76 25)) VALUE(&CMD16)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (101 25)) VALUE(&CMD17)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (126 25)) VALUE(&CMD18)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (151 25)) VALUE(&CMD19)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (176 25)) VALUE(&CMD20)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (201 25)) VALUE(&CMD21)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (226 25)) VALUE(&CMD22)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (251 25)) VALUE(&CMD23)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (276 25)) VALUE(&CMD24)
             GOTO START
             ENDDO

UPDJOB:
             IF ((&IN80 = '1') *AND (&IN30 = '0')) DO
             CHGVAR &IN30 '1'
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (301 20)) +
                          VALUE(&JOB1)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (321 30)) +
                          VALUE(&JOB1CMD)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (902 1)) +
                          VALUE(&RTRN01)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (351 20)) +
                          VALUE(&JOB2)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (371 30)) +
                          VALUE(&JOB2CMD)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (903 1)) +
                          VALUE(&RTRN02)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (401 20)) +
                          VALUE(&JOB3)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (421 30)) +
                          VALUE(&JOB3CMD)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (904 1)) +
                          VALUE(&RTRN03)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (451 20)) +
                          VALUE(&JOB4)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (471 30)) +
                          VALUE(&JOB4CMD)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (905 1)) +
                          VALUE(&RTRN04)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (501 20)) +
                          VALUE(&JOB5)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (521 30)) +
                          VALUE(&JOB5CMD)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (906 1)) +
                          VALUE(&RTRN05)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (551 20)) +
                          VALUE(&JOB6)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (571 30)) +
                          VALUE(&JOB6CMD)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (907 1)) +
                          VALUE(&RTRN06)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (601 20)) +
                          VALUE(&JOB7)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (521 30)) +
                          VALUE(&JOB7CMD)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (908 1)) +
                          VALUE(&RTRN07)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (651 20)) +
                          VALUE(&JOB8)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (671 30)) +
                          VALUE(&JOB8CMD)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (909 1)) +
                          VALUE(&RTRN08)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (701 20)) +
                          VALUE(&JOB9)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (721 30)) +
                          VALUE(&JOB9CMD)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (910 1)) +
                          VALUE(&RTRN09)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (751 20)) +
                          VALUE(&JOB10)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (771 30)) +
                          VALUE(&JOB10CMD)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (911 1)) +
                          VALUE(&RTRN10)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (801 20)) +
                          VALUE(&JOB11)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (821 30)) +
                          VALUE(&JOB11CMD)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (912 1)) +
                          VALUE(&RTRN11)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (851 20)) +
                          VALUE(&JOB12)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (871 30)) +
                          VALUE(&JOB12CMD)
             CHGDTAARA  DTAARA(QUSRTEMP/&USER (913 1)) +
                          VALUE(&RTRN12)
             GOTO START
             ENDDO

             IF (&CMDLINE *NE *BLANKS) DO
             IF         (&CMDLINE = '1') DO
               IF (&GRPJOB *NE 'JOB1') DO
                  CHGDTAARA DTAARA(*GDA (121 1)) VALUE('1')
                  TFRGRPJOB  GRPJOB(JOB1) INLGRPPGM(GRPJOBTFRC)
               ENDDO
               GOTO REPEAT
             ENDDO
        ELSE IF         (&CMDLINE = '2') DO
               IF (&GRPJOB *NE 'JOB2') DO
                  CHGDTAARA DTAARA(*GDA (122 1)) VALUE('1')
                  TFRGRPJOB  GRPJOB(JOB2) INLGRPPGM(GRPJOBTFRC)
               ENDDO
               GOTO REPEAT
             ENDDO
        ELSE IF         (&CMDLINE = '3') DO
               IF (&GRPJOB *NE 'JOB3') DO
                  CHGDTAARA DTAARA(*GDA (123 1)) VALUE('1')
                  TFRGRPJOB  GRPJOB(JOB3) INLGRPPGM(GRPJOBTFRC)
               ENDDO
               GOTO REPEAT
             ENDDO
        ELSE IF         (&CMDLINE = '4') DO
               IF (&GRPJOB *NE 'JOB4') DO
                  CHGDTAARA DTAARA(*GDA (124 1)) VALUE('1')
                  TFRGRPJOB  GRPJOB(JOB4) INLGRPPGM(GRPJOBTFRC)
               ENDDO
               GOTO REPEAT
             ENDDO
        ELSE IF         (&CMDLINE = '5') DO
               IF (&GRPJOB *NE 'JOB5') DO
                  CHGDTAARA DTAARA(*GDA (125 1)) VALUE('1')
                  TFRGRPJOB  GRPJOB(JOB5) INLGRPPGM(GRPJOBTFRC)
               ENDDO
               GOTO REPEAT
             ENDDO
        ELSE IF         (&CMDLINE = '6') DO
               IF (&GRPJOB *NE 'JOB6') DO
                  CHGDTAARA DTAARA(*GDA (126 1)) VALUE('1')
                  TFRGRPJOB  GRPJOB(JOB6) INLGRPPGM(GRPJOBTFRC)
               ENDDO
               GOTO REPEAT
             ENDDO
        ELSE IF         (&CMDLINE = '7') DO
               IF (&GRPJOB *NE 'JOB7') DO
                  CHGDTAARA DTAARA(*GDA (127 1)) VALUE('1')
                  TFRGRPJOB  GRPJOB(JOB6) INLGRPPGM(GRPJOBTFRC)
               ENDDO
               GOTO REPEAT
             ENDDO
        ELSE IF         (&CMDLINE = '8') DO
               IF (&GRPJOB *NE 'JOB8') DO
                  CHGDTAARA DTAARA(*GDA (128 1)) VALUE('1')
                  TFRGRPJOB  GRPJOB(JOB8) INLGRPPGM(GRPJOBTFRC)
               ENDDO
               GOTO REPEAT
             ENDDO
        ELSE IF         (&CMDLINE = '9') DO
               IF (&GRPJOB *NE 'JOB9') DO
                  CHGDTAARA DTAARA(*GDA (129 1)) VALUE('1')
                  TFRGRPJOB  GRPJOB(JOB9) INLGRPPGM(GRPJOBTFRC)
               ENDDO
               GOTO REPEAT
             ENDDO
        ELSE IF         (&CMDLINE = '10') DO
               IF (&GRPJOB *NE 'JOB10') DO
                  CHGDTAARA DTAARA(*GDA (130 1)) VALUE('1')
                 TFRGRPJOB  GRPJOB(JOB10) INLGRPPGM(GRPJOBTFRC)
               ENDDO
               GOTO REPEAT
             ENDDO
             IF         (&CMDLINE = '11') DO
               IF (&GRPJOB *NE 'JOB11') DO
                  CHGDTAARA DTAARA(*GDA (131 1)) VALUE('1')
                 TFRGRPJOB  GRPJOB(JOB11) INLGRPPGM(GRPJOBTFRC)
               ENDDO
               GOTO REPEAT
             ENDDO
        ELSE IF         (&CMDLINE = '12') DO
               IF (&GRPJOB *NE 'JOB12') DO
                  CHGDTAARA DTAARA(*GDA (132 1)) VALUE('1')
                 TFRGRPJOB  GRPJOB(JOB12) INLGRPPGM(GRPJOBTFRC)
               ENDDO
               GOTO REPEAT
             ENDDO

             CHGVAR     &CMDSTRING   &CMDLINE

EXCCMD:
        /* Build the options values */

        chgvar    %bin(&APIoptions 1 4) +
                  value(2)       /* Command line type processing */

        chgvar    %sst(&APIoptions 5 1) +
                  value('0')     /* Ignore DBCS */

        chgvar    %sst(&APIoptions 7 1) +
                  value('0')     /* AS/400 command syntax */

        if        (&IN04 = '1' *OR %SST(&CmdString 1 1) = '?') +
                  chgvar %sst(&APIoptions 6 1) +
                  value('1')     /* Prompt command */

        else +
                  chgvar %sst(&APIoptions 6 1) +
                  value('0')     /* No prompt */

        chgvar    %bin(&APIoptions  8 4) 0  /* Reserved area: */
        chgvar    %bin(&APIoptions 12 4) 0  /* must be set to */
        chgvar    %bin(&APIoptions 16 4) 0  /* hexadecimal zeros */
        chgvar    %bin(&APIoptions 19 2) 0

        /* Execute the command string */

        call      QCAPCMD   ( +
                  &CmdString     /* Source command string */ +
                  X'000007D0'    /* String length:  2000 */ +
                  &APIoptions    /* Options control block */ +
                  X'00000014'    /* Options block length:  20 */ +
                  'CPOP0100'     /* Options block format */ +
                  &APIdata       /* Returned command string */ +
                  X'000007D0'    /* Returned string length:  2000 */ +
                  &APILength     /* Command string length returned */ +
                  X'00000000'    /* No error data returned */ +
                  )
             MONMSG     MSGID(CPF6801) EXEC(DO)
             RCVMSG     MSGTYPE(*EXCP) RMV(*NO) MSG(&MSGLINE) +
                          MSGDTA(&MSGDTA) MSGID(&MSGID) MSGF(&MSGF) +
                          SNDMSGFLIB(&MSGFLIB)
             GOTO CMDERR
             ENDDO
             MONMSG     MSGID(CPF0000) EXEC(DO)
             RCVMSG     MSGTYPE(*DIAG) MSG(&MSGLINE) +
                          MSGDTA(&MSGDTA) MSGID(&MSGID) MSGF(&MSGF) +
                          SNDMSGFLIB(&MSGFLIB)
             SNDPGMMSG  MSGID(&MSGID) MSGF(&MSGF) MSGDTA(&MSGDTA) +
                          TOPGMQ(*SAME)
             MONMSG CPF0000
             GOTO CMDERR
             ENDDO
/*           CALL       PGM(QCMDCHK) PARM(&CMDSTRING 2000)    */
/*           CALL       PGM(QCMDEXC) PARM(&CMDSTRING 2000)    */

             /* Add command string to job's request messages */
AddCmd:
             SNDPGMMSG  MSG(&CMDSTRING) TOPGMQ(*EXT) MSGTYPE(*RQS) +
                          KEYVAR(&MSGKEY)

             RCVMSG     PGMQ(*EXT) MSGTYPE(*RQS) MSGKEY(&MSGKEY) +
                          RMV(*NO) KEYVAR(&CMDMSGKEY)
             CHGVAR    &CMDSTRING ' '
             CHGVAR    &CMDMSGKEY '    '

CMDERR:
             CHGVAR     &CMDLINE ' '
             GOTO START
REPEAT:
             CHGVAR &CMDLINE ' '
             ENDDO
       /* RESET ACTIVE GROUP JOB DSPATR */
             CHGDTAARA DTAARA(*GDA (121 1)) VALUE('0')
             CHGDTAARA DTAARA(*GDA (122 1)) VALUE('0')
             CHGDTAARA DTAARA(*GDA (123 1)) VALUE('0')
             CHGDTAARA DTAARA(*GDA (124 1)) VALUE('0')
             CHGDTAARA DTAARA(*GDA (125 1)) VALUE('0')
             CHGDTAARA DTAARA(*GDA (126 1)) VALUE('0')
             CHGDTAARA DTAARA(*GDA (127 1)) VALUE('0')
             CHGDTAARA DTAARA(*GDA (128 1)) VALUE('0')
             CHGDTAARA DTAARA(*GDA (129 1)) VALUE('0')
             CHGDTAARA DTAARA(*GDA (130 1)) VALUE('0')
             CHGDTAARA DTAARA(*GDA (131 1)) VALUE('0')
             CHGDTAARA DTAARA(*GDA (132 1)) VALUE('0')

             CHGVAR VAR(&JOBLST) VALUE(1)
             RTVGRPA    GRPJOB(&GRPJOB) GRPJOBL(&GRPJOBL) +
                          GRPJOBCNT(&GRPJOBCNT)
GRPJOBS:
             IF (&GRPJOBCNT *GT 0) DO
             CHGVAR &GRPJOBN    %SST(&GRPJOBL &JOBLST 10)
             CHGVAR &JOBLST     (&JOBLST + 66)
             IF (&GRPJOBN = 'JOB1')  CHGDTAARA (*GDA (121 1)) '1'
             IF (&GRPJOBN = 'JOB2')  CHGDTAARA (*GDA (122 1)) '1'
             IF (&GRPJOBN = 'JOB3')  CHGDTAARA (*GDA (123 1)) '1'
             IF (&GRPJOBN = 'JOB4')  CHGDTAARA (*GDA (124 1)) '1'
             IF (&GRPJOBN = 'JOB5')  CHGDTAARA (*GDA (125 1)) '1'
             IF (&GRPJOBN = 'JOB6')  CHGDTAARA (*GDA (126 1)) '1'
             IF (&GRPJOBN = 'JOB7')  CHGDTAARA (*GDA (127 1)) '1'
             IF (&GRPJOBN = 'JOB8')  CHGDTAARA (*GDA (128 1)) '1'
             IF (&GRPJOBN = 'JOB9')  CHGDTAARA (*GDA (129 1)) '1'
             IF (&GRPJOBN = 'JOB10') CHGDTAARA (*GDA (130 1)) '1'
             IF (&GRPJOBN = 'JOB11') CHGDTAARA (*GDA (131 1)) '1'
             IF (&GRPJOBN = 'JOB12') CHGDTAARA (*GDA (132 1)) '1'

NEXTJOB:
             CHGVAR VAR(&GRPJOBCNT) VALUE(&GRPJOBCNT - 1)
             GOTO CMDLBL(GRPJOBS)
             ENDDO

             IF (&GRPJOB = 'JOB1') CHGVAR &EXTMNU &RTRN01
        ELSE IF (&GRPJOB = 'JOB2') CHGVAR &EXTMNU &RTRN02
        ELSE IF (&GRPJOB = 'JOB3') CHGVAR &EXTMNU &RTRN03
        ELSE IF (&GRPJOB = 'JOB4') CHGVAR &EXTMNU &RTRN04
        ELSE IF (&GRPJOB = 'JOB5') CHGVAR &EXTMNU &RTRN05
        ELSE IF (&GRPJOB = 'JOB6') CHGVAR &EXTMNU &RTRN06
        ELSE IF (&GRPJOB = 'JOB7') CHGVAR &EXTMNU &RTRN07
        ELSE IF (&GRPJOB = 'JOB8') CHGVAR &EXTMNU &RTRN08
        ELSE IF (&GRPJOB = 'JOB9') CHGVAR &EXTMNU &RTRN09
        ELSE IF (&GRPJOB = 'JOB10') CHGVAR &EXTMNU &RTRN10
             IF (&GRPJOB = 'JOB11') CHGVAR &EXTMNU &RTRN11
        ELSE IF (&GRPJOB = 'JOB12') CHGVAR &EXTMNU &RTRN12

             IF (&EXTMNU *NE 'Y')  GOTO START

END:
             RETURN

STDERR:     RCVMSG     MSGTYPE(*LAST) MSGDTA(&MSGDTA) MSGID(&MSGID) +
                          MSGF(&MSGF) SNDMSGFLIB(&MSGFLIB)
             IF         COND(&MSGID *EQ '       ') THEN(GOTO +
                          CMDLBL(EOJ))
             SNDUSRMSG  MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
                          MSGDTA(&MSGDTA) MSGTYPE(*INFO)
             GOTO       CMDLBL(STDERR)
             GOTO       CMDLBL(EOJ)

EOJ:        IF         COND(%SWITCH(XXXXXXX1)) THEN(DMPCLPGM)
             RETURN
             ENDPGM




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: