COBOL Manual for TNS/E Programs (H06.03+)

Data Division
HP COBOL Manual for TNS/E Programs520347-003
7-34
Initializing Data Items
Initializing Data Items
The value to which a data item is initialized is determined by:
EXTERNAL clause
A data item described with an EXTERNAL clause (an external data item) cannot
have a VALUE clause and is not affected by events that cause internal data items
to be initialized. Its contents are unpredictable until a program assigns a value to it.
Thereafter, it retains the last value assigned to it throughout the current execution
of the run unit.
VALUE clause
With some exceptions, you can set the initial value of an internal data item by
including a VALUE clause in its data description entry (for exceptions, see VALUE
Clause).
BLANK and NOBLANK directives
When a data item is not described with a VALUE clause, the BLANK or NOBLANK
directive determines its initial value (see BLANK and NOBLANK).
An internal data item is initialized at each of these times:
The first time the program is executed.
The first time the program is called after a CANCEL statement that references it
has been executed, unless a NOCANCEL directive affects the program.
01 REPORT-HEADING-1.
05 FILLER PICTURE X(7) VALUE SPACES.
05 REPORT-MM PICTURE 99.
05 FILLER PICTURE X VALUE "/".
05 REPORT-DD PICTURE 99.
05 FILLER PICTURE X VALUE "/".
05 REPORT-YY PICTURE 99.
05 REPORT-YY PICTURE 99.
05 FILLER PICTURE X(7) VALUE SPACES.
...
01 MONTH-ABBREVIATIONS
VALUE "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC".
03 MON-ABBR PIC X(3) OCCURS 12 TIMES.
01 CONSTANTS-FOR-I-O.
05 ERROR-MSG-CONST PICTURE X(13) VALUE "*** ERROR ***".
...
01 CONSTANTS-FOR-LOGIC.
...
Example 7-6. Record Description Entries (page 2 of 2)