Page 1 of 1

Merge 50+ files of different length

PostPosted: Wed Jun 15, 2011 11:02 pm
by ritikasingh
Hi Friends,

Please advice if i want to merge data from 50+ flat files digfferent lrecl , fb , into one dataset how i can do it .
I have used file balancing for merging two different length file based on key.
But here i just want one consolidated dataset .

Re: Merge 50+ files of different length

PostPosted: Wed Jun 15, 2011 11:16 pm
by Robert Sample
Since you posted in the COBOL forum, are you planning on combining 50+ files in a COBOL program?

Many times it is NOT a good idea to combine data like this, since the record lengths can help identify the data source. Why do you think you need to create one file out of 50+?

Furthermore, you are quite lacking in details -- are you wanting the output file to be fixed length or variable length? If fixed length, are you using the length of the longest record of the 50+ files or are you planning on truncating some of the records? Do all 50+ files have some form of record identifier to distinguish them, especially if two or more of the files have the same length records? If not, how will you tell the records apart when reading them in the future? Are the record formats all in the same location or do you need to standardize them as part of the copy process? Are all of the record identifiers unique or will have you to change some of them to be unique as you copy the data? How many records are in each file? Are you wanting to combine all 50+ files in one job step or are you running multiple job steps to combine the records -- and if so, what are you using the seperate the various records into job steps? When you say 50+, do you mean 51 or 2521 -- the number of files does make a difference!

And on and on and on ... there are many, many questions you have not even BEGUN to answer before we could provide any assistance.

Re: Merge 50+ files of different length

PostPosted: Thu Jun 16, 2011 2:31 am
by NicC
Maybe he wants to back them up as with ADRDSSU = that is my phsycic bit for the day and as I am not well it is probably a wild stab in the dark.

Re: Merge 50+ files of different length

PostPosted: Thu Jun 16, 2011 3:08 am
by dick scherrer
Hello,

Sounds like the first experiment was actually a merge by some key values.

How would a merged file as you describe be used? What code would read this?

How much data is involved?

As you have posted nothing for us to work with, i'll make a suggestion anyway. . .

In this new output file make sure the records each have a "file indicator" and "data length" as the first 2 fields. Then a group field for the content of the individual file's records. Sort this new output file by the key field(s) used to accomplish the 2-file merge. Now the data is all "merged".

Re: Merge 50+ files of different length

PostPosted: Fri Jun 17, 2011 2:14 am
by ritikasingh
Thans guys.. Sorry for not giving the detail requirement.
Actually in my application i am writing discarded records in to flat files.All these flat files will be of different length.
As a part of support i want to send an alert along with the discarded records ..so if i can put all this 50 datasets into one, i can send one dataset in alert email through mainframe, also i dont have to check all the 50 datasets individually that are there any rejects.

Dick, i am not clear withthe explanation if possible can you please explain again.

Thanks a lot once again..

Cheers!!
Ritika.

Re: Merge 50+ files of different length

PostPosted: Fri Jun 17, 2011 2:29 am
by dick scherrer
Hello,

Well, first - is there some common key that the output needs to be in order by? If not, merge is most likely not what you want.

If you want to create a file that contains all of the discards combined into a singlr file, you could use a program that reads each of these one at a time and copies the discards to a new VB output file. The records in the VB file would have a file-name/identifier, datalength, and the actual data as records. Using this method would also allow writing a "NO DISCARDS" entry for any of the files that had no discards this execution.