IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

getting three output files out of JOINKEYs


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
migusd

New User


Joined: 08 Aug 2014
Posts: 31
Location: USA

PostPosted: Mon Jun 05, 2017 11:30 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2572
Location: NYC,USA

PostPosted: Tue Jun 06, 2017 12:33 am
Reply with quote

You could research it yourself next time.
Example 6 - Paired and unpaired F1/F2 records
Back to top
View user's profile Send private message
migusd

New User


Joined: 08 Aug 2014
Posts: 31
Location: USA

PostPosted: Tue Jun 06, 2017 1:10 am
Reply with quote

and am I suppose to know I can apply DFSORT and SYNCSORT examples interchangeably, too?
Thanks anyway Rohit
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2572
Location: NYC,USA

PostPosted: Tue Jun 06, 2017 1:13 am
Reply with quote

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
View user's profile Send private message
migusd

New User


Joined: 08 Aug 2014
Posts: 31
Location: USA

PostPosted: Tue Jun 06, 2017 1:24 am
Reply with quote

thank you for taking the time to respond, Rohit.
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 932
Location: Maryland

PostPosted: Wed Jul 12, 2017 1:46 am
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Jul 12, 2017 7:42 pm
Reply with quote

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
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1348
Location: Israel

PostPosted: Thu Jul 13, 2017 12:31 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts How can we simulate JOINKEYS in ICETOOL DFSORT/ICETOOL 9
This topic is locked: you cannot edit posts or make replies. Copy list of files from PS to another... CLIST & REXX 11
No new posts JOINKEYS to match two input files on ... DFSORT/ICETOOL 3
No new posts Group comparison/update between two f... DFSORT/ICETOOL 10
No new posts Need assistance formatting when joini... SYNCSORT 8
Search our Forums:

Back to Top