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
 
compare two files

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

New User


Joined: 24 Sep 2009
Posts: 2
Location: chennai

PostPosted: Tue Sep 29, 2009 9:05 pm    Post subject: compare two files
Reply with quote

Hi,

I have compared two files(file1 & file2) and wrote the matched records in an sepearte file. Now adding to this i need to do write an unmatched records in seperate file and compare those records with file1 in next run of the job. Each time the job runs the files(file1 & file2) input will be changed.

can any one please help me in cobol part of this prg ?

Eg
file1 - cust file
file2 - addr file

both have common cust no.

i have sorted with that key

read cust file into cust rec
read addr file into addr-rec

if cust-no < ad-cust-no
display ' no match addr recd for custno'
if cust-no > ad-cust-no
display 'no custno match for ad-custno'
move cust-rec to out-rec

i m writing my output file. ths s my actual code .

how to change this accoring to my requirement?
Back to top
View user's profile Send private message

Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Sep 30, 2009 4:38 pm    Post subject:
Reply with quote

There is a "sticky" in the "Mainframe COBOL" part of the Forum (2-File Match/Merge sample code) -- unload(download?) that, please have a look there and make changes accroding to that. If you get stuck, please post us back with what you've tried and what error did you get.
Back to top
View user's profile Send private message
mambopras

New User


Joined: 11 Nov 2008
Posts: 52
Location: Hyderabad

PostPosted: Wed Sep 30, 2009 9:18 pm    Post subject: compare two files
Reply with quote

Hi Saravanan,
i am giving a try at the requirement u have. But we need to know unmatched form which file should be written..file1 or file2? Assuming it to be file1 i am giving u the code.

Note :Both file 1 and file 2 should be sorted before coming to this program. The the below logic might work

if cust-no < ad-cust no
Read File1
Write un-matched-rec from cust-rec
Else
If cust-no > ad-cust-no
Read file2
Else
If cust-no = ad-cust-no
Write matched-rec from cust-rec
Read file1
end-if
end-if
end-if.
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: Wed Sep 30, 2009 9:41 pm    Post subject:
Reply with quote

Hello,

Quote:
The the below logic might work
And it might not. . . (Won't, i believe)

Please post only solutions that have been comprehensively tested. . .
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Thu Oct 01, 2009 2:16 pm    Post subject:
Reply with quote

you'll need to read file2 as well when matched.
and then the code will only work when each cust-no is unique in both files.
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 Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm
No new posts compare 2 rows within the same file ram_vizag SYNCSORT 7 Wed Jun 14, 2017 12:34 am

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