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



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

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

Postby SMILEY35 » Sat May 08, 2010 5:32 am

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?
SMILEY35
 
Posts: 8
Joined: Sat May 08, 2010 5:25 am
Has thanked: 0 time
Been thanked: 0 time

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

 

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

Postby Robert Sample » Sat May 08, 2010 6:28 am

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.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

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

Postby SMILEY35 » Sat May 08, 2010 7:32 am

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.
SMILEY35
 
Posts: 8
Joined: Sat May 08, 2010 5:25 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby Robert Sample » Sat May 08, 2010 7:56 am

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.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

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

Postby dick scherrer » Sat May 08, 2010 7:58 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

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

Postby SMILEY35 » Sat May 08, 2010 8:09 am

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?
SMILEY35
 
Posts: 8
Joined: Sat May 08, 2010 5:25 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby SMILEY35 » Sat May 08, 2010 8:13 am

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?
SMILEY35
 
Posts: 8
Joined: Sat May 08, 2010 5:25 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby Robert Sample » Sat May 08, 2010 8:28 am

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?
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

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

Postby SMILEY35 » Sat May 08, 2010 8:50 am

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
SMILEY35
 
Posts: 8
Joined: Sat May 08, 2010 5:25 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby dick scherrer » Sat May 08, 2010 8:59 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post