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 2 files & matched records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
jmreddymca
Warnings : 1

New User


Joined: 14 Oct 2007
Posts: 29
Location: Bangalore

PostPosted: Tue Nov 13, 2007 3:12 pm    Post subject: Compare 2 files & matched records
Reply with quote

Hi Friends,

i have 2 files , i want to match those 2 files & matched records i want write in the 3rd file . can you suggest me. i have written cobol program.
But is there any other way to do this
Back to top
View user's profile Send private message

Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Nov 13, 2007 3:28 pm    Post subject: Reply to: compare 2 files & matched recs write into 3rd
Reply with quote

jmreddy,

Quote:
But is there any other way to do this ??????????


This can be accomplished using SYNC/ICE tool. Do provide some more details so that we can help.

Your input, output, RECFM and all.

Else, search the DFSORT forum for similar topics.
Back to top
View user's profile Send private message
santhosh_kumar

New User


Joined: 31 May 2007
Posts: 4
Location: Chennai

PostPosted: Tue Nov 13, 2007 3:31 pm    Post subject: Re: compare 2 files & matched recs write into 3rd file
Reply with quote

You can use ICETOOL utility for the same.
Could you please provide some more information.
1. File property
2. Matching is done on what condition whether matching fields are at same position on both the files.
3. If fields are matched whether you are writing the matched records in both the input file to output file or any one to the output file.

Sweet,
Santhosh
Back to top
View user's profile Send private message
jmreddymca
Warnings : 1

New User


Joined: 14 Oct 2007
Posts: 29
Location: Bangalore

PostPosted: Tue Nov 13, 2007 4:04 pm    Post subject: hi
Reply with quote

i have 2 i/p files with FB 80 RECL
I want write that in o/p rec with same properties
file mathcing is done by starting 5 chars
matching records i want to write in 1 o/p fille
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Nov 13, 2007 4:06 pm    Post subject:
Reply with quote

Reddy,

Your orignial post and the latest almost conveys the same thing. As suggested, go thru dfsort forum..... it had been discussed many times.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Nov 13, 2007 4:14 pm    Post subject:
Reply with quote

Quote:
i have 2 files , i want to match those 2 files & matched records i want write in the 3rd file . can you suggest me

You can do this using DFSORT/ICETOOL or SYNCSORT/SYNCTOOL.
(mention as to what SORT product your are using?)
Provide the details of the file attributes and show some sample records from i/p and o/p.
Also, do you have duplicate reords in the i/p files? if so how it should be handled?
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Nov 14, 2007 8:22 am    Post subject:
Reply with quote

jmreddymca
This ICETOOL JCL works fine, if there are no duplicate records in either of your i/p files
Code:
//*******************************************************
//GETMATCH EXEC PGM=ICETOOL                             
//TOOLMSG  DD SYSOUT=*                                   
//DFSMSG   DD SYSOUT=*                                   
//IN       DD I/P FILE-1(FB/80)                         
//         DD I/P FILE-2 (FB/80)                         
//OUT      DD O/P FILE   (FB/80)                         
//TOOLIN   DD *                                         
 SELECT FROM(IN) TO(OUT) ON(1,5,CH) FIRSTDUP             
/*                                                       
//*                                                     
Back to top
View user's profile Send private message
Binaya

New User


Joined: 03 Jul 2007
Posts: 77
Location: Hyderabad

PostPosted: Wed Nov 14, 2007 10:19 am    Post subject:
Reply with quote

Hi Krisprems,

Just want to know what do you men by "duplicate records in either of your i/p files ".

suppose
INFILE-1:-->
AAAAA12345
AAAAA67896
BBBBB12356

INFILE2-2:--->
AAAAA56879
AAAAA54689
AAAAA12548

The output will be
AAAAA12345
BBBBB12356

Let me know if this is correct or not?
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Nov 14, 2007 10:30 am    Post subject: Reply to: compare 2 files & matched recs write into 3rd
Reply with quote

Binaya,

Quote:
Just want to know what do you men by "duplicate records in either of your i/p files ".



If there are duplicate records in file 1 then the sort card of prem would consider that as a matching record and write the first record of the duplicates to the output file 3.

That is not correct and hence Krsprems has assumed that there are no duplicates in the input files.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Nov 14, 2007 11:02 am    Post subject:
Reply with quote

Binaya
In my above ICETOOl JCL, you just provide your INFILE-1(do not concatenate with INFILE2-2), and see what o/p you will get....

The output will be....
AAAAA12345

So with out having the 2nd file for comparison also you are getting this record, this is because you have duplicate within one file itself!!
got it?
Back to top
View user's profile Send private message
Binaya

New User


Joined: 03 Jul 2007
Posts: 77
Location: Hyderabad

PostPosted: Wed Nov 14, 2007 11:52 am    Post subject:
Reply with quote

Yes krisprems..Got it..

But the original question was something different where two files has to be compared and to be written in the output file. This has been discussed earlier in this forum..

Thanks...
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Nov 14, 2007 12:12 pm    Post subject: Reply to: compare 2 files & matched recs write into 3rd
Reply with quote

Binaya,

Quote:
But the original question was something different where two files has to be compared and to be written in the output file.


no where it is mentioned abt the actual requirement. Take a look at the earlier posts on this topic where we have asked the exact details of the requirement from the OP. As details were not provided, this JCL was posted.

Even in that JCL, 2 files are compared. Two input files are provided in the IN dd statement. This will work fine when there are no duplicates in the input files.
Back to top
View user's profile Send private message
Binaya

New User


Joined: 03 Jul 2007
Posts: 77
Location: Hyderabad

PostPosted: Wed Nov 14, 2007 12:52 pm    Post subject:
Reply with quote

Aaru,

My JCL step is

//STEP1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//CON1 DD DSN=TBIS.IM.TEST.FILE5,DISP=SHR
// DD DSN=TBIS.IM.TEST.FILE6,DISP=SHR
//DUPS DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(CON1) TO(DUPS) ON(1,20,CH) FIRSTDUP
/*

FILE5:
33333333333333333333
33333333333333333333
88888888888888888888
44444444444444444444
11111111111111111111
55555555555555555555

FILE6:
55555555555555555555
22222222222222222222
33333333333333333333
99999999999999999999

output:
33333333333333333333
55555555555555555555

Pleae clarify?

Thanks..
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Nov 14, 2007 1:54 pm    Post subject: Reply to: compare 2 files & matched recs write into 3rd
Reply with quote

Binaya,

Quote:
Pleae clarify?


In your case, you have 2 files (file 5 with duplicate records and file 6 with unique values). You are concatenating it and selecting the first duplicate based on the values in the first 20 bytes.

You have 33333333 in the output as it is present more than once in the input files. The same case with 555555555.

The problem will arise if there are no 3333333333 in file 6. Your JCl would still write 333333333 in the output (even though it is not present in file6) as there are duplicates in the file5.

This is already explained in the previous posts. Please let me know if you are not convinced.
Back to top
View user's profile Send private message
Binaya

New User


Joined: 03 Jul 2007
Posts: 77
Location: Hyderabad

PostPosted: Wed Nov 14, 2007 2:22 pm    Post subject:
Reply with quote

Aaru,

Convinced..

Thanks
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm

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