My requirement is to SORT the records based on key field (1, 11) Pos excluding header & trailer records and write the duplicate records to another file. I want this to be done in Single step only.
See ICETOOL I have created below:
I tried adding SUM FIELDS=NONE,XSUM but it gives syntax error. Can you please help me in writing the duplicates to another SORTXSUM file ? Thanks.
0 IDENTIFIER FROM CALLING PROGRAM IS 0001
0 JOBNAME: TTYAGMK1 , STEPNAME: STEP020
0 BLOCKSET TECHNIQUE IN CONTROL
0 BLOCKSET SORT TECHNIQUE SELECTED
0 VISIT www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
0 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 06:30 ON THU JA
SORT FIELDS=(1,11,CH,A)
SUM FIELDS=NONE,XSUM
£
E XSUM IS NOT SUPPORTED - USE ICETOOL SELECT IF APPROPRIATE
0 END OF STATEMENTS FROM CTL1CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL1,SORTIN=SORTI
,SORTOUT=SORTOUT,DYNALLOC,EQUALS,NOCHECK
MODS E15=(ICE15DU,12288),E35=(ICE35DU,12288)
SORT FIELDS=COPY
SORT FIELDS=COPY
C5-K62149 C6-K90026 C7-K58148 C8-K67572 E7-K70685
END OF DFSORT
Try this instead..
I have assumed that you have a input LRECL 100 and your header and trailer has 'HEAD' and 'TRAI' respectively in positions 1 thru 4 in them.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
hailashwin,
I appreciate your enthusiasm to help but you need to understand the order of processing. You already have the data sorted on the key and hence your job worked even though you are using INREC to number the duplicates. Run your job with the following data and see how you get incorrect results.
You can do either do another pass to get the desired results or alternatively there is a trick to get the desired results in the same pass even if there is nothing to identify the header and trailer.
Please provide us the DCB properties of the input file. Do you have anything to identify the header and trailer? If there is then we just need to slightly modify hailashwin's solution. If not then I will show you the trick to get it done in 1 pass.
There is a "pre-sort" which is simply 0 for header, 5 for data, and 9 for trailer, then the actual sort on the key.
The "first" record is INCLUDED by using WHEN=GROUP, with KEYBEGIN and PUSHing a sequence number for the group.
A similar approach to ICETOOL's SELECT "works", as in my single test-run gives the same results, but since the manual specifies that the high-order sort key should be any and all ON values, in the order specified on the SELECT which can be followed by additional keys, I'd not rely on it working.