View previous topic :: View next topic
|
Author |
Message |
arunmozhicholan
New User
Joined: 07 Feb 2007 Posts: 27 Location: chennai
|
|
|
|
Hi ,
I need to compare the two dates of the given input files but the date format is DDMMMYYYY , so is there any way to convert MMM to numeric
Example
21MAR2012 - 21032012 |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
since a date in the format of day/mo/year can only be compared as equal or not equal,
you are sorta wasting your time.
don't you really want to compare year/mo/da?
and since there are only 12 months,
either use a 'built by you' lookup cobol internal table
or use a 12 step EVALUATE.
why would you want to call a service to provide you potentially 12 returns? |
|
Back to top |
|
|
arunmozhicholan
New User
Joined: 07 Feb 2007 Posts: 27 Location: chennai
|
|
|
|
Thanks ,
I can use Evaluate to get the results . |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
A fun way to do it is to always design so you have a usable date on the files (yyyymmdd or yyyyddd) and then do necessary manipulation for "other" purposes. Can always sort, always compare. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Use the Language Environment CEEDAYS function to get Lilian day number, and then use it as you see fit. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Akatsukami's suggestion is a much better way to go.
If you haven't validated the date beforehand, COBOL DATE FUNCTION's will crash and burn if a bad-date is passed.
LE Callable Service routines will return X'0000' or non-X'0000' in the first 2-Bytes of the Feedback code, to signify a valid or invalid date, respectively.
What if you had a February 29 day and it wasn't a valid leap year and you're using FUNCTION's?
You never get used to those O'Dark Thirty phone calls and in this case, they're preventable.... |
|
Back to top |
|
|
|