Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Date comparison

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
arunmozhicholan

New User


Joined: 07 Feb 2007
Posts: 27
Location: chennai

PostPosted: Tue Mar 27, 2012 3:46 pm    Post subject: Date comparison
Reply with quote

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
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Tue Mar 27, 2012 3:54 pm    Post subject:
Reply with quote

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
View user's profile Send private message
arunmozhicholan

New User


Joined: 07 Feb 2007
Posts: 27
Location: chennai

PostPosted: Tue Mar 27, 2012 4:13 pm    Post subject: Reply to: Date comparison
Reply with quote

Thanks ,

I can use Evaluate to get the results .
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue Mar 27, 2012 4:20 pm    Post subject: Reply to: Date comparison
Reply with quote

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
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1755
Location: Bloomington, IL

PostPosted: Tue Mar 27, 2012 8:21 pm    Post subject:
Reply with quote

Use the Language Environment CEEDAYS function to get Lilian day number, and then use it as you see fit.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue Mar 27, 2012 11:21 pm    Post subject: Reply to: Date comparison
Reply with quote

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.... icon_wink.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts SUBSTR for Date functions Shaheen Shaik DB2 4 Thu Apr 06, 2017 2:14 pm
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us