MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Removing duplicates without sorting

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Wed Jul 05, 2006 1:25 am    Post subject: Removing duplicates without sorting Reply with quote

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                                 
//                                                   
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Jul 05, 2006 7:38 am    Post subject: Reply with quote

Quote:

Please suggest me if there is any other simple way so that i can accomplish this using a single step? Thanks in advance.


vivek1983,

There is no other way(Single step/pass) to do it if you want to retain the original order of the records.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group