Hello,
Papya013 wrote:I have those mentioned files in a PS file which was generated from LISTCAT and I want to feed that data to SORTIN so that I get the merged file in SORTOUT.
Sorry, but the requirement is still unclear; is it that:
a. You have a PS file with DS names.
b. These individual DS - each have LISTCAT data in them.
c. You want this data from point 'b' to be merged into one single dataset.
If 'the above' is your requirement, then:
1. Are the dataset names you mention, fixed, i.e. you know the dataset names at the time of JCL submission; if Yes, then the earlier post's solution will suffice, simply give the 'known' DSN in the SORTIN, and you're good to go.
2. If the DSN are not known at the time of job submission; and all that is known is this one PS file which contains names of the LISTCAT datasets, then you might want to look at SYMNAMES functionality of DFSORT;
generate your JCL dynamically using SYMNAMES by reading your DS which has LISTCAT dataset names in it.
To achieve point 2 you'll need, a SYMNAMES set up, which would generate symbolics for dataset names which would be read from your PS file. Pass these to another SORT wherein you build a JCL using these symbolics; and then route your SORTOUT to INTRDR; this will submit a JCL with the build DFSORT setup that merges the files. Note that, by 'merge' I mean - DD concatenate all your DS and do a SORT FIELDS=COPY.
Word of caution: This solution has many break-points, such as what-if the number of DSN in your PS file are greater than 255; what if the PS file has junk characters in it? Also, the amount of code involved is large.
The challenge here is not merging the DS, but getting the DSN (for your PS file) passed to a program as DD statements.
Another approach can be writing a small COBOL/REXX prog, to drive the JCL build process, simply read the PS file until end-of-file, test each record for valid DSN, and route the valid DS names to a working storage construct, where you already have a JCL hard-coded. Write the final working storage to an output DD statement which routes it to INTRDR. (This is much simpler to code, if you're not very comfortable with DFSORT)
PS: There can be a simpler solution to this, but that would require more brainstorming.
Hth.