|
View previous topic :: View next topic
|
| Author |
Message |
sandip_mainframe Warnings : 2 New User

Joined: 20 Sep 2006 Posts: 63 Location: pune
|
|
|
|
Hi All,
Good Afternoon !
I am using DFSORT tool to compare two input files.
I want to match records using different conditions and output should be written in three output files.
I used three different steps to get results but I think it is not wise solution. I am not looking for matching records but interested in non matching records.
NOTE: Records should be compared on
RECORD-TYP1 PIC X(04) Starting position is 01. (1111, 2222, 3333, 4444, 5555 and so on)
| Code: |
//SORTJNF1 DD * (Data is not in sorted order and contains duplicate records for both FILE1 and FILE2)
3333 ROUTE PUNE TO MUMBAI
4444 EMPLOYEE STRENGTH IS 200
1111 21100 SANDIP
1111 33000 AKASH
2222 PUNE FINANCE
2222 MUMBAI FINANCE
2222 KOLKATA SALES
//SORTJNF1 DD *
2222 CHENNAI FINANCE
2222 NAGPUR PRODUCTION
1111 21000 SANDIP
1111 22000 MAHESH
3333 ROUTE HYDERBAD TO SHIMLA
3333 ROUTE PUNE TO MUMBAI
5555 SOME RANDOM DATA
4444 EMPLOYEE STRENGTH IS 200
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(06,05,A) IF RECORD-TYPE='1111'
(14,10,A) IF RECORD-TYPE='2222'
(01,80,A) IF RECORD-TYPE NOT = ('1111' OR '2222')
JOINKEYS FILE=F2,FIELDS=(06,05,A) IF RECORD-TYPE='1111'
(12,10,A) IF RECORD-TYPE='2222'
(01,80,A) IF RECORD-TYPE NOT = ('1111' OR '2222')
|
(I am not sure how to give above three different condition is JNF1CNTL and JNF2CNTL, I just know to provide one condition like INCLUDE COND=(01,04,CH,EQ,C'1111') )
| Code: |
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:01,80,F2:01,80,?)
SORT FIELDS=COPY
OUTFIL FNAMES=MATCH,
INCLUDE COND=(161,001,CH,EQ,C'B'),
BUILD=(01,80)
OUTFIL FNAMES=NOMCH1,
INCLUDE COND=(161,001,CH,EQ,C'1'),
BUILD=(01,80)
OUTFIL FNAMES=NOMCH2,
INCLUDE COND=(161,001,CH,EQ,C'2'),
BUILD=(01,80)
//*
|
FILE1 LRECL=80,RECFM=FB
FILE2 LRECL=80,RECFM=FB
MATCH LRECL=80,RECFM=FB (Matching Records)
NOMCH1 LRECL=80,RECFM=FB (Non Matching records from FILE1)
NOMCH2 LRECL=80,RECFM=FB (Non Matching records from FILE2)
OUTPUT Should look as below:
| Code: |
MATCH:
1111 21100 SANDIP
2222 PUNE FINANCE
2222 MUMBAI FINANCE
4444 EMPLOYEE STRENGTH IS 200
NOMCH1:
1111 33000 AKASH
2222 KOLKATA SALES
NOMCH2:
2222 NAGPUR PRODUCTION
1111 22000 MAHESH
3333 ROUTE HYDERBAD TO SHIMLA
5555 SOME RANDOM DATA |
Thanks & Regards,
Sandip Walsinge |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3108 Location: NYC,USA
|
|
|
|
This should work.
| Code: |
JOINKEYS FILE=F1,FIELDS=(06,05,A) IF RECORD-TYPE='1111'
(14,10,A) IF RECORD-TYPE='2222'
(01,80,A) IF RECORD-TYPE NOT = ('1111' OR '2222') |
You can do this in JNF1CNTL and JNF2CNTL by using
| Code: |
INREC IFTHEN ( Cond1) , Overlay=(81:1,4),
IFTHEN ( Cond2) , Overlay=(81:1,80) |
and then use below in the actual JOINKEYS operation in the main task.
| Code: |
| JOINKEYS FILE=F1,FIELDS=(81,80,A) |
|
|
| Back to top |
|
 |
sandip_mainframe Warnings : 2 New User

Joined: 20 Sep 2006 Posts: 63 Location: pune
|
|
|
|
Hi Rohit,
Good Morning !
The solution provided by you is working successfully. :-) Thank you very much. Sorry for the delay in reply.
Thanks,
Sandip Walsinge |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3108 Location: NYC,USA
|
|
|
|
| Welcome Sandip! |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|