Merge 50+ files of different length



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Merge 50+ files of different length

Postby ritikasingh » Wed Jun 15, 2011 11:02 pm

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 .
ritikasingh
 
Posts: 39
Joined: Wed Sep 01, 2010 9:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merge 50+ files of different length

Postby Robert Sample » Wed Jun 15, 2011 11:16 pm

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.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Merge 50+ files of different length

Postby NicC » Thu Jun 16, 2011 2:31 am

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Merge 50+ files of different length

Postby dick scherrer » Thu Jun 16, 2011 3:08 am

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".
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Merge 50+ files of different length

Postby ritikasingh » Fri Jun 17, 2011 2:14 am

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.
ritikasingh
 
Posts: 39
Joined: Wed Sep 01, 2010 9:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merge 50+ files of different length

Postby dick scherrer » Fri Jun 17, 2011 2:29 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post