Ü   RTVJOBA

 

·         JOB: The job name of the job to be retrieved. * is the default for the current job.  A fully qualified job name must be used if the job is not the current job.                           

 

·         USER: The user of the job. 

 

·         NBR: The job number of the job.

 

·         CURUSER: The current user of the job.  

 

·         JOBSTS: The status of the job. The value will be *ACTIVE, *JOBQ, or *OUTQ. 

 

·         JOBTYP: The job type. A value will exist such as INT (Interactive).     

 

·         CPUTIM: The CPU time used in milliseconds. 

 

·         OUTQ: The output queue assigned to the job.  

 

·         JOBQ: The job queue the job started on (if any). 

 

·         SBMJOB: The name of the job that submitted the job being retrieved if any.

 

·         SBMUSER: The user of the job that submitted the job being retrieved if any. 

 

·         SBMJOBNBR: The job number of the job that submitted the job being retrieved if any.   

 

·         ENDSTS: The ending status of the job. A blank means the job is not running. 0=The job (or subsystem or system) is not cancelled.     1=The job (or subsystem or system) is cancelled.   If used, the return variable must be specified as *CHAR LEN(1).

 

 

Example-I

 

In the example below, if the Job Type is 0, it's running in batch, and if it's 1, it's interactive.

 


PGM
            DCL        VAR(&JOBTYPE) TYPE(*CHAR) LEN(1)
 
            RTVJOBA    TYPE(&JOBTYPE)
            IF         COND(&JOBTYPE *EQ '0') THEN(GOTO START)
            /*  Interactive Program Section  */
            SBMJOB     CMD(CALL PGM(ITSELFCL)) JOB(SBMITSELF)<
            SNDPGMMSG  MSG('Tell user program Itself Submitted')
            RETURN
START:
            /*  Mainline Batch Program  */



 

 

Example II

 

Assume in the following CL procedure, an interactive job submits a program including the CL procedure to batch. A Retrieve Job Attribute (RTVJOBA) command retrieves the name of the message queue to which the job's completion message is sent, and uses that message queue to communicate with the user who submitted the job.

 

 


    PGM
    DCL &MSGQ *CHAR 10
    DCL &MSGQLIB *CHAR 10
    DCL &MSGKEY *CHAR 4
    DCL &REPLY *CHAR 1
    DCL &ACCTNO *CHAR 6
    .
    .
    .
    RTVJOBA SBMMSGQ(&MSGQ) SBMMSGQLIB(&MSGQLIB)
    IF (&MSGQ *EQ '*NONE') THEN(DO)
       CHGVAR &MSGQ 'QSYSOPR'
       CHGVAR &MSGQLIB 'QSYS'
    ENDDO
    .
    .
    .
    IF (. . . ) THEN(DO)
     SNDMSG:SNDPGMMSG MSG('Account number ' *CAT &ACCTNO *CAT 'is +
                      not valid. Do you want to cancel the update +
                      (Y or N)?') TOMSGQ(&MSGQLIB/&MSGQ) MSGTYPE(*INQ) +
                      KEYVAR(&MSGKEY)
     RCVMSG MSGQ(*PGMQ) MSGTYPE(*RPY) MSGKEY(&MSGKEY) +
              MSG(&REPLY) WAIT(*MAX)
     IF (&REPLY *EQ 'Y') THEN(RETURN)
     ELSE IF (&REPLY *NE 'N') THEN(GOTO SNDMSG)
    ENDDO
    .
    .

 

 




 

 







User Comments:



Copyright © www.go4as400.com, 2013-2023. Copyright notice   Terms of services   Privacy policy