To answer your first question — there isn’t any “good” way. The problem has to do with months and days. Is 03/04/2008 March 4 2008 (mm/dd/yy) or is it April 3 2008 (dd/mm/yy)? Both usage styles are quite valid and represent the preferred format for a date in various cultures. So a significant portion of each month (the first 12 days if you will of every month) cannot be tested with certainty.
As to adding 60 days to a date, the below should do the trick:
01 Some-Date PIC X(10) VALUE “03/04/2008″.
01 A-Date-Field FORMAT DATE “%m/%d/@Y”.
MOVE FUNCTION CONVERT-DATE-TIME(Some-Date DATE “%m/%d/@Y”)
MOVE FUNCTION ADD-DURATION(A-Date-Field DAYS 60)
There are also other intrinsic functions, such as TEST-DATE-TIME but, as mentioned above, they are more oriented to testing the values given a format — and you don’t have a good reliable way of testing the format when month and day values overlap. These functions can be found in the <a href=”http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/books/sc092539.pdf”>ILE COBOL Reference</a>.
<a href=”http://www.brucevining.com/”> http://www.brucevining.com/</a>
Integrated solutions for the System i user community