| 
 | 
I want to create a command to check a job status.  The RPG program uses API's to
determine if a particular job is active, or on the job queue.  If the job is
active, this program returns *ACTIVE in the return code field (called RTNCOD).
If the target program is on a job queue,   *JOBQ is returned to the calling
program.  If the target job is not active and is not on a job queue, *INACTIVE
is returned in RTNCOD.
My command is:
CMD        PROMPT('Check Job Status Command')
PARM       KWD(JOBNAME) TYPE(*CHAR) LEN(10) MIN(1) PROMPT('Job name' 1)
PARM       KWD(RTNCOD) TYPE(*CHAR) LEN(10) RTNVAL(*YES) MIN(1) PROMPT('Return
code' 2)
This is OK, when I use this CL as the CPP:
START:      PGM        PARM(&JOBNAME &RTNCOD)
            DCL        VAR(&JOBNAME) TYPE(*CHAR) LEN(10)
            DCL        VAR(&RTNCOD) TYPE(*CHAR) LEN(10)
            /* This is the RPG program*/
            CALL       PGM(CHKJOBSTS) PARM(&JOBNAME &RTNCOD)
            IF         COND(&RTNCOD *EQ '*INACTIVE') THEN(DO)
            SNDMSG     MSG('*INACTIVE') TOUSR(PETERVI)
            ENDDO
            ELSE       CMD(DO)
            SNDMSG     MSG('*ACTIVE') TOUSR(PETERVI)
            ENDDO
END:        ENDPGM
This is not OK, when I use the RPG program directly as the CPP:
START:      PGM
            DCL        VAR(&RTNCOD) TYPE(*CHAR) LEN(10)
            CHKJOBSTS  JOBNAME('DC902ML') RTNCOD(&RTNCOD)
            IF         COND(&RTNCOD *EQ '*INACTIVE') THEN(DO)
            SNDMSG     MSG('*INACTIVE') TOUSR(PETERVI)
            ENDDO
            ELSE       CMD(DO)
            SNDMSG     MSG('*ACTIVE') TOUSR(PETERVI)
            ENDDO
END:        ENDPGM
Peter Vidal
PALL Aeropower Corp.
Senior Programmer Analyst
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.