vivek1983 Intermediate

Joined: 20 Apr 2006 Posts: 222 Topics: 24
|
Posted: Wed Jul 05, 2006 1:25 am Post subject: Removing duplicates without sorting |
|
|
Hi,
I have a requirement where i need to remove duplicates from a file; The output must contain records excluding the duplicates but should remain in the same order as the input file.
EX:
File 1: Input file containing duplicates (Bold)
Name roll no
------- -------------
ANAN A12345678
BANU A22345678
MANOJ A52345678
PRIYA A42345678
KUTTI A12345678
NAVI A52345678
File 2 : Output file eliminating dups
Name roll no
------- -------------
ANAN A12345678
BANU A22345678
MANOJ A52345678
PRIYA A42345678
Note that the the output file is not in sorted order.
Below is the code i have written.
Please suggest me if there is any other simple way so that i can accomplish this using a single step? Thanks in advance.
Note : I have searched the helpboards; But cudnt find the exact solution.
Regrets if i have missed something.
Code: |
//SORTIN DD DSN=Input file ,DISP=SHR
//SORTOUT DD DSN=output temp file,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(1,4),RLSE),
// DCB=(RECFM=FB,LRECL=88)
//SYSIN DD *
INREC FIELDS=(1,80,SEQNUM,8,ZD)
SORT FIELDS=(10,9,CH,A)
SUM FIELDS=NONE
OUTREC FIELDS=(1,88)
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//R010 EXEC PGM=SORT
//SORTIN DD DSN=output temp file,DISP=SHR
//SORTOUT DD DSN=output file,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(1,4),RLSE),
// DCB=(RECFM=FB,LRECL=80)
//SYSIN DD *
SORT FIELDS=(81,8,ZD,A)
OUTREC FIELDS=(1,80)
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
/*
//* SORTING COMPLETE
//
|
|
|