Can we get the Job number as a Job executes?

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
User avatar
Kishor Bag
Registered Member
Posts: 10
Joined: Thu Jan 16, 2014 4:46 pm

Can we get the Job number as a Job executes?

Post by Kishor Bag »

Hi,

Is there a way to get the job-number/JES number during the same time when the job is executing? Thanks for any guidance.
Last edited by zprogrammer on Wed Jan 22, 2014 1:56 pm, edited 1 time in total.
Reason: Moved from Cobol to JCL forum
zprogrammer
Global Moderator
Global Moderator
Posts: 588
Joined: Wed Nov 20, 2013 11:53 am
Location: Mars

Re: Can we get the Job number as a Job executes?

Post by zprogrammer »

Could you please explain your requirement further?

Do you just want to know the jobnumber of a job that is executing or you need job number of currently executing job for some processing?
zprogrammer
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Can we get the Job number as a Job executes?

Post by Robert Sample »

If you are using a programming language such as COBOL, then you can use the system control blocks for the job / task to retrieve the JES job number for the executing job. If you are using a utility such as IEBGENER or SORT, then you probably will not be able to get the job number of the executing job.
User avatar
Kishor Bag
Registered Member
Posts: 10
Joined: Thu Jan 16, 2014 4:46 pm

Re: Can we get the Job number as a Job executes?

Post by Kishor Bag »

Last edited by Pandora-Box on Wed Jan 22, 2014 1:56 pm, edited 1 time in total.
Reason: Moved from Cobol to JCL forum
This is disappointing Pandora - why do you move the thread to JCL part of the Forum? I'm looking for a COBOL solution, that's why I posted it in the COBOL part of the Forum.
User avatar
Anuj Dhawan
Founder
Posts: 2801
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Can we get the Job number as a Job executes?

Post by Anuj Dhawan »

Hi Kishor,

If you're looking for a COBOL solution, please look at the program Enrico has referred to. That program retrieves specific JOB-related data from MVS control blocks (as Robert has suggested) and moves it to Working-storage.

On the other hand if using a JCL Job can be your choice, this EZACFSM1 Job might help you:

Code: Select all

//STEP0010 EXEC PGM=EZACFSM1
//SYSIN    DD   *
STATUS (&JOBNAME)
/*
//SYSOUT   DD   DSN=&&TEMP,DISP=(,PASS),UNIT=VIO
//*
//STEP0002 EXEC PGM=IKJEFT01
//SYSTSPRT DD   SYSOUT=*
//SYSTSIN  DD   DSN=&&TEMP,DISP=(OLD,DELETE)
though this expects you to add two additional steps to your Job while the COBOL program, listed above, can be called from your COBOL program itself - choice is yours.

Now as you see that the same problem can have both JCL and COBOL solutions and the post was moved to JCL part of the Forum with possibly with a thought that you get a quick reply. I'll move it back to COBOL, if you want to?
Last edited by Anuj Dhawan on Wed Jan 22, 2014 9:27 pm, edited 2 times in total.
Reason: Same program was referred by Enrico already. Edited to remove the same reference from my post.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Kishor Bag
Registered Member
Posts: 10
Joined: Thu Jan 16, 2014 4:46 pm

Re: Can we get the Job number as a Job executes?

Post by Kishor Bag »

Thank You very much Enrico and Anuj.

Anuj _ with your post I realize what I was missing. I was too much in to COBOL and could not really think out of it. Thanks for aligning me! Though please keep it in COBOL part of the Forum... :)

Once again Thank You - this is a great help ! :)
User avatar
Anuj Dhawan
Founder
Posts: 2801
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Can we get the Job number as a Job executes?

Post by Anuj Dhawan »

You're welcome Kishor - Moved it to COBOL Part of the Forum as you finally wish to pick up the COBOL solution.

Good Luck! :)
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”