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
 

 

File matching (1:1) using Joinkeys

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: File matching (1:1) using Joinkeys
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    Post subject:
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Tue Dec 07, 2010 12:20 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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