$ivar

<< Click to Display Table of Contents >>

Navigation:  User guide > Variables >

$ivar

The term ivar represents an integer variable name of up to 30 characters which is always preceded by a dollar sign.

An ivar defined with "DI" can hold a whole number up to 9 digits (between -999999999 and +999999999) or U (undefined).

An ivar defined with "DJ" can hold a whole number up to 15 digits (between -999999999999999 and +999999999999999) or U (undefined).

Undefined is a special value (actually a very large negative number) which CL places in an ivar when a faulty definition is used. Any arithmetic involving an undefined number has an undefined result unless UZA is used.

An ivar is normally given a value with a D (define) command. The following examples define ivars:

di $age = $111-112,

di $salary = $141-149,

di $count = 0;

dj $big = $241-255,

dj large = $big - 100,

The D (define) statements are executed and the values copied from the data locations to the variables when the definition commands are reached. In the first two examples the fields are treated as containing a numeric value. Use format ANF to accept negative values in fields.

You can use the data-reading formats IFF (Integer Field Failed) and IFB (Integer Field Blank) to control the value for empty or faulty fields.

An ivar is normally preset to 0 (zero).

TIP: We recommend using RCP UNDEFINED to preset to U (undefined).