Page 1 of 1

Can you parse a dataset name in jcl to use later?

PostPosted: Sat May 08, 2010 5:32 am
by SMILEY35
If you have a infile in your JCL like this

CGT.TEST.FILE.NEEDTHIS (This file can change but all qualifers stay the same lengths)

Can you parse this file to use the NEEDTHIS in a later step in the job?

Re: Can you parse a dataset name in jcl to use later?

PostPosted: Sat May 08, 2010 6:28 am
by Robert Sample
JCL executes programs. It does not parse, it does not slice, it does not dice. All it does is execute programs. So if you tell us where the data set name is coming from (sequential file, VSAM file, or what?), and what utility (or programming language) you are planning on using to parse the name, we can provide assistance. But based on what you've told us so far, there's no assistance for us to provide.

Re: Can you parse a dataset name in jcl to use later?

PostPosted: Sat May 08, 2010 7:32 am
by SMILEY35
Ok. so i have a cobol program that will read in the file and i can parse it that way. But not sure how to pass it on in the JCL to use as a symbolic.

I can write out a dataset or into a pds member but how can i access it in the same job?


This is what i'm writing out:

// set jobid=needthis

I then do a include on the member but it pulls in the previous info in the member. i guess the JCLLIB order pulls in that member even before i use it as an include member.

Re: Can you parse a dataset name in jcl to use later?

PostPosted: Sat May 08, 2010 7:56 am
by Robert Sample
When you submit a job, it goes through the JES converter / interpreter (C/I), which figures out what the JCL requires, resolves symbolic symbols, and otherwise gets the job ready to execute. Once the JCL has been through the JES C/I it is not possible to modify that job in any way, shape, style, or form. So after you have read the data and parsed it in your COBOL program, you need to be aware that you cannot (and that is an absolute CAN NOT) use that parsed data in the executing job. You can submit another job that will include the parsed data, but the job that is running has had its JCL essentially fixed in stone and you are not able to do any modification to it.

So if your REQUIREMENT is to do this in one job, you need to go back to whoever gave you the assignment and tell them what is required is not possible. If the requirement allows for a second job, then proceed to find the desired value and write your new job with that parameter to the internal reader to submit it.

Re: Can you parse a dataset name in jcl to use later?

PostPosted: Sat May 08, 2010 7:58 am
by dick scherrer
Hello and welcome to the forum,

I can write out a dataset or into a pds member but how can i access it in the same job?
No way that i'm aware of. Once the job is already running it is too late to self-modify. . .

What you could do is read the file, parse the value into some variable, generate the run jcl using the parsed value, and submit the generated jcl via the internal reader.

What is "jobid"? If you post the jcl, it may help someone help you.

Re: Can you parse a dataset name in jcl to use later?

PostPosted: Sat May 08, 2010 8:09 am
by SMILEY35
I don't have to JCL to post right now.

So if they JCL is submitted but is in postion 3 before it is ran is the values already resolved?

Re: Can you parse a dataset name in jcl to use later?

PostPosted: Sat May 08, 2010 8:13 am
by SMILEY35
I can setup 2 jobs but want to make sure that this will work.

Say i have job a and it sets the value JOBID=NEEDTHIS and then it submits job b.
Job b is waiting to run but job a submits ago and set JOBID=NEEDTHAT. Now i have two job b's in the queue waiting to run. Will the first job b run with the value of NEEDTHIS or will it pull the most current value NEEDTHAT?

Re: Can you parse a dataset name in jcl to use later?

PostPosted: Sat May 08, 2010 8:28 am
by Robert Sample
Since the first job b has a hard coded NEEDTHIS in it, and the second job b has a hard coded NEEDTHAT, how could they be confused?

Re: Can you parse a dataset name in jcl to use later?

PostPosted: Sat May 08, 2010 8:50 am
by SMILEY35
sorry it would not be hardcoded it would be in an included member.

JOB a will write to MY.TEST.PROCLIB(JOBID)

JOB b will
JCLLIB ORDEr=MY.TEST.PROCLIB

INCLUDE MEMBER=JOBID

Re: Can you parse a dataset name in jcl to use later?

PostPosted: Sat May 08, 2010 8:59 am
by dick scherrer
Hello,

So if they JCL is submitted but is in postion 3 before it is ran is the values already resolved?
If i understand the question, no, the values will not yet be resolved. They can no longer be changed, but they have not been resolved by the system.

As long as the job is "awaiting exedcution" the resolution has not yet happened. Once the job is "executing", resolution has occurred. When a job is waiting to execute whatever was submitted will run regardless of what is submitted later. You can submit one job or many and each will use the whatever values were in the submitted jcl forn that bparticular job.