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 

remove duplicates but maintain order

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


Joined: 29 Sep 2004
Posts: 3
Topics: 1

PostPosted: Wed Sep 29, 2004 9:06 am    Post subject: remove duplicates but maintain order Reply with quote

Hi, I want to sort to remove the duplicate lines in my file but do not want any other order of records to be changed - that is no other 'sorting' criteria except removing duplicates .. pls help
Back to top
View user's profile Send private message
vivek
Beginner


Joined: 15 Jul 2004
Posts: 95
Topics: 11
Location: Edison,NJ

PostPosted: Wed Sep 29, 2004 9:17 am    Post subject: Reply with quote

Sood,

use sum fields=none

if you want duplicate recs to go into separate dataset

use

sum fields=none,xsum

and declare a ddname
//sortxsum dd dsn=duplicate dsn

Hope it helps.
thanks,
_________________
Vivek,NJ

Db2,IDMS
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
sood
Beginner


Joined: 29 Sep 2004
Posts: 3
Topics: 1

PostPosted: Wed Sep 29, 2004 9:26 am    Post subject: Reply with quote

Hi, I am using sum fields=none but before that, I have to give sort fields parameter eg (1,123,CH,A). This is what I dont want to do as I dont want to arrange in any order but just remove duplicates. But if this parameter is not given , I get an abend
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Sep 29, 2004 9:35 am    Post subject: Reply with quote

Sood,

If you want to retain the orginal order of the records, then you need one more pass of the data.
Code:

//STEP0100 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD DSN=YOUR INPUT FILE,
//            DISP=SHR
//SORTOUT  DD DSN=&TEMP,
//            DISP=(NEW,PASS,DELETE),
//            UNIT=SYSDA,
//            space=(CYL,(X,Y),RLSE)
//SYSIN    DD *
  OPTION EQUALS
  INREC FIELDS=(1,123,SEQNUM,8,ZD)  $ LRECL + SEQNUM OF 8 BYTES
  SORT FIELDS=(1,123,CH,A)          $ SORT ON LRECL
  SUM FIELDS=NONE                   $ REMOVE DUPS
//*
//STEP0200 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD DSN=&TEMP,
//            DISP=SHR
//SORTOUT  DD DSN=YOUR OUTPUT W/O DUPS,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            space=(CYL,(X,Y),RLSE)
//SYSIN    DD *
  OPTION EQUALS
  SORT FIELDS=(124,8,CH,A)   $ SORT ON SEQNUM
  OUTREC FIELDS=(1,123)      $ REMOVE THE SEQNUM
//*


Hope this helps...

cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sood
Beginner


Joined: 29 Sep 2004
Posts: 3
Topics: 1

PostPosted: Thu Sep 30, 2004 12:28 am    Post subject: Reply with quote

thanks pal ! it worked ! big help !
Back to top
View user's profile Send private message
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