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

File merging in COBOL


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

New User


Joined: 22 Sep 2010
Posts: 9
Location: India

PostPosted: Thu Jan 06, 2011 6:18 pm
Reply with quote

Please read the following sample data for master file and transaction file and advise me on this issue.

file 1 is master file and file2 is transaction file. I would like to merge two files based on the account number but I want duplicate records from transaction file.

file 1

SNO ACCNUM
1 100
2 101
3 102
4 103


file 2

ACCNUM AMOUNT DATE
100 200 1/1/2010
101 321 2/2/2010
101 400 2/2/2010
102 700 3/2/2010


output

sno accnum amount date
1 100 200 1/1/2010
2 101 321 2/2/2010
3 400 2/2/2010
4 102 700 3/2/2010
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu Jan 06, 2011 7:58 pm
Reply with quote

Other than what appears to be a typo in your output example, this seems to be a relatively simple process. I don't understand what you're asking for assistance on?
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: Thu Jan 06, 2011 9:30 pm
Reply with quote

Hello,

Sort both files on accnum and then download the sample 2-file match/merge code from the "Sticky" at the top of this COBOL part of the forum.

With minor modification, the sample code will do what you want.

Possibly i misunderstand what you are looking for. . .
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: Fri Jan 07, 2011 11:34 am
Reply with quote

Hello,

You need to sort the files before using the match/merge code. . .

The code in the "Sticky" has handled more than 500 million records. . . Why do you believe the code would be different for larger or smaller volumes of data?
Back to top
View user's profile Send private message
kumar32149

New User


Joined: 22 Sep 2010
Posts: 9
Location: India

PostPosted: Fri Jan 07, 2011 4:27 pm
Reply with quote

sorry for wrong question actually i should achive this without SORT Utility
am asking cobol logic for this
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: Fri Jan 07, 2011 8:12 pm
Reply with quote

Hello,

You are going to have an ugly experience in IT if you do not learn to read what you have been given and apply this. . .

I told you where to find the COBOL code to do this. Just download it (right-click save-as), modify for your specifics, and run it. . .
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: Fri Jan 07, 2011 8:14 pm
Reply with quote

Follow on:

We have a spearate forum for Students & Freshers that may be more suited to your level of experience.

www.ibmmainframeforum.com/index.php
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
Search our Forums:

Back to Top