View previous topic :: View next topic
|
Author |
Message |
umashankar pathak
New User
Joined: 14 Jun 2009 Posts: 13 Location: Bangalore(INDIA)
|
|
|
|
Hi,
I have one requirement to compare two files and write the records in output file when below condition satisfied.
File 1 : LREC == 200 FB
Keys to comapare :
Column-name start Length
========= ==== ======
file1-code 43 3
file1-fund 22 2
file1-date 24 8
file1-rev-date 142 8
---------------------------------------------------------
File 2 : LREC = = 150 FB
Keys to comapare :
Column-name start Length
========= ==== ======
file2-code 21 3
file2-fund 24 2
file2-date 103 8
Now I have to write all file2 records in output which satisfied below criteria:-
file1-code = file2-code and
file1-fund = file2-fund and
file1-date = file2-date and
file1-rev-date = zeroes
Can you please help me to write this using joinkey SORT.Thanks.
Regards,
Uma |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
There are a lot of examples here. Did you look at any? There is a forum search, and a more advanced search towards the top of the page.
Having three keys is not a problem. You should INCLUDE only those from file 1 with a zero date. If your input files are sorted, specify SORTED on the JOINKEYS. You won't need a JOIN statement. You can make a REFORMAT record just for F1. It'll be a very simple thing, you won't need anything extra. How you do the INCLUDE depends on your version of SyncSort. If you have JNFnCNTL files, best to do it there, else on the JOINKEYS statement itself.
Code: |
JOINKEYS ....
JOINKEYS ....
REFORMAT FIELDS=(F1:1,200) |
|
|
Back to top |
|
|
umashankar pathak
New User
Joined: 14 Jun 2009 Posts: 13 Location: Bangalore(INDIA)
|
|
|
|
Thanks Bill...I found the CARD and able to run my job for less data...
My only question is,I am doing this compare for really big files(50M records in both files) so is it good to use this or I can use the COBOL program ?
Can you please suggest me here ?
Thanks!
Uma |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Well, as always, the actual thing is to try it with your data. SORT IO is highly optimised. There is processing for the JOINKEYS. You need a COBOL program to test it against if you are concerned to demonstrate it. |
|
Back to top |
|
|
umashankar pathak
New User
Joined: 14 Jun 2009 Posts: 13 Location: Bangalore(INDIA)
|
|
|
|
Thanks Bill for quick response....
In two file match COBOL program I know both files has to be in SORTED order so my question is do I have to SORT both files before I write the joinkey or it will SORT the files ? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If the files are not already in order, they must be sorted. If they are already in order, then it is a bad idea to sort them.
JOINKEYS will, by default, SORT its file on the keys specified on the statement. So if the data is not in order, you don't need to do anything.
If the data is in order, you specify SORTED on the JOINKEYS statement so that the data isn't sorted "again". |
|
Back to top |
|
|
|