View previous topic :: View next topic
|
Author |
Message |
jmreddymca Warnings : 1 New User
Joined: 14 Oct 2007 Posts: 29 Location: Bangalore
|
|
|
|
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 |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
santhosh_kumar
New User
Joined: 31 May 2007 Posts: 4 Location: Chennai
|
|
|
|
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 |
|
|
jmreddymca Warnings : 1 New User
Joined: 14 Oct 2007 Posts: 29 Location: Bangalore
|
|
|
|
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
Binaya
New User
Joined: 03 Jul 2007 Posts: 77 Location: Hyderabad
|
|
|
|
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 |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
Binaya
New User
Joined: 03 Jul 2007 Posts: 77 Location: Hyderabad
|
|
|
|
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 |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
Binaya
New User
Joined: 03 Jul 2007 Posts: 77 Location: Hyderabad
|
|
|
|
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 |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Binaya,
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 |
|
|
Binaya
New User
Joined: 03 Jul 2007 Posts: 77 Location: Hyderabad
|
|
|
|
Aaru,
Convinced..
Thanks |
|
Back to top |
|
|
|