Tip

Retrieve job status

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 first published in July 2002

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.