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)?
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?
* 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)
* 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)