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
 

 

Move records if inputfile1's record match with inputfile2's

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
LinkinPark
Warnings : 1

New User


Joined: 20 Nov 2005
Posts: 44
Location: DALIAN,CHINA

PostPosted: Fri Aug 31, 2007 6:57 am    Post subject: Move records if inputfile1's record match with inputfile2's
Reply with quote

Hi all,

If there r 2 files,

1st file records are(named inputfile1):
1
3
5

2nd file records are(named inputfile2): :
1
2
4
5
7
8

Can anybody show me how to code below requirement ?
1) if inputfile1's record match with inputfile2's record, move record to output file1
2) if records only included in inputfile1, move record to output file2
2) if records only included in putfile2, move record to output file3
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: Fri Aug 31, 2007 7:43 am    Post subject:
Reply with quote

Hello,

What you describe is a 2-file match/merge. If you look at the "Sticky" near the top of this COBOL forum, there is sample code you can download.

If, after downloading the sample code, yoj have questions, post them here.

You will need to customize the code depending on your specific requirement.
Back to top
View user's profile Send private message
LinkinPark
Warnings : 1

New User


Joined: 20 Nov 2005
Posts: 44
Location: DALIAN,CHINA

PostPosted: Fri Aug 31, 2007 12:54 pm    Post subject:
Reply with quote

I've go thru the code u mentioned,
but it seems just 1st requriement implemented,
how abt requirement 2) and 3),
What I wanna do is implement above 3 requriements in just one procedure or a program, just open/close all file onetime! icon_biggrin.gif
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: Fri Aug 31, 2007 2:57 pm    Post subject:
Reply with quote

That's the neat thing about programming, you can change and/or add logic to do whatever you want....
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: Fri Aug 31, 2007 7:04 pm    Post subject:
Reply with quote

Hello,

Quote:
You will need to customize the code depending on your specific requirement.
If you add just the smallest bit of code to the example, you will meet all of your requirements.

The "match" is what you really needed guidance on. The rest is just some simple open, move, write, & close statements. There should remain only 1 procedure. 1 open/close, and the files passed 1 time.

If you get stuck, post what you have done and where you have a question and someone here will be able to help.
Back to top
View user's profile Send private message
LinkinPark
Warnings : 1

New User


Joined: 20 Nov 2005
Posts: 44
Location: DALIAN,CHINA

PostPosted: Sat Sep 01, 2007 4:29 am    Post subject:
Reply with quote

Hi ,

As my understanding, it works well.but what about below 2 files.
1st file records are(named inputfile1):
1
3
3
5
5
6
6
9
9

2nd file records are(named inputfile2):
1
2
4
5
5
5
5
7
8

Above 2 files with duplicate key.

requirement :
1) if inputfile1's record match with inputfile2's record, move record to output file1 , ( 1 to n matched).
2) if records only included in inputfile1, move record to output file2
2) if records only included in putfile2, move record to output file3
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: Sat Sep 01, 2007 7:18 am    Post subject:
Reply with quote

Hello,

Duplicate keys in either or both files will be handled by the code.

In the simplest case, the first of each duplicate is processed like any other match and the code continues.

Before you can implement any code you have to formalize the "rules" for your process. We can't help with the rule definition - that is based on your particular requirement.

In your example data there are two 5's (let's call them 5a and 5b) in file 1 and 4 5's in file2 (let's call them 5w, 5x 5y, and 5z). Which ones should go to which output file(s)?

Before you can implement a COBOL (or any other) solution, you must completely define what is to happen for each and every condition.

Notice that when you posted your second set of data, you added "new rules". Before writing code, you will need to define everything that the code is to support.
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 Record Not found in AlX but record re... mukun264 COBOL Programming 7 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am


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