I am just copying the records from an input dataset to an output dataset which will meet some criteria.But while copying I want to eliminate duplicates.I have added SUM FIELDS=NONE. But it is not working instead it is copying the record as many times as it exist in the input file.
SUM FIELDS=NONE will work only for SORT process. Then please tell me how to eliminate the duplicates while copying.
OPTION COPY
INCLUDE COND=(3,7,CH,EQ,C' BEGIN ',OR,(1,1,CH,EQ,
C'*',AND,11,2,CH,EQ,C' *'))
SUM FIELDS=NONE
INREC IFOUTLEN=160,
IFTHEN=(WHEN=(3,7,CH,EQ,C' BEGIN '),
BUILD=(10,7)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'*',AND,11,2,CH,EQ,C' *'),
BUILD=(2,3,
5:C'Model do not follow the correct syntax.'))
Thanks for the reply. Thing is my whole function is working properly with DFSORT except the duplicates are coming out in the output dataset. I think your suggestion uses the ICETOOL. Now for duplicates alone If I change the sort to SYNCSORT then I need to implement the whole functionality(Formatting of records) in ICETOOL again.I am not that aware of SYNCSORT as DFSORT.
Can you please let me know is there any possibility to implement it in DFSORT.
I added sort also like this even then it was not working.
Code:
OPTION COPY
INCLUDE COND=(3,7,CH,EQ,C' BEGIN ',OR,(1,1,CH,EQ,
C'*',AND,11,2,CH,EQ,C' *'))
SORT FIELDS=(2,3,CH,A)
SUM FIELDS=NONE
INREC IFOUTLEN=160,
IFTHEN=(WHEN=(3,7,CH,EQ,C' BEGIN '),
BUILD=(10,7)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'*',AND,11,2,CH,EQ,C' *'),
BUILD=(2,3,
5:C'Model do not follow the correct syntax.'))
Please check if if there are any mistakes in the above code.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
SUM FIELDS=NONE can only be used with SORT or MERGE, not with COPY. That's because eliminating duplicates requires a "key" to define the duplicates. If your records are already in sorted order, you can use MERGE rather than SORT with SUM FIELDS=NONE. MERGE is generally more efficient than SORT. If your records are not in sorted order, then you need to use SORT with SUM FIELDS=NONE.
Quote:
Please check if if there are any mistakes in the above code.
The OPTION COPY statement overrides the SORT statement so you are still doing a COPY, not a SORT. Remove OPTION COPY. DFSORT message ICE143I tells you if you are doing a COPY, SORT or MERGE.
Note also that your INREC reformatting will be performed before SORT and SUM so the SORT statement will operate on the reformatted records. I'm not sure if that's what you wanted or not. If you want to reformat after sorting, use an OUTREC statement rather than an INREC statement.