View previous topic :: View next topic
|
Author |
Message |
hellosri
New User
Joined: 14 May 2007 Posts: 7 Location: CT, USA
|
|
|
|
Hello there,
I have a requirement where my first step REXX creates multiple files based on the number of entries passed in the sysin card and it creates that many number of files dynamically.
For example
Sysin card in REXX step :
F001
F004
F008
Three output files gets created with F001, F004 and F008 as qualifiers.
The above entries can be dynamic and can vary.
In the same job I need to merge all these files together in a sort step so that the merged files can be used as input in the same job later.
How can I dynamically use all of the inputs in SORTIN DD statement so that I can merge them? |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
Lesson #1:
Learn the difference between “files” in Windows, and “datasets” + “DDnames” in zOS.
What, and where do you plan to create? What may be the need to change the standard DDnames - not clear from your post. Also, hard to imagine the need to change your DSNames - why? |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 734 Location: Denmark
|
|
|
|
You need to make the first step create a list of the datasets it creates, then this list can be used by the second step. The second step should also be a REXX pgm, which allocates the datasets and invokes SORT.
Another approach would be a second REXX step using the SDSF API to id the dynamically creates datasets, but that is somewhat more complicated. |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 734 Location: Denmark
|
|
|
|
Or perhaps simpler - write an 'outer' REXX which runs the original pgm, then does a TSO LISTALC ALL to id the dynamically created datasets and builds a list from that. Then you do not have to modify the original program. |
|
Back to top |
|
|
Pete Wilson
Active Member
Joined: 31 Dec 2009 Posts: 592 Location: London
|
|
|
|
Generate a SORTIN DD card with all the datasets concatenated into a PDS member and use a JCL INCLUDE referring to that in the merge step JCL |
|
Back to top |
|
|
hellosri
New User
Joined: 14 May 2007 Posts: 7 Location: CT, USA
|
|
|
|
Thank you everyone for your response. Kindly excuse not able to use proper English as English is not my primary language. I am going to try out the solution provided my Peter and will let you know. Thanks again very much.
Cheers
Sri |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
Pete Wilson wrote: |
Generate a SORTIN DD card with all the datasets concatenated into a PDS member and use a JCL INCLUDE referring to that in the merge step JCL |
JCL INCLUDE is resolved before any other “SORTIN DD card” is generated within the same job.
One can use a temporary dataset, or concatenation of several ones, as concatenated //SYSIN DD |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
Moderators have deleted my response, but it was the most important issue in this situation: an approach inherited from Windows does not work well in zOS, in 99.99% of all cases. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
Already two or more solutions have been provided to try out of which the first one from Willy , I have used in past and works which generates the SORTIN DD via REXX.
So let us be generous to wait for TS to try it and file vs dataset is not any more debatable, one can free to use any term. |
|
Back to top |
|
|
|