Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Thu Dec 01, 2005 9:00 am Post subject: SORT - Get Unique Records from a File |
|
|
How do I extract only Unique records from a dataset ?
This is often confused with "Eliminating Duplicates" from a dataset. Unique records are those which have only one occurrence in the file. Eliminating Duplicates will write both "Unique records" + "First instance of a duplicate" to the output.
The simplest way to extract Unique records is to use DFSORT's ICETOOL or Syncsort's SYNCTOOL
Code: |
//*------------------------------------------------------*
//* Change the PGM to SYNCTOOL if you are using SYNCSORT *
//*------------------------------------------------------*
//R010 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=my.input.file,DISP=SHR
//OUT DD DSN=my.output.file.unique,DISP=OLD
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,50,CH) NODUPS
/*
|
Thanks,
Phantom |
|