Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Merge in Cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Merge in Cobol
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: 2150
Location: At my coffee table

PostPosted: Sun Jun 13, 2010 11:40 am    Post subject:
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

Site Director


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

PostPosted: Sun Jun 13, 2010 11:47 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts COBOL DB2 program - zIIP eligible vasanthz COBOL Programming 7 Wed May 31, 2017 5:12 am
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us