I still think that an invoked program is the better way to do this given that REXX is pretty inefficient with its IO processing. If the files are large it could take forever. Anyway, things are a smidgeon slow at the office
If you do take a copy, run it with TRACE R and then you can see how it does what it does.
/* REXX *** COPY MULTIPLE DATASETS TO ONE OUTPUT- IEBGENER */
"FREE FI(INFILES)"
"ALLOC FI(INFILES) DA('DSN with input file list') SHR"
"EXECIO * DISKR INFILES ( STEM INFS. FINIS"
IDSN = ""
DO AA = 1 TO INFS.0
IDSN = STRIP(IDSN" '"STRIP(INFS.AA)"'")
END
"FREE FI(SYSIN,SYSUT1,SYSUT2,SYSOUT,SYSPRINT)"
"DEL 'Your OUTPUT file'"
"ALLOC FI(SYSOUT) SYSOUT(X)"
"ALLOC FI(SYSPRINT) SYSOUT(X)"
"ALLOC FI(SYSIN) DUMMY"
"ALLOC FI(SYSUT1) DA("IDSN") SHR"
"ALLOC FI(SYSUT2) DA('Your OUTPUT file') NEW TRACKS SPACE(3 3)
RECFM(F B) LRECL(80)"
"CALL *(IEBGENER)"
"FREE FI(SYSIN,SYSUT1,SYSUT2,SYSOUT,SYSPRINT,INFILES)"
EXIT