Introduction

An expression is a representation of a value or of the computation of a value. Expressions are classified as either element (scalar) expressions or array expressions.

Element expressions represent element values, including elementary names within a structure or a subscripted name that specifies a single element of an array. Array expressions represent either an entire array or a cross-section of an array. Element variables and array variables may be used in the same expression.

Expressions are used for the following reasons:

All expressions, except for single constants and references, are made up of an operator and one or more operands. An operator requires specific types of operands (arithmetic, character-string, or bit-string) and produces a result of a specific type. Operands can be constants, variable references, user-defined function references, built-in function references, or other expressions that match the type required by the operator.

Operators can be either infix or prefix. An infix operator is written between its two operands, and a prefix operator is written in front of its operands, as shown in the following table of operators.

Operator     Category     Example
+  –  *  /  ** arithmetic infix B+C
+  – arithmetic prefix -C
=   ^=   >   <   >=   <=   ^<  ^> relational B=C
|  or  & bit-string infix BIC
^ bit-string prefix ^C
||  or  !! concatenate B||C

One expression can contain both an infix and a prefix operator. For example:

A*-B
Note:

Open PL/I supports the use of a tilde (~) as an operator symbol equivalent to a caret (^).

Open PL/I supports the use of an exclamation point (!) as an operator symbol equivalent to a single bar (|), and a double exclamation point (!!) as equivalent to a double bar (||).