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
> Found my own workaround for this one. The FUNCTION CURRENT-DATE call
> returns a 21-character string with the century as well as the year.
> Pays to read _all_ the function definitions in the back of the book.
> ;-)
You found the right solution. I might mention that the next standard
is extending ACCEPT to return a 4-digit year by adding a key word.
The syntax is:
ACCEPT whatever FROM DATE YYYYMMDD
or
ACCEPT whatever FROM DAY YYYYDDD
It is pretty obvious what happens. The reasonong for adding this is
that zillions of programs use ACCEPT and the chaps don't want to
change to use the CURRENT-DATE function. I wrote a COBOL program in
about 30 minutes that will change all ACCEPT ... FROM DATE to
reference CURRENT-DATE (yes, it takes care of continued literals and
anything else you can think of). It would be easy to extend to ACCEPT
... FROM DAY as well (requires a few more functions). Also, several
implementors have added functionality similar to this (however, with
different key words). I would expect that in the next few months lots
of implementors will add this.
--
Don Nelson
COBOL Development, Tandem Computers, Inc.
Member, ANSI X3J4 and ISO/IEC JTC1/SC22 WG4 COBOL Committees
No clever quotes here