The matching key has two fields
Rec sequence and Rec-key highlighted in italic and bold
10SSSSSSSES
record sequence is available in type '1' record @ 2,2
110CDE F, GHIJ AAA-BBB-CCCCCCC-DDDD EEEEEEE F AAAAA
Rec-key is available in type '4' Record @ 8,9
4 EFEFEFEFF SDFSDFSDFF SDFSDFSDFS SSS.SS SS.SS
Code i tried as follows
Code:
//STEP01 EXEC PGM=SORT
//SORTIN DD DISP=SHR,DSN=INPUT
//SORTOUT DD DSN=OUTPUT,
// DISP=(,CATLG,DELETE),SPACE=(CYL,(10,10),RLSE)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT, $ BUILD SEQ-NO TO
OVERLAY=(092:SEQNUM,8,ZD, $ PRESERVE ORDER OF
112:1,1)), $ FILE AND MOVE REC TYPE
IFTHEN=(WHEN=GROUP, $ MOVE RECORD SEQ AND
BEGIN=(1,1,CH,EQ,C'1'), $ GNEREATE UNIQUE ID FOR
END=(1,1,CH,EQ,C'5'), $ EACH GROUP OF RECORDS
PUSH=(81:2,2,104:ID=8)), $ IN 81ST POSITION
IFTHEN=(WHEN=(1,1,CH,EQ,C'4'), $ REPLACE THE MOVED REC
OVERLAY=(112:C'0')), $ TYPE IF 4 TO 0
IFTHEN=(WHEN=(1,1,CH,EQ,C'Z'), $ PRESERVE TRAILER @ LAST
OVERLAY=(104:C'999999999'))
SORT FIELDS=(104,9,CH,A) $ SORT UNIQUE ID + REC TYP
OUTREC IFTHEN=(WHEN=GROUP, $ PUSH KEY TO ALL THE
BEGIN=(112,1,CH,EQ,C'0'), $ RECORDS
END=(112,1,CH,EQ,C'5'),
PUSH=(083:8,9)),
IFOUTLEN=99
Joined: 26 Nov 2002 Posts: 12359 Topics: 75 Location: San Jose
Posted: Fri May 05, 2017 12:46 pm Post subject:
Magesh_J wrote:
Trailer count should be @ 10,7 and Group record count should be @ 17,7
I think you are complicating the request. I am guessing that you want to match on sequence number for type '1' record as well as the rec-key for type '4' record.
If that is true, then all you need to do is simply Split the file 2 into records for every record and then eliminate the dups from it and then match on sequence number alone. And then you can match the rec-key on type '4' in the main task for updating the matching group count.
I am away this afternoon, So if you couldn't arrive at the solution probably late in the evening or monday. _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
I am guessing that you want to match on sequence number for type '1' record as well as the rec-key for type '4' record.
Yes, in the group of records, if both the values in type '1' and type '4' matches with file 2 then remove it from file 1, if any one mismatches, it should not remove.
For example, it should not eliminate/remove following group of record, because though the REC-key matches, the record sequence mismatched.
Joined: 26 Nov 2002 Posts: 12359 Topics: 75 Location: San Jose
Posted: Fri May 05, 2017 7:40 pm Post subject:
Magesh_J wrote:
Yes, in the group of records, if both the values in type '1' and type '4' matches with file 2 then remove it from file 1, if any one mismatches, it should not remove.
Magesh_J,
The following JCl will give you the desired results. The idea is to strip off the rec-type='4' records with group number and the sequence number and then match it against your file2. The the output of this matching is taken and then match it against the original file.
By doing so we are only sorting just type 4 records and also the length is reduced to just 20 byes.
Code:
//*********************************************************************
//* TAG THE GROUP OF RECORDS WITH ID AND PICK ONLY REC-TYPE '4' *
//*********************************************************************
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=Your input groups of records file
//SORTOUT DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'1'),
PUSH=(81:ID=8,90:2,2))
OUTFIL INCLUDE=(1,1,CH,EQ,C'4'),
BUILD=(90,2,8,9,X,81,8)
//*
//*********************************************************************
//* MATCH AGAINST FILE2 ON REC-TYPE '4' AND WRITE ONLY THE GROUP IDS *
//* TO BE DISCARDED *
//*********************************************************************
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD DISP=(OLD,PASS),DSN=&&T1
//INB DD *
10SSSSSSSES
10EFEFEFEFF
//SORTOUT DD DSN=&&T2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
JOINKEYS F1=INA,FIELDS=(1,11,A)
JOINKEYS F2=INB,FIELDS=(1,11,A)
REFORMAT FIELDS=(F1:13,8)
SORT FIELDS=(1,8,CH,A)
//*
//JNF2CNTL DD *
INREC BUILD=(1,11)
//*
//*********************************************************************
//* MATCH DISCARDED GROUP ID FILE WITH ORIGINAL FILE1 AND UPDATE THE *
//* TRAILER RECORD WITH COUNTS *
//*********************************************************************
//STEP0300 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD DISP=SHR,DSN=Your input groups of records file
//INB DD DISP=(OLD,PASS),DSN=&&T2
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(81,8,A),SORTED,NOSEQCK
JOINKEYS F2=INB,FIELDS=(01,8,A),SORTED,NOSEQCK
JOIN UNPAIRED,F1,ONLY
INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'1'),OVERLAY=(81:C'1'))
Joined: 26 Nov 2002 Posts: 12359 Topics: 75 Location: San Jose
Posted: Mon May 08, 2017 2:22 pm Post subject:
Magesh_J,
Given the fascination for 1step solution, here is an alternative 1 step approach for getting the desired results. I assumed that you only have 3 records before the rec-type "4" record. we simply push the type 1,2,3 on to positions 81,161 and 241.
The output from this job is also sorted as the Input. If you don't care about the order then use OPTION COPY on the MAINTASK of joinkeys.
Thank you very much for such a fantastic solution.
Here is the cpu comparison.
One step solution
Code:
HH.MM.SS.TH MMM.THT
CPU SERVICE 13,571 TIME ON ZIIP 00.00.00.00
SRB SERVICE 66 ZIIP TIME ON CP 00.00.00.00
MSO SERVICE 0 CPU TCB TIME 00.00.00.53 0.008
I/O SERVICE 136 CPU SRB TIME 00.00.00.00 0.000
TOT SERVICE 13,773 CPU TIME-NO ZIIP 00.00.00.53
IBM NORMALIZED CPU TIME 0.553
Three step solution
Code:
END TERMINATION REPORTING
HH.MM.SS.TH MMM.THT
CPU SERVICE 9,679 TIME ON ZIIP 00.00.00.00
SRB SERVICE 93 ZIIP TIME ON CP 00.00.00.00
MSO SERVICE 0 CPU TCB TIME 00.00.00.38 0.006
I/O SERVICE 152 CPU SRB TIME 00.00.00.00 0.000
TOT SERVICE 9,924 CPU TIME-NO ZIIP 00.00.00.38
IBM NORMALIZED CPU TIME 0.415
Joined: 26 Nov 2002 Posts: 12359 Topics: 75 Location: San Jose
Posted: Mon May 08, 2017 3:21 pm Post subject:
Magesh_J,
As expected the 3 step solution beats the 1 step solution by considerable margin. How about your original solution? _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
As expected the 3 step solution beats the 1 step solution by considerable margin. How about your original solution?
Code:
*******************************************************************************
*
END TERMINATION REPORTING *
HH.MM.SS.TH MMM.THT *
CPU SERVICE 13,577 TIME ON ZIIP 00.00.00.00 *
SRB SERVICE 108 ZIIP TIME ON CP 00.00.00.00 *
MSO SERVICE 0 CPU TCB TIME 00.00.00.53 0.008 *
I/O SERVICE 188 CPU SRB TIME 00.00.00.00 0.000 *
TOT SERVICE 13,873 CPU TIME-NO ZIIP 00.00.00.53 *
IBM NORMALIZED CPU TIME 0.553 *
*
*******************************************************************************
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum