IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Merge in Cobol


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nalini_s_in

New User


Joined: 05 Jun 2007
Posts: 5
Location: coimbatore

PostPosted: Sun Jun 13, 2010 11:25 am
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sun Jun 13, 2010 11:40 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Jun 13, 2010 11:47 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top