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 

Eliminating dates of different format

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


Joined: 01 Sep 2006
Posts: 167
Topics: 40
Location: chennai

PostPosted: Thu Jul 09, 2009 11:37 am    Post subject: Eliminating dates of different format Reply with quote

Hi,

I have input file like


Code:


AAA.20009-10-10
AAA.10/10/2009




Output

Code:


AAA.20009-10-10



or


Code:


AAA.10/10/2009




My output should have either of the records where I am trying to eliminate duplicate records.

Please let me know if its possible through sort.

Regards,
Kingo
[/b]
_________________
IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE.
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jul 09, 2009 12:00 pm    Post subject: Reply with quote

kingo,

I assumed that if you input date has a slash(/) then it is MM/DD/CCYY format or else it is CCYY@MM@DD format. Using an IFTHEN we format the date into 8 byte zd date and then sort on that reformatted field and eliminate the dups



Code:

//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                   
AAA.2009-10-10                                                   
----+----1----+----2----+----3----+----4----+----5----+----6----+-
AAA.10/10/2009                                                   
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                   
  INREC IFTHEN=(WHEN=(5,10,SS,EQ,C'/'),OVERLAY=(81:11,4,5,2,8,2)),
        IFTHEN=(WHEN=NONE,OVERLAY=(81:5,10,UFF,ZD,LENGTH=8))     
  SORT FIELDS=(81,8,CH,A),EQUALS                                         
  SUM FIELDS=NONE                                 
  OUTREC BUILD=(1,80)               
/*

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


Joined: 01 Sep 2006
Posts: 167
Topics: 40
Location: chennai

PostPosted: Thu Jul 09, 2009 12:16 pm    Post subject: Reply with quote

Thanks Kolusu.
It worked as per my requirement.
_________________
IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE.
Back to top
View user's profile Send private message Yahoo Messenger
kingo
Intermediate


Joined: 01 Sep 2006
Posts: 167
Topics: 40
Location: chennai

PostPosted: Thu Jul 09, 2009 12:45 pm    Post subject: Reply with quote

Sorry Kolusu..
I just tested the same code which you had given and agreed with that
But that is not what I wanted

I will explain my requirement

I have dates in MM/DD/CCYY and CCYY@MM@DD format

For example

Input has

Code:


AAAAAAAAAAAA.20009-10-10
AAAAAAAAAAAA.10/10/2009
BBBBBBBBBBBB.20009-10-10
DDDDDDDDDDDD.10/10/2009



output should be


Code:


AAAAAAAAAAAA.20009-10-10
BBBBBBBBBBBB.20009-10-10
DDDDDDDDDDDD.10/10/2009




or

Code:


AAAAAAAAAAAA.10/10/2009
BBBBBBBBBBBB.20009-10-10
DDDDDDDDDDDD.10/10/2009


_________________
IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE.
Back to top
View user's profile Send private message Yahoo Messenger
kingo
Intermediate


Joined: 01 Sep 2006
Posts: 167
Topics: 40
Location: chennai

PostPosted: Thu Jul 09, 2009 12:55 pm    Post subject: Reply with quote

I ran the code

Code:


//SORTIN   DD *                                                         
AAAAAAAAAAAA.2009-10-10                                                 
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
AAAAAAAAAAAA.10/10/2009                                                 
BBBBBBBBBBBB.2009-10-10                                                 
DDDDDDDDDDDD.10/10/2009                                                 
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN   DD *                                                         
    INREC IFTHEN=(WHEN=(14,10,SS,EQ,C'/'),OVERLAY=(25:20,4,14,2,17,2)),
          IFTHEN=(WHEN=NONE,OVERLAY=(24:14,10,UFF,ZD,LENGTH=8))         
    SORT FIELDS=(25,8,CH,A),EQUALS                                     
    SUM FIELDS=NONE                                                     
    OUTREC BUILD=(1,23)                                                 
/*                                                                     



Output I got the output as

Code:


AAAAAAAAAAAA.2009-10-10
AAAAAAAAAAAA.10/10/2009


_________________
IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE.
Back to top
View user's profile Send private message Yahoo Messenger
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Thu Jul 09, 2009 1:19 pm    Post subject: Reply with quote

Kingo,
Code:

IFTHEN=(WHEN=NONE,OVERLAY=(24:14,10,UFF,ZD,LENGTH=8))


should this not be
Code:

IFTHEN=(WHEN=NONE,OVERLAY=(25:14,10,UFF,ZD,LENGTH=8))

_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
kingo
Intermediate


Joined: 01 Sep 2006
Posts: 167
Topics: 40
Location: chennai

PostPosted: Thu Jul 09, 2009 1:22 pm    Post subject: Reply with quote

Yes Dick

I did the change as well but it did not yield the desired result
_________________
IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE.
Back to top
View user's profile Send private message Yahoo Messenger
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Thu Jul 09, 2009 1:26 pm    Post subject: Reply with quote

Kingo,

you did a great job of adjusting all the other offsets; i imagine the 24 instead of 25 was a typo, or so concentrated on the 14, you forgot to make it 25.

no problem. I had to go thru kolusu's solution to understand yours, and then I saw that the overlay areas were not the same.
_________________
Dick Brenholtz
American living in Varel, Germany
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: Thu Jul 09, 2009 1:36 pm    Post subject: Reply with quote

kingo,

Your problem is you have 2 different offsets and that is the reason for your incorrect output. Also remember to change the sort fields also when you changed the offset

use the following job
Code:

//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                     
AAAAAAAAAAAA.10/10/2009                                             
BBBBBBBBBBBB.2009-10-10                                             
DDDDDDDDDDDD.10/10/2009                                             
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                     
  INREC IFTHEN=(WHEN=(14,10,SS,EQ,C'/'),OVERLAY=(24:20,4,14,2,17,2)),
        IFTHEN=(WHEN=NONE,OVERLAY=(24:14,10,UFF,ZD,LENGTH=8))       
  SORT FIELDS=(24,8,CH,A),EQUALS                                     
  SUM FIELDS=NONE                                                   
  OUTREC BUILD=(1,23)                                               
/*


the output from this is

Code:

AAAAAAAAAAAA.10/10/2009

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


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Thu Jul 09, 2009 1:37 pm    Post subject: Reply with quote

Kingo,

you need to include 1 thru 12 in your sort key, also.

sorta like:
SORT FIELDS=(1,12,CH,A,25,8,CH,A),EQUALS
_________________
Dick Brenholtz
American living in Varel, Germany
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: Thu Jul 09, 2009 1:45 pm    Post subject: Reply with quote

Kingo,

You really really need to do a better job of explaining the requirements clearly.

1. You never mentioned your input/output DCB parameters
2. You never mentioned pos or format of the date field to be parsed
3. You never mentioned on what fields the duplicates need to be eliminated

When there isn't enough data we assume and provide you with a solution and then you go back and change it as you think is right and complain it doesn't work bonk . You are just wasting my time as well as your time. Remember we are communicating via web and I have no clue as to what your data looks like or what the requirement is. So please spend time to explain your requirement clearly.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kingo
Intermediate


Joined: 01 Sep 2006
Posts: 167
Topics: 40
Location: chennai

PostPosted: Thu Jul 09, 2009 1:47 pm    Post subject: Reply with quote

Finally it worked Smile

Thanks dick and Kolusu for helping me out

Code:


000006 //SORTIN   DD *                                                         
000007 AAAAAAAAAAAA.10/10/2009                                                 
000008 AAAAAAAAAAAA.2009-10-10                                                 
000009 BBBBBBBBBBBB.2009-10-10                                                 
000010 DDDDDDDDDDDD.10/10/2009                                                 
000011 DDDDDDDDDDDD.2009-10-10                                                 
000012 EEEEEEEEEEEE.2009-10-10                                                 
000013 //SORTOUT  DD SYSOUT=*                                                 
000014 //SYSIN   DD *                                                         
000015   INREC IFTHEN=(WHEN=(14,10,SS,EQ,C'/'),                               
000016        OVERLAY=(24:20,4,14,2,17,2)),                                   
000017        IFTHEN=(WHEN=NONE,OVERLAY=(24:14,10,UFF,ZD,LENGTH=8))           
000018     SORT FIELDS=(1,12,CH,A,24,8,CH,A),EQUALS                           
000019     SUM FIELDS=NONE                                                     
000020     OUTREC BUILD=(1,23)                                                 
000021 /*                                                                     





output


Code:


AAAAAAAAAAAA.10/10/2009     
BBBBBBBBBBBB.2009-10-10     
DDDDDDDDDDDD.10/10/2009     
EEEEEEEEEEEE.2009-10-10     



This works perfect Smile
_________________
IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE.
Back to top
View user's profile Send private message Yahoo Messenger
kingo
Intermediate


Joined: 01 Sep 2006
Posts: 167
Topics: 40
Location: chennai

PostPosted: Thu Jul 09, 2009 1:49 pm    Post subject: Reply with quote

I totally agree with you Kolusu will seriously work on that going forward
_________________
IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE.
Back to top
View user's profile Send private message Yahoo Messenger
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