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 without sorting.

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


Joined: 11 Mar 2009
Posts: 58
Topics: 25

PostPosted: Fri Aug 02, 2019 7:21 am    Post subject: Remove Duplicates without sorting. Reply with quote

Hi,

I have a file with data in sorted order as below.

Code:

FRI26JUL19
SAT27JUL19
SUN28JUL19
MON29JUL19
TUE30JUL19
WED31JUL19
THU 1AUG19
FRI26JUL19
SAT27JUL19
SUN28JUL19
MON29JUL19
TUE30JUL19
WED31JUL19
THU 1AUG19
FRI26JUL19
SAT27JUL19
SUN28JUL19
MON29JUL19
TUE30JUL19
WED31JUL19
THU 1AUG19


I need to eliminate duplicates and my desired output should be as below.
Code:

26JUL19
27JUL19
28JUL19
29JUL19
30JUL19
31JUL19
 1AUG19


I have written the below code.

Code:

SORT FIELDS=(31,7,CH,A)
SUM FIELDS=NONE       
OUTREC FIELDS=(2:31,7)


I am getting the below result

Code:

 1AUG19
26JUL19
27JUL19
28JUL19
29JUL19
30JUL19
31JUL19


Actually the 1AUG19 should be below 31JUL19. The data is in text format.

Please help to achive the desired result.

Thanks
_________________
Thanks
TVSSV
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Aug 02, 2019 8:00 pm    Post subject: Re: Remove Duplicates without sorting. Reply with quote

tvssv wrote:
Remove Duplicates without sorting.


tvssv,
How do you expect to remove the duplicates without SORTING? bonk Your subject and contents do NOT match. You are INDEED sorting. You are sorting the data as CHARACTER and sort does not differentiate the MONTH names to sort in the same order as you see in the calendar. You need to change the month to it's equivalent month NUMBER and then sort on it.

Code:

//SYSIN    DD *                                             
  INREC BUILD=(31,07,                                       
               33,03,CHANGE=(2,C'JAN',C'01',C'FEB',C'02',   
                               C'MAR',C'03',C'APR',C'04',   
                               C'MAY',C'05',C'JUN',C'06',   
                               C'JUL',C'07',C'AUG',C'08',   
                               C'SEP',C'09',C'OCT',C'10',   
                               C'NOV',C'11',C'DEC',C'12'),   
                    NOMATCH=(C'00'))                         
                                                             
  SORT FIELDS=(06,02,CH,A,       # YEAR                     
               08,02,CH,A,       # MONTH                     
               01,02,UFF,A)      # DAY                       
                                                             
   SUM FIELDS=NONE                                           
                                                             
  OUTREC BUILD=(01,07)                                       
/*

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

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


Joined: 11 Mar 2009
Posts: 58
Topics: 25

PostPosted: Fri Aug 02, 2019 9:21 pm    Post subject: Reply with quote

Great Kolusu, thank you So much.

I did only one change OUTREC BUILD=(2:01,07) and got my result as below.
Code:

26JUL19
27JUL19
28JUL19
29JUL19
30JUL19
31JUL19
 1AUG19


Learnt new thing. Thank You so much.

By help of google and mvsforums I have written the below jcl.
Code:

//STEP0100 EXEC PGM=SYNCTOOL                                   
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//SYSOUT   DD SYSOUT=*                                         
//INPUT    DD DISP=SHR,DSN=E861559.SIDT.SID501.A02             
//TEMPOUT  DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(200,150))       
//OUTPUT   DD DSN=E861559.SIDT.SID025.A24.FINAL,DISP=OLD       
//TOOLIN DD *                                                   
  SELECT FROM(INPUT) TO(TEMPOUT) ON(1,133,CH) FIRST USING(CTL1)
  SORT FROM(TEMPOUT) TO(OUTPUT) USING(CTL2)                     
/*                                                             
//CTL1CNTL DD *                                                 
  INREC OVERLAY=(134:SEQNUM,16,ZD)                             
//CTL2CNTL DD *                                                 
  SORT FIELDS=(134,16,ZD,A)                                     
  DUPKEYS FIELDS=NONE                                           
  OUTREC BUILD=(2:31,7)                                         
/*                                                             


But getting the below result

Code:

26JUL19
27JUL19
28JUL19
29JUL19
30JUL19
31JUL19
 1AUG19
26JUL19
27JUL19
28JUL19
29JUL19
30JUL19
31JUL19
 1AUG19
26JUL19
27JUL19
28JUL19
29JUL19
30JUL19
31JUL19


It is not eliminating the duplicates. Is there anythng I am missing. Please suggest. For knowledge, to know another way. I am using the one you suggested above for my requirement.

Thanks
_________________
Thanks
TVSSV
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Sat Aug 03, 2019 10:39 am    Post subject: Reply with quote

tvssv wrote:

By help of google and mvsforums I have written the below jcl.
But getting the below result

It is not eliminating the duplicates. Is there anythng I am missing. Please suggest. For knowledge, to know another way. I am using the one you suggested above for my requirement.

Thanks


Tvssv,

First things first. I helped you despite you using the competitive product to DFSORT. Now you scour the internet and code a good for nothing job and you want me to correct it? Why would I do that? bonk So next time you decide to google and find a solutions then please try to understand them. I am not here to educate you especially when you are using a competitive product. If you keep this charade up, you will never be able to post on this board.

Thanks
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

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