LIKE


 

The LIKE compiler directive allows a new DIM, FORM, or INTEGER data variable to be declared that has the same data variable type, variable size, and value as a previously declared data variable. The instruction uses the format:

 

 

label

LIKE

{var}

 

Where:

label

Required. A Data Definition Label.

var

Required. A previously declared DIM, FORM, or INTEGER variable label reference.

Flags Affected: NONE

Note the following:

  1. The {var} label reference can be an array label reference without an index.

 

Example:

 

D1

DIM

1

FX

FORM

123.456

IARR

INTEGER

1(3),("1"),("2"),("3")

DATA

INIT

"THIS IS A TEST!"

.

 

 

nD1

LIKE

D1

nFX

LIKE

FX

nIARR

LIKE

IARR

nData

LIKE

DATA

 

This code shows the creations of new variables based on existing variables using the LIKE compiler directive.

 

 

See Also: Compiler Directives

 



PL/B Language Reference INCLUDE LISTON and LISTOFF