Pages

Sunday, November 22, 2015

Track the Submitted Job Details

If you are using CL Program to Submit the Jobs, You can be able to Track the Details by using RCVMSG Command.

RCVMSG:


The Receive Message (RCVMSG) command is used by a program to receive a message previously sent to a message queue.

The RCVMSG command receives messages from a job message queue (a message queue associated with a call stack entry or the external message queue (*EXT)), or from a named message queue. The program can receive a message from a message queue associated with its own call stack entry or from a message queue associated with another call stack entry.

This command copies a message received in the specified message queue into control language (CL) variables within the program.

You can specify the message being received by indicating the message type, the reference key of the message, or both. The program receiving the message can also specify, on the RCVMSG command, whether a message is removed from the message queue or left there as an old message. If the specified message queue is not allocated to the job in which this command is entered, or to any other job, the message queue is implicitly allocated by this command for the duration of the command's processing.

Example Program to Retrieve Job Details:


Below CL Program will show on how to retrieve Job Details (Job Name/Job User/Job Number)

             PGM                                                                
                                                                                
             DCL        VAR(&MSGDTA) TYPE(*CHAR) LEN(80)                        
             DCL        VAR(&JOBNAM) TYPE(*CHAR) LEN(10)                        
             DCL        VAR(&JOBUSR) TYPE(*CHAR) LEN(10)                        
             DCL        VAR(&JOBNUM) TYPE(*CHAR) LEN(6)                         
             DCL        VAR(&JOBSTS) TYPE(*CHAR) LEN(10)                        
                                                                                
             SBMJOB     CMD(DSPSYSSTS) JOB(DSPSYSSTS)                           
             RCVMSG     RMV(*YES) MSGDTA(&MSGDTA)                               
             CHGVAR     VAR(&JOBNAM) VALUE(%SST(&MSGDTA 1 10))                 
             CHGVAR     VAR(&JOBUSR) VALUE(%SST(&MSGDTA 11 10))                 
             CHGVAR     VAR(&JOBNUM) VALUE(%SST(&MSGDTA 21 6))                  
                                                                                
             ENDPGM                                                             

No comments:

Post a Comment

Popular Posts