Previous Topic Next topic Print topic


Initializing Data Items

Data item initialization. By default, COBOL initializes all data items in the Working-Storage Section to spaces if no VALUE clause is specified.

By default, COBOL initializes all data items in the Working-Storage Section to spaces if no VALUE clause is specified. This includes all numeric items. The effect of arithmetic operations on such an item depends on how the item is used:

Usage Effect of arithmetic
DISPLAY and COMP-3 Intermediate code reports run-time error 163 ("Illegal character in numeric field"). Generated code gives unpredictable results.
Any other Results are unpredictable.

To avoid these problems, initialize all numeric items to numeric values before use.

Previous Topic Next topic Print topic