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: 6966
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: 7251

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: 1746
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 TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts CICS NEW SIT PARAMETERS CICS BEHAVIOR... Kyle Carroll CICS 0 Fri Nov 04, 2016 11:55 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


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