Friday, September 4, 2009

The INITIALIZE Statement

The INITIALIZE Statement
Syntax
Format
INITIALIZE {identifier-1}...
[REPLACING { { ALPHABETIC
ALPHANUMERIC
NUMERIC
ALPHANUMERIC-EDITED
NUMERIC-EDITED } DATA BY { identifier-2
literal-1 } }...]

Description
The INITIALIZE statement is used to initialize data items. Data items are initialized according to their type:
" Alphabetic and alphanumeric items are initialized to spaces.
" Numeric items are initialized to zeros.
" For group items, the subordinate elementary items are initialized depending on their individual data types. Only named items are initialized.
" The REPLACING phrase can be used to initialize data items to different values other than the default SPACES or ZEROS.
Tips
1. Use the initialize statement instead of moving ZEROS or SPACES to a group. That way, each subordinate item will be set to an appropriate value.
2. Notice that unnamed and FILLER items are not initialized. This allows the variable portion of a detail line, for example, to be initialized without the constant values inserted into the unnamed fields being affected.