beautypg.com

Compaq COBOL AAQ2G1FTK User Manual

Page 92

background image

Developing Compaq COBOL Programs
1.5 Using Program Switches

On OpenVMS, to test the previous program on an OpenVMS Alpha system,
compile and link it and then type the following:

$ DEFINE COB$SWITCHES 12
$ RUN TSW

The output is as follows:

**TEST SWITCHES**
SWITCH 12 IS ON
**END**

To test the previous program on a Tru64 UNIX system, compile and link it and
then type the following:

% setenv COBOL_SWITCHES 12
% tsw

The output is as follows:

**TEST SWITCHES**
SWITCH 12 IS ON
**END**

1.6 Special Information for Year 2000 Programming

Even subsequent to the turn of the millennium, there still exist potential
disruptions in previously problem-free software where there are instances of a
two-digit year field that should be a four-digit field. Programmers need to correct
all such fields, as Compaq cannot prevent problems that originate in application
code.

Two-digit year formats used in controlling fields, or as keys in indexed files,
can cause program logic to become ambiguous. It is a fundamental rule to use
four-digit years instead of two-digit years in areas where sequential operations
are driven from these values or for comparison of these values.

Compaq COBOL provides programmer access to four-digit and two-digit year
formats:

4-digit

FUNCTION CURRENT-DATE

4-digit

FUNCTION DATE-OF-INTEGER

4-digit

FUNCTION DATE-TO-YYYYMMDD

4-digit

FUNCTION DAY-OF-INTEGER

4-digit

FUNCTION DAY-TO-YYYYDDD

4-digit

FUNCTION INTEGER-OF-DATE

4-digit

FUNCTION INTEGER-OF-DAY

4-digit

FUNCTION TEST-DATE-YYYYMMDD

4-digit

FUNCTION TEST-DAY-YYYYDDD

4-digit

FUNCTION WHEN-COMPILED

4-digit

FUNCTION YEAR-TO-YYYY

2-digit

ACCEPT FROM DATE

2-digit

ACCEPT FROM DAY

1–62 Developing Compaq COBOL Programs