INITIALIZE

The INITIALIZE instruction intializes program variables with NULL or default values.

Syntax

INITIALIZE target [,...]
  {
     TO NULL
  |
     LIKE {table.*|table.column}
  }
  1. target is the name of the variable to be initialized.
  2. table.column can be any column reference defined in the database schema files.

Usage

The INITIALIZE instruction assigns NULL or default values to variables.

The argument of the INITIALIZE instruction can be a simple variable, a record (with .* notation), a record member, a range of record members specified with the THRU keyword, an array or an array element.

The TO NULL clause initializes the variable to null.

When initializing a static array TO NULL, all elements will be initialized to null. When initializing a dynamic array TO NULL, all elements will be removed (i.e. the dynamic array is cleared).

The LIKE clause initializes the variable to the default value defined in the database schema validation file. This clause works only by specifying the table.column schema entry corresponding to the variable.

To initialize a complete record, you can use the star to reference all members:
INITIALIZE record.* LIKE table.*

You cannot initialize variables defined with a complex data type (like TEXT or BYTE) to a non-NULL value.

SCHEMA stores 
MAIN
  DEFINE cr RECORD LIKE customer.*
  DEFINE a1 ARRAY[100] OF INTEGER
  INITIALIZE cr.cust_name TO NULL
  INITIALIZE cr.cust_name THRU cr.cust_address TO NULL
  INITIALIZE cr.* LIKE customer.*
  INITIALIZE a1 TO NULL
  INITIALIZE a1[10] TO NULL
END MAIN