Sorted but want to print all discarded records



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Sorted but want to print all discarded records

Postby Everlast » Thu Dec 30, 2021 1:28 am

I have code with a primary and secondary sort that removes duplicates based on the primary. What I want to do is print out all the discarded records to another file.

SORT FIELDS=(1,9,CH,A,355,8,CH,A),EQUALS
OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,9),PUSH=(3501:SEQ=8))
OUTFIL BUILD=(1,3500),INCLUDE=(3501,8,ZD,EQ,1)


Any help is appreciated.

Thanks
Everlast
 
Posts: 1
Joined: Thu Dec 30, 2021 1:24 am
Has thanked: 0 time
Been thanked: 0 time

Re: Sorted but want to print all discarded records

Postby sergeyken » Thu Dec 30, 2021 11:47 pm

DUPKEYS Control Statement

The DUPKEYS control statement is used to enable special processing for records with equal sort/merge control fields (keys). You can perform the following functions:

• Sum specified numeric fields, place the sum in one record and delete the other records with the same key (SUM)
• Compute the average of specified numeric fields, place the average in one record and delete the other records with the same key (AVG)
• Determine the minimum or maximum value of specified numeric fields, place this value in one record and delete the other records with the same key (MIN,MAX)
• Delete all but one of the records with equal keys (FIELDS=NONE)
• Retain only records with keys that occur more than once (ALLDUPS)
• Retain only the first record of those with keys that occur more than once (FIRSTDUP)
• Retain only the last record of those with keys that occur more than once (LASTDUP)
• Retain only the records with keys that occur only once (NODUPS)

The records deleted by DUPKEYS can optionally be written to a separate file.

The DUPKEYS control statement cannot be used with a SUM control statement, nor when FIELDS=COPY is specified on the SORT or MERGE control statement.

If you need to add other DUPKEYS functionality to an application with a SUM control statement, you must move the SUM specification to the DUPKEYS statement and remove the SUM statement. If XSUM was used, then XDUP should be specified and the JCL changed from using a SORTXSUM DD to a SORTXDUP DD.
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post