Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
JOINKEYS Paired and Unpaired Sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
MFwhiz

New User


Joined: 21 May 2009
Posts: 5
Location: Philadelphia

PostPosted: Fri Sep 29, 2017 1:48 am    Post subject: JOINKEYS Paired and Unpaired Sort
Reply with quote

Hello,

I'm doing a sort just like the one described in the IBM DFSORT JOINKEYS example #5:

LINK

I have two input files (both have the same file format). The sort creates three output files; with paired file1/file2 records, unpaired file1 records and unpaired file2 records.

The sort runs and populates all 3 output files. However, the numbers don't add up. I would expect (Input1 + Input2 = Output1 + Output2 + Output3). I would think each input record would only go to one output file. However, the total of the 3 output files is slightly higher than the total of the 2 input files. Am I missing something with my understanding of how this works? Why would this be happening? My JCL and results from sorting are below. Thanks in advance for the help.


//JKE5 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DSN=TCK401.INPUT1,DISP=SHR
//SORTJNF2 DD DSN=TCK401.INPUT2,DISP=SHR
//YESONLY DD DSN=TCK401.MAS.YESONLY,
// UNIT=(SYSDA,4),SPACE=(CYL,(100,60),RLSE),
// DISP=(NEW,CATLG,CATLG),
// DCB=(RECFM=FB,LRECL=4235,BLKSIZE=0)
//TODONLY DD DSN=TCK401.MAS.TODONLY,
// UNIT=(SYSDA,4),SPACE=(CYL,(100,60),RLSE),
// DISP=(NEW,CATLG,CATLG),
// DCB=(RECFM=FB,LRECL=4235,BLKSIZE=0)
//BOTH DD DSN=TCK401.MAS.BOTH,
// UNIT=(SYSDA,4),SPACE=(CYL,(100,60),RLSE),
// DISP=(NEW,CATLG,CATLG),
// DCB=(RECFM=FB,LRECL=4235,BLKSIZE=0)
//SYSIN DD *
* CONTROL STATEMENTS FOR JOINKEYS APPLICATION
JOINKEYS FILE=F1,FIELDS=(1,80,A),SORTED,NOSEQCK
JOINKEYS FILE=F2,FIELDS=(1,80,A),SORTED,NOSEQCK
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:1,4235,F2:1,4235,?)
* CONTROL STATEMENTS FOR MAIN TASK (JOINED RECORDS)
OPTION COPY
OUTFIL FNAMES=YESONLY,INCLUDE=(8471,1,CH,EQ,C'1'),
BUILD=(1,4235)
OUTFIL FNAMES=TODONLY,INCLUDE=(8471,1,CH,EQ,C'2'),
BUILD=(4236,4235)
OUTFIL FNAMES=BOTH,INCLUDE=(8471,1,CH,EQ,C'B'),
BUILD=(1,4235,/,4236,4235)
/*

File Quantity Analysis:

TCK401.INPUT1 - 33965
TCK401.INPUT2 - 34508
Total: 68473

TCK401.MAS.BOTH - 67842
TCK401.MAS.YESONLY - 62
TCK401.MAS.TODONLY - 605
Total: 68509

Difference of 36??
Back to top
View user's profile Send private message

RahulG31

Active User


Joined: 20 Dec 2014
Posts: 411
Location: USA

PostPosted: Fri Sep 29, 2017 2:09 am    Post subject: Reply to: JOINKEYS Paired and Unpaired Sort
Reply with quote

Most probably, your counts of records are wrong somewhere.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10375
Location: italy

PostPosted: Fri Sep 29, 2017 2:17 am    Post subject: Reply to: JOINKEYS Paired and Unpaired Sort
Reply with quote

could it be that You have some duplicate records ?
Back to top
View user's profile Send private message
MFwhiz

New User


Joined: 21 May 2009
Posts: 5
Location: Philadelphia

PostPosted: Fri Sep 29, 2017 6:27 pm    Post subject:
Reply with quote

Thanks enrico-sorichetti - you were right. When I presort each input file with SUM=NONE it drops a few records. Then everything balances. I believed the key was unique but it is not. I'll have to take steps to ensure a unique key since the duplicates are valid...
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 233
Location: Maryland

PostPosted: Fri Sep 29, 2017 7:05 pm    Post subject:
Reply with quote

FYI:
Without this coding like below, 90% of visitors will ignore all your questions
Code:
//JKE5     EXEC PGM=SORT
//SYSOUT   DD  SYSOUT=*
//SORTJNF1 DD  DSN=TCK401.INPUT1,DISP=SHR
//SORTJNF2 DD  DSN=TCK401.INPUT2,DISP=SHR
//YESONLY  DD  DSN=TCK401.MAS.YESONLY,
//             UNIT=(SYSDA,4),SPACE=(CYL,(100,60),RLSE),
//             DISP=(NEW,CATLG,CATLG),
//             DCB=(RECFM=FB,LRECL=4235,BLKSIZE=0)
//TODONLY  DD  DSN=TCK401.MAS.TODONLY,
//             UNIT=(SYSDA,4),SPACE=(CYL,(100,60),RLSE),
//             DISP=(NEW,CATLG,CATLG),
//             DCB=(RECFM=FB,LRECL=4235,BLKSIZE=0)
//BOTH     DD  DSN=TCK401.MAS.BOTH,
//             UNIT=(SYSDA,4),SPACE=(CYL,(100,60),RLSE),
//             DISP=(NEW,CATLG,CATLG),
//             DCB=(RECFM=FB,LRECL=4235,BLKSIZE=0)
//SYSIN   DD  *
 * CONTROL STATEMENTS FOR JOINKEYS APPLICATION
 JOINKEYS FILE=F1,
          FIELDS=(1,80,A),
          SORTED,NOSEQCK
 JOINKEYS FILE=F2,
          FIELDS=(1,80,A),
          SORTED,NOSEQCK
 JOIN UNPAIRED,F1,F2
 REFORMAT FIELDS=(F1:1,4235,
                  F2:1,4235,
                  ?)
 * CONTROL STATEMENTS FOR MAIN TASK (JOINED RECORDS)
 OPTION COPY
 OUTFIL FNAMES=YESONLY,
        INCLUDE=(8471,1,CH,EQ,C'1'),
        BUILD=(1,4235)
 OUTFIL FNAMES=TODONLY,
        INCLUDE=(8471,1,CH,EQ,C'2'),
        BUILD=(4236,4235)
 OUTFIL FNAMES=BOTH,
        INCLUDE=(8471,1,CH,EQ,C'B'),
        BUILD=(1,4235,
             /,4236,4235)
/*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts JOINKEYS Paired and Unpaired Sort on ... MFwhiz DFSORT/ICETOOL 7 Tue Nov 07, 2017 2:46 am
No new posts Weirdo results with JOINKEYS Balaryan DFSORT/ICETOOL 4 Wed Oct 18, 2017 9:04 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us