Hello guys,
I have a couple of files that I am using as input for this small process.
Not sure it is important but the files have different record length and the key is positioned at different record location.
I would like to get three output files out of this sort.
however, I have not understood basically the JOIN statement.
I would like to get three output files
1) Unpaired records from infile 1.
2) Unpaired records from infile 2.
3) Paired records
So, the question is what should I change in Join Statement to create this three files?
here is what I got thus far. It is working fine creating the first two files.
and am I suppose to know I can apply DFSORT and SYNCSORT examples interchangeably, too?
yes because your site should give you a manual to look for and if they don't give you then you can give try as it hardly takes 1 minute to know if it supports or not and if you hit any issues then post it back for other solutions but usually SYNCSORT supports most of the DFSORT features and you will know that only if you do little research and try.
Since that time when the mentioned example was introduced an improvement has been done to SORT utility. So, that example can be simplified for clarity as follows.
Code:
* Control statements for JOINKEYS application
JOINKEYS F1=INFILE1, refer to the first DDNAME
FIELDS=(1,10,A),
SORTED,NOSEQCK
JOINKEYS F2=INFILE2, refer to the second DDNAME
FIELDS=(7,10,A),
SORTED,NOSEQCK
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:1,14,
F2:1,20,
?) indicator: '1', '2', or 'B'
* Control statements for main task (joined records)
OPTION COPY
OUTFIL FNAMES=F1ONLY,
INCLUDE=(35,1,CH,EQ,C'1'),
BUILD=(1,14)
OUTFIL FNAMES=F2ONLY,
INCLUDE=(35,1,CH,EQ,C'2'),
BUILD=(15,20)
OUTFIL FNAMES=BOTH,
SAVE, everything not selected above yet
BUILD=(1,14,
/,15,20)
END
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
migusd wrote:
So, the question is what should I change in Join Statement to create this three files?
JOIN UNPAIRED,ONLY gives only the non-matching records from both the input data sets. If you change it to 'JOIN UNPAIRED' OR 'JOIN UNPAIRED,F1,F2', it would give you the matching records as well, besides the non-matching records.
As pointed out already, the match marker (?) is a better way of identifying if there is a match or not.
Use 'SORTED' in the JOINKEYS if you know for sure that the input data sets are already in sorted order of the keys. Use 'NOSEQCK' in the JOINKEYS if you don't want the sort product to validate the key sequence for you.
Incidentally, SYNCTOOL ships with SYNCSORT, and most ICETOOL commands work there.
(Which is a good thing because there is no documentation for SyncTool)