Subject: | |
From: | |
Reply To: | |
Date: | Fri, 31 Oct 1997 10:37:38 -0800 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
The URL http://www.software.ibm.com/ad/va2000/va2k2mle.htm
has a brilliant idea from IBM called the Millennium Language Extensions.
In essence, you put a $Control statement that says the starting year of
your 100 year window, and in the Data Division, you add a clause to the
PIC that says the field is a date and what format. Then the compiler and
run time library automatically expand the date to 8 characters for less
than and greater than comparisions. I don't think it handles a sort though.
Example:
77 DATE-IN PIC X(6) VALUE "971022". << OCT 22, 1997 >>
77 DATE-DUE PIC X(6) VALUE "010429". << APR 29, 2001 >>
IF DATE-IN > DATE-DUE
DISPLAY "YOU ARE OVER DUE, DUE ON " DATE-DUE
ELSE
DISPLAY "NOT OVERDUE YET".
When this executes the first display will erroneously occur.
With IBM Millennium Language Extension.
$CONTROL WINDOW=1950
77 DATE-IN PIC X(6) VALUE "971022" DATE YYMMDD.
77 DATE-DUE PIC X(6) VALUE "010429" DATE YYMMDD.
| new clause |
IF DATE-IN > DATE-DUE
DISPLAY "YOU ARE OVER DUE, DUE ON " DATE-DUE
ELSE
DISPLAY "NOT OVERDUE YET".
When this executes, the compiler and run-time library will make 8
character dates for comparision, and correctly cause the second display
to occur.
At IBM, these extensions are available for COBOL on OS/390, VM, VSE,
and AIX, VisualAge COBOL on OS/2 and Windows NT and PL/1 on MVS,
VM and AIX. Adding this feature to the HP compilers and run-time
libraries would make Y2K conversions so much faster and accurate for
those shops using the century window concept.
Mike Berkowitz
Guess? Inc.
|
|
|