Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Two file match using JOINKEYS in SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
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    Post subject: Two file match using JOINKEYS in SORT
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Sun Jan 11, 2015 5:48 am    Post subject: Reply to: Two file match using JOINKEYS in SORT
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    Post subject: Reply to: Two file match using JOINKEYS in SORT
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Sun Jan 11, 2015 3:28 pm    Post subject: Reply to: Two file match using JOINKEYS in SORT
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Jan 12, 2015 4:15 am    Post subject: Reply to: Two file match using JOINKEYS in SORT
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    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us