Integer Primary

<integer primary>

──┬─ <integer constant> ───────────────┬───────────────────────────────┤
  ├─ <instant constant identifier> ────┤
  ├─ <integer identifier> ─────────────┤
  ├─ <decimal function> ───────────────┤
  ├─ <integer function> ───────────────┤
  ├─ <length function> ────────────────┤
  ├─ <integer file attribute primary> ─┤
  ├─ <integer task attribute primary> ─┤
  └─ ( ── <integer expression> ── ) ───┘

Explanation

Syntax for integer constants, integer constant identifiers, and integer identifiers is given in Basic Constructs. The other kinds of integer primaries are defined in the following topics.

DECIMAL Function

<decimal function>

── DECIMAL ── ( ── <string function> ── ) ─────────────────────────────┤

Explanation

The DECIMAL function returns an integer value equal to the decimal (base 10) number represented by the value of the string expression. The string expression must contain at least 1 and not more than 12 characters. All characters included in the value of the string expression must be within the set of characters “0123456789”. A runtime error occurs if the string expression does not satisfy these requirements.

Examples

The following are examples of the DECIMAL function:

DECIMAL("10") % YIELDS 10 (DECIMAL)
DECIMAL("255") % YIELDS 255 (DECIMAL)

INTEGER Function

<integer function>

── INTEGER ── ( ── <real expression> ── ) ─────────────────────────────┤

Explanation

The INTEGER function returns a result equal to the real expression but without the fractional part. Truncation of the fractional part occurs whether the function is invoked explicitly or implicitly.

Example

The following is an example where I is an INTEGER variable and R is a REAL variable containing the value “123.673”:

I:= INTEGER(123.673); % YIELDS 123 (EXPLICITLY INVOKED)
I:= R; % YIELDS 123 (IMPLICITLY INVOKED)

LENGTH Function

<length function>

── LENGTH ── ( ── <string expression> ── ) ────────────────────────────┤

Explanation

The LENGTH function returns the number of characters contained in the value of the string expression. The LENGTH function supports string expressions of up to 1800 characters.

Example

LENGTH("ABCDEF") % YIELDS 6

Integer File Attribute Primary

<integer file attribute primary>

── <file identifier> ── ( ── <integer file attribute> ── ) ────────────┤

Explanation

The integer file attribute primary returns the value of an integer file attribute associated with the specified file.

Integer Task Attribute Primary

<integer task attribute primary>

── <task identifier> ── ( ── <integer task attribute> ── ) ────────────┤

Explanation

The integer task attribute primary returns the value of an integer task attribute associated with the specified task variable.

Example

In the following example, MYJOB(SOURCESTATION) returns the logical station number (LSN) of the station that originated the job:

RUN (WALLY)NUMB/COUNT;
STATION = MYJOB(SOURCESTATION);