manuwankenobi
New User
Joined: 02 Mar 2006 Posts: 32 Location: FRANCE
|
|
|
|
Hi all,
I have to replace the program name in steps from JCL, but only if I find some data later.
For example I want to replace OLPGM by NEWPGM only if I found the string "PARM0001" somewhere later in the step.
Input file :
Code: |
//S1 EXEC PGM=OLDPGM
//...
//...
//...
//SYSIN DD *
PARM0001
//S2 EXEC PGM=OTHERPGM
//...
//...
//...
//SYSIN DD *
PARM0015
//S3 EXEC PGM=OLDPGM
//...
//...
//...
//SYSIN DD *
PARM0002
..... |
Expected ouput file :
Code: |
//S1 EXEC PGM=NEWPGM
//...
//...
//...
//SYSIN DD *
PARM0001
//S2 EXEC PGM=OTHERPGM
//...
//...
//...
//SYSIN DD *
PARM0015
//S3 EXEC PGM=OLDPGM
//...
//...
//...
//SYSIN DD *
PARM0002
........ |
Do you think that there is a simple way to achieve this with DFSORT, I so could you give me an idea on how to to this ?
Thank you. |
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You have one piece of JCL you want to do this to, or a library full?
If the latter, a general-purpose programming language would be a better choice. Probably.
Is the value you are looking for only in data-cards (and only data-cards which don't begin with //)?
A JOINKEYS using the same dataset for both inputs.
In JNF1CNTL, use WHEN=INIT to PARSE by "word" (for the first two) and use WHEN=GROUP to PUSH a sequence number when the second PARSEd field is EXEC and the first begins with // and doesn't have an * in column three.
In JNF2CNTL, OMIT COND= for "//b" (where b is blank) and "//*. Do the same PARSE and GROUP as above and then use WHEN=(logicalexpression) to clobber the SEQ for any card which begins //. Another WHEN=(logicalexpression) to clobber any which does not contain your value (you can use SS, perhaps PARSE, unless your positions and lengths are rigorous).
JOINKEYS to specify SORTED and NOSEQCK.
JOIN UNPAIRED,F1
REFORMAT to contain F1 and the matched-marker.
In the main task, you'll need to PARSE to find the EXEC card and make the change.
Two hits of your value in the same data will mess things up.
You need to watch for JCL comments, JECL and even for /* cards where someone has added text to it. Also check for possibility of value appearing in DSN, or other information relating to JCL cards. |
|