Where Did I Come From?
March 23, 2005 Hey, Ted
How can I tell which job queue an active batch job was submitted to?
–Tim
Do you mean how a human can see that information or how a program can determine it? I’ll show you both ways.
A human can use the Work with Job (WRKJOB) command to determine which job queue a batch job came from. Take Option 2, Display Job Definition Attributes.
Here’s a second method that you probably won’t need. The job queue name is also in a message in the job log. Display the job log and look for a message that says “Job 123456/SOMEUSER/SOMEJOB submitted” near the top of the job log. Position the cursor to that message and press F1 and you’ll find the job queue name in the help text.
If a program needs to determine which job queue its current invocation came from, use the Retrieve Job Information API, QUSRJOBI. The following CL source code is some I have used.
dcl &RcvVar *char 512 dcl &RcvVarLen *char 4 dcl &Format *char 8 dcl &JobName *char 16 dcl &JobID *char 16 dcl &JobQ *char 10 dcl &JobQLib *char 10 chgvar %bin(&RcvVarLen) 512 chgvar &Format 'JOBI0300' chgvar &JobName '*' chgvar &JobID ' ' call qusrjobi (&RcvVar &RcvVarLen &Format &JobName &JobID) chgvar &JobQ %sst(&RcvVar 63 10) chgvar &JobQLib %sst(&RcvVar 73 10)
–Ted