|
View previous topic :: View next topic
|
| Author |
Message |
migusd
New User
Joined: 08 Aug 2014 Posts: 44 Location: USA
|
|
|
|
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.
| Code: |
JOINKEYS FILE=F1,FIELDS=(10,07,A)
JOINKEYS FILE=F2,FIELDS=(07,07,A)
JOIN UNPAIRED,ONLY
REFORMAT FIELDS=(F1:1,80,F2:1,25),FILL=X'FF'
SORT FIELDS=COPY
OUTFIL FILES=1,
INCLUDE(81,1,BI,EQ,X'FF'),
OUTREC=(1:1,80)
OUTFIL FILES=2,
INCLUDE(1,1,BI,EQ,X'FF'),
OUTREC=(1:81,25)
|
|
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3112 Location: NYC,USA
|
|
| Back to top |
|
 |
migusd
New User
Joined: 08 Aug 2014 Posts: 44 Location: USA
|
|
|
|
and am I suppose to know I can apply DFSORT and SYNCSORT examples interchangeably, too?
Thanks anyway Rohit |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3112 Location: NYC,USA
|
|
|
|
| Quote: |
| 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. |
|
| Back to top |
|
 |
migusd
New User
Joined: 08 Aug 2014 Posts: 44 Location: USA
|
|
|
|
| thank you for taking the time to respond, Rohit. |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2288 Location: USA
|
|
|
|
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 |
|
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 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.
Good luck. |
|
| Back to top |
|
 |
Marso
REXX Moderator

Joined: 13 Mar 2006 Posts: 1356 Location: Israel
|
|
|
|
Incidentally, SYNCTOOL ships with SYNCSORT, and most ICETOOL commands work there.
(Which is a good thing because there is no documentation for SyncTool) |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|