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

Two file match using JOINKEYS in SORT


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
umashankar pathak

New User


Joined: 14 Jun 2009
Posts: 13
Location: Bangalore(INDIA)

PostPosted: Sun Jan 11, 2015 5:28 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Sun Jan 11, 2015 5:48 am
Reply with quote

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
View user's profile Send private message
umashankar pathak

New User


Joined: 14 Jun 2009
Posts: 13
Location: Bangalore(INDIA)

PostPosted: Sun Jan 11, 2015 8:42 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Sun Jan 11, 2015 3:28 pm
Reply with quote

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
View user's profile Send private message
umashankar pathak

New User


Joined: 14 Jun 2009
Posts: 13
Location: Bangalore(INDIA)

PostPosted: Mon Jan 12, 2015 2:34 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Mon Jan 12, 2015 4:15 am
Reply with quote

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
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts How can we simulate JOINKEYS in ICETOOL DFSORT/ICETOOL 8
No new posts Date conversion using SORT SYNCSORT 4
No new posts Converting a file from PD to display ... SYNCSORT 4
No new posts Record count of RECFM=U tape file DFSORT/ICETOOL 17
No new posts Which SORT utility can improve the Pe... DFSORT/ICETOOL 16
Search our Forums:

Back to Top