View previous topic :: View next topic
Author
Message
MFwhiz New User Joined: 21 May 2009Posts: 5 Location: Philadelphia
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
RahulG31 Active User Joined: 20 Dec 2014Posts: 446 Location: USA
Most probably, your counts of records are wrong somewhere.
Back to top
enrico-sorichetti Superior Member Joined: 14 Mar 2007Posts: 10872 Location: italy
could it be that You have some duplicate records ?
Back to top
MFwhiz New User Joined: 21 May 2009Posts: 5 Location: Philadelphia
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
sergeyken Senior Member Joined: 29 Apr 2008Posts: 2010 Location: USA
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
Please enable JavaScript!