How to remove the duplicate records present in a PS dataset using JCL?

Showing Answers 1 - 17 of 17 Answers

sravanv

  • Sep 15th, 2005
 

Just use this code.

//sysin dd *

sort fields=COPY

SUMFIELDS=NONE

/*

By using this we could remove the duplicate records from PS dataset. 

  Was this answer useful?  Yes

Abhijit Barik

  • Nov 8th, 2005
 

You have to use SORT utility. Then find out the key field which is having multiple occurrence. Suppose it is a packed numeric (PD) field of length 6 starting from col-40. Then sysin card will be like this:

//SYSIN  DD *
 SORT FIELDS=(40,6,PD,A)
 SUM FIELDS=NONE
/*

  Was this answer useful?  Yes

vrajendran

  • May 18th, 2007
 

Using SUM option, you can remove the duplicate fields and also you can store the dupliate records into another PS.

//SYSIN  DD *
 SORT FIELDS=(40,6,PD,A),XSUM
 SUM FIELDS=NONE
/*

Specify the XSUM parameter if you want records deleted (Duplicate records) by SUM processing to be written to a data set defined by the SORTXSUM DD statement. These records will be written to SORTXSUM at the time of SUM processing.

If you need the duplicate records you have to mention SORTXSUM DD statement with the same length of SORTIN file.

  Was this answer useful?  Yes

Raja

  • Sep 25th, 2007
 

Hi,
The XSUM parameter cannot be given with the sort card. It should be given in the SUM FIELDS card. You should write as follows:

//SYSIN  DD *
 SORT FIELDS=(40,6,PD,A)
 SUM FIELDS=NONE,XSUM
/*

  Was this answer useful?  Yes

Mahaveer

  • Feb 1st, 2014
 

Code
  1. //SORTXSUM DD DSN=datasetname,

  2. //            DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,

  3. //            SPACE=(CYL,(1,4),RLSE),

  4. //            DCB=(RECFM=FBM,LERCL=80,BLKSIZE=800)

  5. .

  6. .

  7. //SYSIN DD *

  8.         SORT FIELDS=(1,3,CH,A)

  9.         SUM FIELDS=NONE,XSUM

  10. /*

  11.  




We can see the eliminated duplicate records in sortxsum

  Was this answer useful?  Yes

Vengat

  • Mar 19th, 2015
 

Sum Fields = None will do it

  Was this answer useful?  Yes

natarajan

  • Aug 21st, 2017
 

Using sort utility, include the following command
sum fields=none;

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions