|
View previous topic :: View next topic
|
| Author |
Message |
David Eisenberg
New User
Joined: 15 Nov 2007 Posts: 39 Location: New York
|
|
|
|
Frank,
I’m interested in knowing if there’s a way to use DFSORT to dynamically modify the routine names on MODS statements which will be used in a subsequent ICETOOL job step.
I.e., I want to create a DFSORT job step that will read a dataset containing DFSORT control statements, find all MODS statements within that dataset, modify the routine names within the MODS statements, and write out a new dataset containing new DFSORT control statements. Those new statements would then be used as input to a subsequent ICETOOL step.
Very specifically, I’m looking for some DFSORT cleverness (presumably involving PARSE, FINDREP, etc) that would append the character “A” to the end of each routine name found within each MODS statement in an input dataset.
Here's an example. All records are fixed-length, 80 bytes. I know the statements below are nonsense, but that’s actually not relevant, because I’m only concerned with locating and modifying the MODS statements. Note that there may legitimately be more than one MODS statement in the input dataset, because the dataset will actually contain all control cards for an application involving multiple ICETOOL operators (before the ICETOOL step, we use IEBUPDTE to explode the dataset into individual PDS members). We are currently using only E15 and E35 exits, although I suppose it would be good if the solution could handle all other types of DFSORT exits. I think it's safe to assume (for the purpose of parsing) that the MODS statement will always begin in column 2, and will never require continuation across multiple records.
| Code: |
* example
SORT FIELDS=COPY
MODS E15=(E15XIT1,750),E35=(E35XIT1,5000)
OUTFIL <etc>
* some other stuff
SORT FIELDS=(7,15,A)
INCLUDE…
MODS E35=(E35XT2,900)
* more stuff |
I would like to use DFSORT to transform the dataset above into the following output dataset:
| Code: |
* example
SORT FIELDS=COPY
MODS E15=(E15XIT1A,750),E35=(E35XIT1A,5000)
OUTFIL <etc>
* some other stuff
SORT FIELDS=(7,15,A)
INCLUDE…
MODS E35=(E35XT2A,900)
* more stuff |
Is this achievable without writing a program (or DFSORT exit)?
Thanks so much,
David |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
David,
Are the exits always of the form:
Exx=(name,length)
or can they have different forms such as:
Exx=(name,length,lib,N)
Exx=(name,length,lib)
Can I assume that the input and output files have RECFM=FB and LRECL=80?
I assume there's no pattern to the actual exit names that would allow us to use FINDREP to change 'name' to 'namea' ... right? |
|
| Back to top |
|
 |
David Eisenberg
New User
Joined: 15 Nov 2007 Posts: 39 Location: New York
|
|
|
|
| Quote: |
Are the exits always of the form:
Exx=(name,length) |
Yes; we won't be using the other MODS parameters.
| Quote: |
| Can I assume that the input and output files have RECFM=FB and LRECL=80? |
Yes.
| Quote: |
| I assume there's no pattern to the actual exit names that would allow us to use FINDREP to change 'name' to 'namea' ... right? |
No, other than the fact that the names are never longer than 7 characters (so it is always safe to append the "A"). There will be several exits in each ICETOOL application, and there are many different applications.
That said, if we were to come up with a consistent naming convention, what sort of pattern would be helpful for FINDREP? We might be able to enforce a rule that each exit name begins with the characters "DF" (for DFSORT); and we might also be able to insist that each name be exactly 7 characters long. Would that help?
David |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
If you just ensured that each name was 7 characters and the form of the MODS statement was always one of these:
| Code: |
MODS Exx=(exitnam,a)
MODS Exx=(exitnam,a),Exx=(exitnam,b)
MODS Exx=(exitnam,a),Exx=(exitnam,b),Exx=(exitname,c)
|
where a, b and c are 1-5 digit values, you could use the following DFSORT control statements to do what you want:
| Code: |
OPTION COPY
INREC IFTHEN=(WHEN=(1,6,CH,EQ,C' MODS'),
PARSE=(%01=(ABSPOS=7,FIXLEN=3),
%02=(STARTAFT=C'(',FIXLEN=7),
%03=(STARTAFT=C',',ENDBEFR=C')',FIXLEN=5),
%04=(STARTAFT=C',',FIXLEN=3),
%05=(STARTAFT=C'(',FIXLEN=7),
%06=(STARTAFT=C',',ENDBEFR=C')',FIXLEN=5),
%07=(STARTAFT=C',',FIXLEN=3),
%08=(STARTAFT=C'(',FIXLEN=7),
%09=(STARTAFT=C',',ENDBEFR=C')',FIXLEN=5)),
BUILD=(C' MODS ',
%01,C'=(',%02,C'A,',%03,UFF,EDIT=(TTTTT),C'),',
%04,C'=(',%05,C'A,',%06,UFF,EDIT=(TTTTT),C'),',
%07,C'=(',%08,C'A,',%09,UFF,EDIT=(TTTTT),C')'))
OUTFIL IFOUTLEN=80,
IFTHEN=(WHEN=(28,1,CH,EQ,C' '),
BUILD=(1,26)),
IFTHEN=(WHEN=(49,1,CH,EQ,C' '),
BUILD=(1,47))
|
So for example, if your input was:
| Code: |
* example
SORT FIELDS=COPY
MODS E15=(DF5XIT1,750),E35=(DF5XIT1,5000)
OUTFIL <etc>
* some other stuff
SORT FIELDS=(7,15,A)
INCLUDE ...
MODS E35=(E35XT02,900)
* more stuff
MODS E35=(DF5XIT1,81000),E35=(DF5XIT2,5000),E11=(XYZABCD,82000)
|
the output would be:
| Code: |
* example
SORT FIELDS=COPY
MODS E15=(DF5XIT1A,00750),E35=(DF5XIT1A,05000)
OUTFIL <etc>
* some other stuff
SORT FIELDS=(7,15,A)
INCLUDE ...
MODS E35=(E35XT02A,00900)
* more stuff
MODS E35=(DF5XIT1A,81000),E35=(DF5XIT2A,05000),E11=(XYZABCDA,82000)
|
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
And here's a more general version that will work with MODS statements in the form:
| Code: |
MODS Exx=(x,a)
MODS Exx=(x,a),Exx=(y,b)
MODS Exx=(x,a),Exx=(y,b),Exx=(z,c)
|
where x, y and z can be 1-7 character exit names and a, b and c can be 1-5 digit values.
| Code: |
OPTION COPY
INREC IFTHEN=(WHEN=(1,6,CH,EQ,C' MODS'),
PARSE=(%01=(ABSPOS=7,FIXLEN=3),
%02=(STARTAFT=C'(',ENDBEFR=C',',FIXLEN=7),
%03=(ENDBEFR=C')',FIXLEN=5),
%04=(STARTAFT=C',',FIXLEN=3),
%05=(STARTAFT=C'(',ENDBEFR=C',',FIXLEN=7),
%06=(ENDBEFR=C')',FIXLEN=5),
%07=(STARTAFT=C',',FIXLEN=3),
%08=(STARTAFT=C'(',ENDBEFR=C',',FIXLEN=7),
%09=(ENDBEFR=C')',FIXLEN=5)),
BUILD=(C' MODS ',
%01,C'=(',%02,C'A,',%03,C'),',
%04,C'=(',%05,C'A,',%06,C'),',
%07,C'=(',%08,C'A,',%09,C')'))
OUTFIL IFOUTLEN=80,
IFTHEN=(WHEN=(28,1,CH,EQ,C' '),
BUILD=(1,6,7,20,SQZ=(SHIFT=LEFT))),
IFTHEN=(WHEN=(49,1,CH,EQ,C' '),
BUILD=(1,6,7,41,SQZ=(SHIFT=LEFT))),
IFTHEN=(WHEN=NONE,
BUILD=(1,6,7,63,SQZ=(SHIFT=LEFT)))
|
So for example, if your input was:
| Code: |
* example
SORT FIELDS=COPY
MODS E15=(DF,750),E35=(DF5XIT1,5000)
OUTFIL <etc>
* some other stuff
SORT FIELDS=(7,15,A)
INCLUDE ...
MODS E35=(E35XT,900)
* more stuff
MODS E35=(DF51,8100),E35=(DF5XIT,800),E11=(XY,82000)
|
the output would be:
| Code: |
* example
SORT FIELDS=COPY
MODS E15=(DFA,750),E35=(DF5XIT1A,5000)
OUTFIL<etc>
* someotherstuff
SORT FIELDS=(7,15,A)
INCLUDE...
MODS E35=(E35XTA,900)
* morestuff
MODS E35=(DF51A,8100),E35=(DF5XITA,800),E11=(XYA,82000)
|
|
|
| Back to top |
|
 |
David Eisenberg
New User
Joined: 15 Nov 2007 Posts: 39 Location: New York
|
|
|
|
Frank,
Fantastic! Thank you!
David |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You're welcome. That was fun!  |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|