Page 1 of 2

Combining 'N' number of files

PostPosted: Fri Sep 11, 2009 10:00 am
by lal
Hi Friends,
I have 'N' number of files as shown below of LRECL=80 and RECFM=FB

USERID.FILENAME1.FILE
USERID.FILENAME2.FILE
USERID.FILENAME3.FILE
....
....

I have to combine the contents of all these files into one file 'USERID.COMBINED.FILE'. Everyday I have to combine 'N' number of files into a single file.

Can you please suggest a way to do this.

Thanks,
lal

Re: Combining 'N' number of files

PostPosted: Fri Sep 11, 2009 3:55 pm
by MrSpock
You need to concatenate all of the required input datasets to the one SORTIN DD. What's the issue?

Re: Combining 'N' number of files

PostPosted: Fri Sep 11, 2009 7:07 pm
by lal
Hi MrSpock,
I guess I was not clear. We have 'N' number of these files 'USERID.FILENAME*.FILE' created by some other process. So we have to manually do 3.4 and get the list of these files and merge them into one file.

So is there any automated process to merge these files.

Thanks,
lal

Re: Combining 'N' number of files

PostPosted: Fri Sep 11, 2009 9:10 pm
by MrSpock
See this previous topic for an example of a technique you can take advantage of. Unless you want to handle this programatically and use some dynamic allocation techniques, you'll need to create the dataset list, format it into proper JCL DD statements, and pass all of that into a second job that will actually use those DD statements.

Re: Combining 'N' number of files

PostPosted: Sat Sep 12, 2009 1:01 am
by dick scherrer
Hello,

So is there any automated process to merge these files.
Merge has a specific meaning. A merge may be done with data that is in a common sequence.

Your requirement does not sound like a merge - it sounds like you simply want to create one file containing all of the data from multiple files in no particular sequence.

Re: Combining 'N' number of files

PostPosted: Sat Sep 12, 2009 2:38 am
by lal
MrSpock,
The link you provided was useful and I followed the same approach of building entire SORTIN with the DSN names in a separate step and later included that member in my step to copy the contents of all the DSN's into one combined file.

Dick Scherrer,
I agree with your statement, it's not an merge but just copy of the files.

Thanks,
lal

Re: Combining 'N' number of files

PostPosted: Sat Sep 12, 2009 2:55 am
by dick scherrer
Good to hear it is working - thanks for letting us know :)

d

Re: Combining 'N' number of files

PostPosted: Tue Sep 15, 2009 1:10 am
by lal
Hi,
In my earlier reply I mentioned that "I followed the approach of building entire SORTIN with the DSN names in a separate job and later included that member in the different job to copy the contents of all the DSN's into one combined file."

So is there anyway I can build the dynamic SORTIN in the same job.

Thanks,
lal

Re: Combining 'N' number of files

PostPosted: Tue Sep 15, 2009 1:20 am
by dick scherrer
Hello,

Not really as the jcl is parsed when the job starts and is not modified thereafter.

Re: Combining 'N' number of files

PostPosted: Tue Sep 15, 2009 7:56 pm
by lal
Thanks Dick Scherrer for the response

Thanks,
lal