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

Two file match ( two Input file dupilcates)


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

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Wed Jul 11, 2007 12:52 pm
Reply with quote

Hi,

Please help me out
I want to write two file match program but may be dupilcate in both input file Please suggest any idia or sample cobol program
Back to top
View user's profile Send private message
a027412

New User


Joined: 05 Jul 2007
Posts: 40
Location: Minneapolis, MN

PostPosted: Wed Jul 11, 2007 1:06 pm
Reply with quote

Hi,
this can also be done in EZTRIEVE (with very LOC). Please let me know if you need sample code. icon_cool.gif
Back to top
View user's profile Send private message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Wed Jul 11, 2007 1:24 pm
Reply with quote

Thanks for the information

I want write only cobol program
Back to top
View user's profile Send private message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Wed Jul 11, 2007 1:46 pm
Reply with quote

vicky10001,

Why don't you remove duplicates of both the files using sort JCL and pass those files to your COBOL program. This way you don't have to handle duplicates in either of the files.

--Parag
Back to top
View user's profile Send private message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Wed Jul 11, 2007 2:21 pm
Reply with quote

Hi,

We need to process dupicates record after that we have to some manipuation.
Back to top
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Wed Jul 11, 2007 6:00 pm
Reply with quote

hi we can do this by using ezyrtrive programme

in this program(jcl)

step1-sort the both input files in one order

stet2 --use this ezyretrive program

here this programmes gives two output files
ouptput1: contains the match records

output2:contains contains the unmatch recods
Back to top
View user's profile Send private message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Wed Jul 11, 2007 6:09 pm
Reply with quote

Thanks for the information

I want do only duplicate records and should be cobol program

example

file1
101
101
102
103
103

file2

101
101
101
102
103
104
104

finaly i should take file 1 and file2 same claim and its matching claim fil1 and file2 I need to amt calcuation even duplicaties also

Q)

How do matching and calculation


Please give me any sample program
Back to top
View user's profile Send private message
MGayathri

New User


Joined: 19 May 2007
Posts: 25
Location: Chennai

PostPosted: Wed Jul 11, 2007 11:02 pm
Reply with quote

Hi Vicky,
Please clarify.. Is the File1 main file and File2 used as a lookup.
If so, I think you can use this simple logic.

Read a record in file1.
Read a record in file2.
Do the following until e-o-file1.
{
=>If file1-key = file2-key
Do the calculation & write out.
Read file-1 until diff key is fetched and write out each record with
the same calculated value.
==>else if file1-key < file2-key
no matching file2-record found so, no calculation, write out.
Read file1-key
==>else
Read file2-key.
}

Sorry if it didnt help.
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: Wed Jul 11, 2007 11:45 pm
Reply with quote

Hello Vicky,

Please post what the output should be from your input.

Also, please explain how the duplicates are to be resolved between files. For example, if there are 7 entries in file1 and 5 in file2 for the same "key" which are considered "matched" and which are "unmatched"?
Back to top
View user's profile Send private message
nagasri83

New User


Joined: 20 May 2005
Posts: 15
Location: chennai

PostPosted: Thu Jul 12, 2007 4:56 am
Reply with quote

Quote:

example

file1
101
101
102
103
103

file2

101
101
101
102
103
104
104

finaly i should take file 1 and file2 same claim and its matching claim fil1 and file2 I need to amt calcuation even duplicaties also

Q)

How do matching and calculation


This is not clear, can you explain this a bit more clear so that I can help u?
Back to top
View user's profile Send private message
sasikumar1984

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Thu Jul 12, 2007 6:49 am
Reply with quote

Hi Vicky,

follow these steps..

1. first sort both the file with Num. ex: 101,102,103 etc.
2. get record from file-1, check whether this num is available in file-2, then move that calculated-amt and the number to local variables.
3. then read second record in file-1, compare the number with previous number which u moved to local variable, if it same then check this number in file-2, if available then add the calculated-amt = calculated -amt + current-recor-calculated amt... do this until ur check for number is not equal to current-record-number in file-1. then move the values...

its easy only yaa,,,, even i was looking for matching program, but mine is big requirement...
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 Jul 12, 2007 8:12 am
Reply with quote

Hello,

There is a 2-file match/merge example program posted in this cobol section. It is the "sticky" near the top of the topic list.
Back to top
View user's profile Send private message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Thu Jul 12, 2007 2:40 pm
Reply with quote

Thanks all

File1
100
100
101
101
102

File2
100
100
100
101
102
103
103


Matched output

100
101
102

but before write o/p need to calculate amt field in file1 and calculate amt field in file2 then need to validate after only need to move match file

I thinking that need to do

1.read file1
2. read file2

3. record match then need to move cobol table file1 records and file2 records also need to move table2 and check next file1 records that is also match need to move table 1 and like table 2.

Could Please provide some example cobol program .
Please check my requirement and Please suggest some idea also
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 Jul 12, 2007 7:35 pm
Reply with quote

Hello Vicky,

Read my previous reply - it tells you where to obtain such a sample. . . .
Back to top
View user's profile Send private message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Fri Jul 13, 2007 7:41 pm
Reply with quote

Dick scherrer,

I have searched Topic. I can't found out with duplicate two-file match.

I need to do process only duplicate only.

In duplicate record How to do Two-file match
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 Jul 13, 2007 11:46 pm
Reply with quote

Hello Vicky,

If you start on the main page of the forum, click on Mainframe COBOL, and look at the topics listed, there is a "Sticky" near the top of the list.

If you then click on that Sitcky, it has a small 2-file match program attached as a text file. That code (probably with minor modification) will do what you want.

Download that example, put it on your system, and make the changes as required by your requirement - the main changes needed will be for your record format(s) and any logic specific to your data.

Once you have done this, post back here if you have any questions.
Back to top
View user's profile Send private message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Mon Jul 16, 2007 11:18 am
Reply with quote

d.sch,

Thanks for the informaion
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: Mon Jul 16, 2007 6:58 pm
Reply with quote

You're welcome icon_smile.gif

We're here if there are questions.
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 TRIM everything from input, output co... DFSORT/ICETOOL 1
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top