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

File matching (1:1) using Joinkeys


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
neopandya

New User


Joined: 02 Mar 2010
Posts: 8
Location: Bangalore

PostPosted: Thu Nov 25, 2010 5:22 pm
Reply with quote

Hi,

I have a requirement wherein I am trying to do a 1:1 file match using JOINKEYS.

File1 - lrecl (8)
Code:

11111xxx
22222ddd
33333bbb
44444bbb


File2 - lrecl (8)
Code:

11111xxx
11111yyy
22222ddd
33333ggg
33333bbb
55555yyy


Expected Output - lrecl 8
Code:

11111xxx
22222ddd
33333bbb


The below code helps me perform a N:N file match, but I was not able figure out how to perform a 1:1 file match.
I would also like to know how to perform a 1:N file match using JOINKEYS.

Code I used for N:N file match -
Code:

JOINKEYS FILE=F1,FIELDS=(1,7,A)         
JOINKEYS FILE=F2,FIELDS=(1,7,A)     
REFORMAT FIELDS=(F2:1,8)           
OPTION COPY                                   
OUTFIL FNAMES=FINAL                           


Can somebody please advice regarding 1:1 and 1:N file matching using JOINKEYS?
Back to top
View user's profile Send private message
neopandya

New User


Joined: 02 Mar 2010
Posts: 8
Location: Bangalore

PostPosted: Thu Nov 25, 2010 5:41 pm
Reply with quote

Made a mistake in my expected output
Code:

11111xxx
22222ddd
33333ggg
Back to top
View user's profile Send private message
nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Fri Nov 26, 2010 11:59 am
Reply with quote

Hi Neo,

File1 does not contain the record 33333ggg. Then how can you expect to get that record in your output file?
The Below Control card will you the expected out put of your initial post.
Code:
JOINKEYS FILES=F1,FIELDS=(1,7,A)                     
JOINKEYS FILES=F2,FIELDS=(1,7,A)                     
JOIN UNPAIRED                                         
REFORMAT FIELDS=(F1:1,8,?,F2:1,8)                     
OPTION COPY                                           
OUTFIL FNAMES=OUT,INCLUDE=(9,1,CH,EQ,C'B'),BUILD=(1,8)

OUTPUT:
Code:
11111XXX
22222DDD
33333BBB

If you want more help, give us better and clear example with the rules to achieve it.
Back to top
View user's profile Send private message
neopandya

New User


Joined: 02 Mar 2010
Posts: 8
Location: Bangalore

PostPosted: Sat Dec 04, 2010 2:58 pm
Reply with quote

Hi Nelson,

Apologies for the confusion with my examples. Let me try to state my requirement again, with a different example.

Input1 (lrecl=10, Key=1,5)
Code:

11111FILE1
22222FILE1
33333FILE1
55555FILE1


Input2 (lrecl=10, Key=1,5)
Code:

11111FILE2
11111FILE2
22222FILE2
33333FILE2
33333FILE2
44444FILE2


Expected Output (lrecl=10)
Code:

11111FILE1
22222FILE1
33333FILE1
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Dec 07, 2010 12:20 am
Reply with quote

Here's a DFSORT JOINKEYS job that do what you asked for. From your examples, I'm assuming that input file1 does not have duplicates and input file2 does have duplicates, and you want the matching input file1 records as output.

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/10)
//IN2 DD DSN=...  input file2 (FB/10)
//FINAL DD DSN=...  ouput file (FB/10)
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(1,5,A)
  JOINKEYS F2=IN2,FIELDS=(1,5,A)
  REFORMAT FIELDS=(F1:1,10)
  OPTION COPY
  OUTFIL FNAMES=FINAL
/*
//JNF2CNTL DD *
  SUM FIELDS=NONE
/*
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top