View previous topic :: View next topic
|
Author |
Message |
nalini_s_in
New User
Joined: 05 Jun 2007 Posts: 5 Location: coimbatore
|
|
|
|
Hi,
I need to merge these 2 files(File1 and File2).
Can anyone suggest how can it be done by a merge step?
File1:
00 000000<--- Header
01 111111
01 222222
01 333333
02 111111
02 333333
09 555555<---Trailer which contains the count of 01 and 02 type records
File2:
00 000000
01 333333
01 444444
02 444444
99 333333
I need the output as
00 000000
01 111111
01 222222
01 333333
02 111111
02 333333
01 333333
01 444444
02 444444
99 888888
Thanks
Nalni |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Why in COBOL?
Sort could do this in one simple pass....
An INREC to strip off headers and trailers followed by a sort (or merge if both files are in a key sequence) of the keys followed by a HEADER (because it is needed?) and TRAILER (to get the totals).
Again,Why in COBOL? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
What you want to do is not a "merge" in the typical sense. A merge is a process that reads 2 (or more) files that are in sequence by some key(s) and generates output based on processing rules.
Are both files the same recfm and lrecl?
As CG mentioned, this could be done with your sort product. If you proceed with cobol, post pseudo code of how you want your code to process. We can help if there are design issues and later with the actual code if you have questions or problems. |
|
Back to top |
|
|
|