10 pts.
 Validate date in COBOL/400
I have date in yyyymmdd format. I want to validate if it lies between a particular period of 2 years let b/w 1 Jan 2012 to 5 April 2014, in COBOL/400.... Please help me as the intrinsic function like that in COBOL are not working in this case. Thanks.

Software/Hardware used:
ASKED: January 31, 2013  7:22 PM
UPDATED: January 31, 2013  7:23 PM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question. Michael Tidmarsh   11,380 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Date-to-check = 20120515fromdate = 20120101thrudate = 20140405If date-to-check > fromdateand date-to-check < thrudate       perform xxxxxxwhy doesn’t that work?  I don’t understand the problem. 

 185 pts.

 

If it is because you are comparing yyyymmdd to a date range in ddmmyyyy format – then you need to make the dates a compatible format in working storage.  Convert 01012012 to 20120101 and 05042014 to 20140504 – then a comparing to a yyyymmdd value will work.

 185 pts.

 

I have date in yyyymmdd format.
 
Does that mean it’s not a DATE, but it’s a character or numeric variable instead? If so, then you need to convert it to a DATE or convert your DATE values to match the variable type.
 
…the intrinsic function like that in COBOL are not working…
 
Which function? If we don’t know the function, we can’t help with any errors.
 
What does your programming look like? We can’t tell what might be wrong if we can’t look at it. We need to see the instructions together with any related data definitions.
 
Tom

 107,815 pts.