INIT


ANSI

 

The INIT instruction defines a character string variable and assigns it an initial value. It uses one of the following formats:

 

(1)

[label]

INIT

[*]{init-data}

(2)

[label]

INIT

^

(3)

[label]

INIT

^,{variable}

(4)

[label]

INIT

% [*]{init-data}

(5)

[label]

INIT

%%

 

Where:

label

Optional. A Data Definition Label.

init-data

Required. A valid character or control string Literal containing variable initialization data.

%

Optional. Denotes the item as being GLOBAL.

%%

Optional. Denotes the item as GLOBAL but does not initialize it in any way.

*

Optional. Denotes the item or file as being COMMON.

^

Optional. Denotes the item as being a POINTER.

variable

Required. The name of a previously defined variable of the same type.

Flags Affected: NONE

Note the following:

  1. Character string literals must be enclosed in quotation marks.

  2. Ctrl string literals must be valid representations of binary, decimal, hex or octal values.

  3. The Form Pointer is equal to the first character in the string.

  4. The Length Pointer and Physical Length equal the last character in the string.

  5. Arrays may not be defined using the INIT instruction. To initialize an array, use the DIM instruction.

  6. The ^ denotes a Pointer Variable.

  7. If the % form is used, the data item is placed in the Global Data Area. The variable is then available to other programs that also declared it with the percent form. Global Data Items are available with PLBCMP only.

  8. If the %% form is used, the data label is placed in the Global Data Area but no initialization takes place if it has not already been defined in the Global Data Area. If an array data label is placed in the Global Data Area, when initialized, it must have the same number of elements in the array. Global Data Items are available with PLBCMP only.

  9. If the * form is used, the data item is in common with other programs and all of the rules of COMMON must be followed.

  10. If an array is defined, each element may have a label.

 

 

See Also: Example Code, DIM, Character String, Data Definitions

 



PL/B Language Reference DIM NCHAR