IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Date Comparison MM/DD/CCYY format


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Michael Angelo Pagala

New User


Joined: 02 Mar 2007
Posts: 34
Location: somewhere in the middle

PostPosted: Wed Jun 23, 2010 7:09 am
Reply with quote

I have searched and read threads and can't find any answer specific to my problem.

Is there any way I can compare two dates in MM/DD/CCYY format without breaking it to MMDDCCYY?

I need to compare the two dates and if one is greater than the other I would use the one which ever is higher.

I thought something like this would do the trick.
sample: (51,10,CH,GT,24,10,CH)

Is there any additional parameters that would not require me to remove the slashes first and compare.but if I really need to remove it..how do I do it in a simple way and the output would still has the '/'.

here is my current sort card
Code:
   JOINKEYS FILES=F1,FIELDS=(1,23,A)                             
   JOINKEYS FILES=F2,FIELDS=(1,23,A)                             
   JOIN UNPAIRED,F2                                               
   REFORMAT FIELDS=(F2:1,50,F1:25,10)                             
   SORT FIELDS=COPY                                               
   OUTREC IFTHEN=(WHEN=(50,1,CH,EQ,C'P',AND,51,10,CH,GT,24,10,CH),
          BUILD=(1,19,24,10,51,10,50,1,20,4)),                   
          IFTHEN=(WHEN=NONE,BUILD=(1,19,24,20,50,1,20,4))


when reformatted the position of the dates would be 24 & 51 respectively
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Jun 23, 2010 8:46 am
Reply with quote

Hello,

The problem is not the slashes but rather the order of the date fields. . .

Comparing 11231990 to 01152009 or comparing 11/23/1990 to 01/15/2009 will never give the correct answer even with the slashes removed.

If i understand, your comparison needs to be ccyymmdd in order to work. Once the dates are in the proper order, it won't matter if there are slashes or not.

Possibly, there is something i misunderstand. . .
Back to top
View user's profile Send private message
Michael Angelo Pagala

New User


Joined: 02 Mar 2007
Posts: 34
Location: somewhere in the middle

PostPosted: Wed Jun 23, 2010 9:22 am
Reply with quote

so if I formatted it like what you have said, the slashes won't matter and I can compare it directly?

I will try that and check the results.

thanks for that info!


oh just a thought..is there any additional parameter that will convert it to CCYY/MM/DD without resorting to manually repositioning the date fields.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
Search our Forums:

Back to Top