by Aki88 » Tue Aug 02, 2016 6:11 pm
Hello,
IMHO this is less DFSORT more of JCL/UTILITIES/VSAM question.
From DFSORT stand-point, use a simple SORT FIELDS=COPY to copy datasets.
Coming to A.1 to B.1 and so on, there are multiple ways of achieving it, depending on what you have; for instance:
a. In case both the GDG base (for A and B datasets) have same starting generation, then a simple +1, +2 and so on coupled with a 'NEW,CATLG' in your JCL would yield similar generation numbers
b. In case they are not same or can be different depending on how they were created, then it can require a bit of coding. Assuming that you can use REXX, do a LISTCAT on the GDG base of A, refer the 'Associations', use SUBSTR to get the GDG generation details from here. Append the generation name to B dataset name. Here you can use ALLOC to allocate the generation or even better, submit a JCL to INTRDR which would create the new GDG generation with the name you've just built, and then subsequently copy A to B in the next step.
A word of caution, how do you plan to ensure that the generations are always serialized, meaning - say two generations of A G0011V00 and G0016V00 are to be copied to B. Now basis the requirement A.G0011V00 is to be copied to B.G0011V00 and A.G0016V00 to B.G0016V00. Now, since A never had such a naming convention restriction, hence it'll have G0012 etc generations as well; how do you plan to control this for B?
Also, why go through this ordeal at all?