Retrieve job status

Retrieve Job Status, calling API QWCRJBST.

Retrieve Job Status, calling API QWCRJBST.

Command source:

 
/*----------------------------------------------------------------MRB*/
/* Retrieve Job Status (calling API QWCRJBST)                        */
/* Marti Riera 10/07/2002                                            */
/* http://www.recursos-as400.com/                                    */
/* mailto:mrierab@teleline.es                                        */
/*-------------------------------------------------------------------*/
/* Values that can be returned for job status (&JOBSTS):             */
/* *ACTIVE  The job has started.                                     */
/*          This does not guarantee that the job is currently running:+
/*          HLDJOB, RLSJOB, TFRGRPJOB, TFRSECJOB, DSCJOB or MSGW.    */
/* *JOBQ    The job is currently on a job queue.                     */
/* *OUTQ    The job has completed running and has spooled output.    */
/* *ERROR   The Job with the specified job identifier does not exist.*/
/*-------------------------------------------------------------------*/
/* More information:                                                 */
/* http://publib.boulder.ibm.com/pubs/html/as400/v5r1/ic2931/index.htm?
          info/apis/qwcrjbst.htm                                     */
/*-------------------------------------------------------------------*/
/* Compiled with ALLOW(*IPGM *BPGM)                                  */
/*-------------------------------------------------------------------*/
             CMD        PROMPT('Retrieve Job Status')                  
             PARM       KWD(JOB) TYPE(JOB) DFT(*) SNGVAL((*)) +        
                          PROMPT('Job name')                           
 JOB:        QUAL       TYPE(*NAME) LEN(10) MIN(1)                     
             QUAL       TYPE(*NAME) LEN(10) MIN(1) PROMPT('User')      
             QUAL       TYPE(*CHAR) LEN(6) RANGE(000000 999999) +      
                          MIN(1) PROMPT('Number')                      
             PARM       KWD(JOBSTS) TYPE(*CHAR) LEN(10) RTNVAL(*YES) + 
                          PROMPT('Job Status')

***************************************
CLP source:
/*----------------------------------------------------------------MRB*/ 
/* Retrieve Job Status (calling API QWCRJBST)                        */ 
/* Marti Riera 10/07/2002                                            */ 
/* http://www.recursos-as400.com/                                    */ 
/* mailto:mrierab@teleline.es                                        */ 
/*-------------------------------------------------------------------*/ 
             PGM        PARM(&JOBID &JOBSTS)                            
             DCL        VAR(&JOBID) TYPE(*CHAR) LEN(26)                 
             DCL        VAR(&JOBNBR) TYPE(*CHAR) LEN(6)                 
             DCL        VAR(&JOBUSR) TYPE(*CHAR) LEN(10)                
             DCL        VAR(&JOBNAM) TYPE(*CHAR) LEN(10)                
             DCL        VAR(&JOBSTS) TYPE(*CHAR) LEN(10)                
             DCL        VAR(&RCV) TYPE(*CHAR) LEN(60)                   
             DCL        VAR(&RCVL) TYPE(*CHAR) LEN(4)                   
             DCL        VAR(&JOBFMT) TYPE(*CHAR) LEN(8)                 
             DCL        VAR(&ERR) TYPE(*CHAR) LEN(30)                   
/* Set receiver variable to Hex 3C (= Decimal 60) */                    
             CHGVAR     VAR(&RCVL) VALUE(X'0000003C')                   
/* Use qualified job name format */                                     
             CHGVAR     VAR(&JOBFMT) VALUE(JOBS0300)                    
/* Set qualified name of job */                                                   IF         COND(&JOBID *EQ '*') THEN(DO)                   
               RTVJOBA    JOB(&JOBNAM) USER(&JOBUSR) NBR(&JOBNBR)       
               CHGVAR     VAR(&JOBID) VALUE(&JOBNAM *CAT &JOBUSR *CAT & 
             ENDDO                                                      
/* Retrieve job status */                                               
             CALL       PGM(QWCRJBST) PARM(&RCV &RCVL &JOBID &JOBFMT &E 
/* Extract job status from receiver */                                  
             CHGVAR     VAR(&JOBSTS) VALUE(%SST(&RCV 9 10))             
/* Send status */                                                       
             SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Job +      
                          status' *BCAT &JOBID *TCAT ' is' *BCAT +      
                          &JOBSTS *TCAT '.') MSGTYPE(*STATUS)           
/* End program */                                                       
             RETURN
             ENDPGM  

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: Tips, tutorials and more.

Ask your systems management questions--or help out your peers by answering them--in our live discussion forums.

Read this Search400 Featured Topic: Managing your iSeries.

Ask the Experts yourself: Our systems management gurus are waiting to answer your technical questions.

This was last published in July 2002

Dig Deeper on Performance

Start the conversation

Send me notifications when other members comment.

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

Please create a username to comment.

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close