How to retrieve the jobq in which my current job is running in CL?

40 pts.
Tags:
CL Program
JOBQ
QBATCH
SBMJOB
I have a CL program which will run as a SBMJOB. Now I want to see whether it is running in QBATCH jobq. If not in QBATCH, I have to resubmit it into QBATCH. How I can do it in CL?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi,

You can use the QUSRJOBI API to get the job queue from your job. Also possible to get the job description.

Maybe this link could help you:

http://www.mcpressonline.com/forum/showthread.php?10201-Getting-Job-details

Regards.

Discuss This Question: 11  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

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
  • CharlieBrowne
    Jobs do not run in JOBQs. They are submitted to job queues, but run in subsystems. On the SBMJOB command you specify what jobq you want to use.
    41,380 pointsBadges:
    report
  • TomLiotta
    CharlieBrowne's right -- jobs run from a *jobq, not in a *jobq. Once the job is running, it's already off of the queue. So, do you want to know if the job is running in subsystem QBATCH? Or do you want to know what job queue the job is sitting on waiting to run? What exactly do you need to do? Will you cancel the job if it is sitting on the wrong job queue? Will you cancel the job if it's running in the wrong subsystem? How does it get submitted incorrectly in the first place? Tom
    125,585 pointsBadges:
    report
  • JustinA
    What I need is, my CL is supposed to be run from QBATCH. Now, in CL, I have to check whether my current job is run from QBATCH, if not submit a instance of the same prgram to QBATCH jobq. Probably, using API is the only way to do it from CL as well?
    40 pointsBadges:
    report
  • WoodEngineer
    If you goal is to know if the job is running interactively or in batch, just issue this command in your CL: RTVJOBA TYPE(&TYPE) &TYPE will contain "0" (zero) if running in batch, or "1" if running interactively. I used quotes because the variable must be defined a *CHAR with length of 1.
    6,670 pointsBadges:
    report
  • PGMBOB
    Why running in jobq QBATCH. Jobs wait on JOBQ and run-in SBSD. RTVJOBA returns TYPE '0' for batch or '1' for interactive
    1,085 pointsBadges:
    report
  • HMSSL2K
    Just do a RTVJOBA in CL pgm.
    3,175 pointsBadges:
    report
  • TomLiotta
    ...in CL, I have to check whether my current job is run from QBATCH, if not submit a instance of the same prgram to QBATCH jobq. It doesn't make much sense, but it can be done. RTVJOBA won't help at all. The first thing your CL will do is call the Retrieve Job Information (QUSRJOBI) API for the current job, specifying format JOBI0300. At offset 62 of the returned structure, the job queue name that the job ran from can be found. (If you really want the subsystem name, you would use format JOBI0200. The offset would still be 62. For an offset of 62, you'd use the %SST() function with starting position 63.) If the job queue isn't 'QBATCH' (or if the subsystem isn't 'QBATCH', depending on which way you go), then run the appropriate SBMJOB command and RETURN. But if the value you find is 'QBATCH', then continue running the rest of the program. It still doesn't make much sense to me. I can't think of any reason to force a job by hard-coding a job queue name. It'd be better to have it submit with a job description name, for example. Then the attributes of the job could be controlled by setting attributes of the job description. When you need the job queue to be QBATCH, you set the job description accordingly. (It'd be bad enough hard-coding a job description name into the CL, but at least it lets you change in case future requirements change.) BTW, what will your CL do if the QBATCH job queue is obsoleted (deleted)? Tom
    125,585 pointsBadges:
    report
  • JustinA
    Thanks guys...Tom's and Mario's answers look most suited for me....My issue was, my job is submitted from different places. Now, I am not allowed to change all those programs. Now I have to use the QUSRJOBI for this..... I agree, use of JOBD is the right thing to do.
    40 pointsBadges:
    report
  • JustinA
    [...] How to retrieve the jobq in which my current job is running in CL? [...]
    0 pointsBadges:
    report
  • TomLiotta
    ..my job is submitted from different places. A submitted job is either a submitted CALL command or a command other than CALL. Either way, a program is run. If you have to do it this way, I would rename the program and write a new program with the original name. The new program would simply issue a proper SBMJOB that submits the renamed program to QBATCH. That way, you wouldn't need to change any existing programs. They would continue to submit the old name to whatever job queue they wanted. But they would actually be submitting the new program (with the old name.) The new program wouldn't care where it ran because it does one thing -- submit the old program (with a new name) to QBATCH. It'd end essentially immediately, even if it started in QBATCH already. The new program could issue a properly constructed SBMJOB. It could even use a *JOBD to assign QBATCH as the job queue. Tom
    125,585 pointsBadges:
    report
  • JustinA
    [...] 9. Check out the great community responses and guidance provided to a member who asked how to retrieve the JOBQ in which his current job is running in CL. [...]
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

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

Thanks! We'll email you when relevant content is added and updated.

Following