Page 1 of 1

Can we get the Job number as a Job executes?

Posted: Wed Jan 22, 2014 1:16 pm
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.

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

Posted: Wed Jan 22, 2014 1:59 pm
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?

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

Posted: Wed Jan 22, 2014 8:00 pm
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.

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

Posted: Wed Jan 22, 2014 8:34 pm
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.

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

Posted: Wed Jan 22, 2014 9:03 pm
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?

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

Posted: Wed Jan 22, 2014 9:26 pm
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 ! :)

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

Posted: Wed Jan 22, 2014 9:33 pm
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! :)