Joined: 26 Apr 2004 Posts: 4650 Location: Raleigh, NC, USA
I have to preface my reponse with my observation that your approach to this process leaves a lot to be desired. It's never a good practice to issue an MGET on a remote server and retrieve an unknown number of files. I think you're much better off building a series of GET statements first, then "getting" each file individually to the single output DD (with DISP=MOD specified, of course) and avoiding this whole mess to begin with.
That being said, sticking with a response for REXX, just use the TSO LISTCAT command to find all of the datasets cataloged to the high-level qualifier (in your example AAA.BBB). Then, build the TSO ALLOCATE statement(s) as you desire (either allocating each dataset one-at-a-time or concatenating them all together) and run the copy utility of your choice (IEBGENER/SORT/REPRO).
The post directly below this one has an example of using LISTCAT:
Thanks so much. I understand your point, but the problem is the process at the host (its another vendor outside) is difficult to change. I.e. they highly prefere creating files as per there standards ie. AAAA.BBB.date and time. But since I wont have that info , MGET is the only option, I suppose.
But thanks so much, I will try to implment as per your suggestion, and also the example you gave are very handy since I havent had much of REXX.