Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Programming Guide


Example: century window

The following example shows (in bold) how to modify a program with the DATE FORMAT clause to use the automatic date windowing capability.

CBL LIB,QUOTE,NOOPT,DATEPROC(FLAG),YEARWINDOW(-60)
. . .
01  Loan-Record.
    05  Member-Number   Pic X(8).
    05  DVD-ID          Pic X(8).
    05  Date-Due-Back   Pic X(6) Date Format yyxxxx.
    05  Date-Returned   Pic X(6) Date Format yyxxxx.
. . .
    If Date-Returned > Date-Due-Back Then
       Perform Fine-Member.

There are no changes to the PROCEDURE DIVISION. The addition of the DATE FORMAT clause on the two date fields means that the compiler recognizes them as windowed date fields, and therefore applies the century window when processing the IF statement. For example, if Date-Due-Back contains 080102 (January 2, 2008) and Date-Returned contains 071231 (December 31, 2007), Date-Returned is less than (earlier than) Date-Due-Back, so the program does not perform the Fine-Member paragraph. (The program checks whether a DVD was returned on time.)


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)