Quote:
> Anyone have a good workaround for the fact that the ACCEPT identifier FROM
> DATE command gives only two digits for the year? I'm coding some routines to
> timestamp output files and would feel sort of stupid if they "expire" in three
> years.
> What are Y2K programmers doing to get around this?
> - Paul
There are several ways around this:
1. As Sallie Kudra mentioned, if your compiler supports intrinsic functions
then use the appropriate one. You might want to investigate upgrading
your COBOL compiler if necessary. If you can't do that in a reasonable
time frame, see below. Also, if you are using the IBM COBOL II compiler
there is an APAR to give you an assembler subprogram which returns the
full date.
2. If #1 above is not possible, you could write a C or assembler subprogram
to obtain the date with 4-digit year from the operating system. Does
your operating system support 4-digit years? Some don't.
3. Ignore the whole thing, store the date with 2-digit year, and let the
somebody else figure it out. This could be a cost-effective solution if
the date is only printed and never compared to another date, used to
compute day-of-week, et cetera.
4. Add a little "date-windowing" logic to your program to build the date
with the century. If you're always writing current-date, just
add something like this to the program:
IF CURRENT-YY > 95
MOVE '19' TO CURRENT-CENTURY
ELSE
MOVE '20' TO CURRENT-CENTURY
END-IF
This buys you a lot of time, and it's easy to do. It will probably more
than cover the useful life of your program. Of course, it's no
fun to replicate it in 1000 programs, and could lead to a maintenance
nightmare when you get your #1 solution.
5. If your systems will be doing a lot of date windowing, like #4 above,
you might consider writing a standard subprogram to convert YY to CCYY
using a standard cutoff year. It could also be helpful interpreting
dates in existing files. Of course you have to know how wide your date
horizon is.
Good Luck!
Arnold Trembley
Software Engineer I (and working on a Year 2000 project)
MasterCard International
St. Louis, Missouri