EGL Reference Guide for iSeries


Data initialization

If an EGL-generated program initializes a record automatically (as occurs in some cases, described later), each of the lowest-level structure items is set to a value appropriate to the primitive type. Form initialization is similar, except that your form declaration can assign values that override the defaults.

Initialization also occurs in these situations:

The next table gives details on the initialization values.


Primitive type Initialization value
BIN and the integer types (BIGINT, INT, and SMALLINT), HEX Binary zeros
CHAR, MBCHAR Single-byte blanks
DBCHAR Double-byte blanks
DECIMAL, NUM, NUMC, PACF Numeric zeros
UNICODE Unicode blanks (each of which is hexadecimal 0020)

In a structure, only the lowest-level structure items are considered. If a structure item of type HEX is subordinate to a structure item of type CHAR, for example, the memory area is initialized with binary zeros.

Records or items that are received as program or function parameters are never initialized automatically.

An EGL-generated Java program initializes records, whether local or global.

An EGL-generated COBOL program initializes the input record, which is identified in the program properties. Other record initialization depends on whether you set the initialized property for a given variable. If you do not, record initialization depends on how you set two build descriptor options at generation time:

In keeping with the behavior of COBOL programs in general, EGL-generated COBOL programs do not initialize local records.

If you generate a COBOL program that compares an item of type NUM with an item of type CHAR, make sure that your code initializes the items; otherwise, the comparison may cause the program to fail with an abend (an abnormal end), in which case no exception-handling code is run. A similar, COBOL-specific warning applies to structure items in local structures and records.


Related concepts
Function part
DataItem part
Program part
Record parts
Structure


Related reference
EGL statements
initNonIOData
initIORecords
Items
set


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]