|
View previous topic :: View next topic
|
| Author |
Message |
neopandya
New User
Joined: 02 Mar 2010 Posts: 8 Location: Bangalore
|
|
|
|
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 |
|
 |
neopandya
New User
Joined: 02 Mar 2010 Posts: 8 Location: Bangalore
|
|
|
|
Made a mistake in my expected output
| Code: |
11111xxx
22222ddd
33333ggg
|
|
|
| Back to top |
|
 |
nelson.pandian
Active User
.jpg)
Joined: 09 Apr 2008 Posts: 133 Location: Phoenix, AZ
|
|
|
|
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 |
|
 |
neopandya
New User
Joined: 02 Mar 2010 Posts: 8 Location: Bangalore
|
|
|
|
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 |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|