Please enable JavaScript to view this site.

ESL Documentation

Definition

Define a record for use with the File I/O Library subroutines.

record RECORD_NAME is

  [filler FILL_WIDTH]

  { VARIABLE_NAME VAR_WIDTH [, PREC]

  | VARIABLE_NAME[N1,...Nn] VAR_WIDTH [, PREC]

  | record PD_RECORD_NAME }

  [ filler FILL_WIDTH

  | VARIABLE_NAME VAR_WIDTH [, PREC]

  | VARIABLE_NAME[N1,...Nn] VAR_WIDTH [, PREC]

  | record PD_RECORD_NAME ]...

end record

RECORD_NAME

The identifier for the record.

filler FILL_WIDTH

A positive integer constant (greater than zero) denoting the number of columns skipped before the next field begins.

VARIABLE_NAME

A string, integer, or float variable.

VAR_WIDTH

A positive or negative integer constant specifying the number of columns in the field (including the decimal point and the precision for floats). On input, the sign of the VAR_WIDTH specifier is ignored. On output, the sign of the VAR_WIDTH specifier indicates the justification of the value in the output field (positive=right, negative=left). The maximum size of VAR_WIDTH for a string field is 32,767. The total size of all VAR_WIDTH specifications within a record cannot exceed 65,536.

PREC

A positive integer constant specifying the number of digits to the right of the decimal point for a float variable. If no PREC is specified for a float variable in the record definition, zero is used. (PREC will be ignored if specified for either string or integer variables.)

VARIABLE_NAME[N1,...Nn]

An array variable reference. The array must be a string, integer, or float array, and the reference must be specific (i.e., to a single element in the array). The array can be multi-dimensional. Subscripts can be either positive integer constants or integer variables.

PD_RECORD_NAME

The name of another record that has been previously defined.

Description

The keyword filler cannot be the only specification contained in a record. If you specify filler as the last field in a record, it is ignored.

Precision in a record is different from ESL precision. ESL defaults to a precision of two without a specified precision for floating point. Thus, actions performed on float variables read in by the input subroutines will contain a decimal point and two digits to the right of the decimal point. If the floating point variable is read in with a precision greater than two specified, but the ESL program defaults to a precision of two, the digits after the first two will be truncated.

A record cannot contain itself, either directly or indirectly. The limit on nesting depends on available memory, but is essentially unlimited.

Example

record Personal_Info is

Last_Name 15

First_Name 10

Address 35

City 20

Phone 14

SS_Number 11

Married 1

end record

record Company_Info is

Hiredate 8

filler 1

Building 3

filler 1

Office 3

filler 1

PayGrade 2

end record

record Employee is

Employee_ID 10

filler 5

record Company_Info

filler 5

record Personal_Info

end record