Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us