Kednos PL/I for OpenVMS Systems
Reference Manual


Previous Contents Index

E.3 Expressions and Data Conversions

The following table lists the categories of operators, their symbols, and their meanings.

Operators
Category Symbol Operation
Arithmetic
operators
+
-
/
*
**
Addition or prefix plus
Subtraction or prefix minus
Division
Multiplication
Exponentiation
Relational
(or comparison)
operators
>
<
=
^>
^<
^=
>=
<=
Greater than
Less than
Equal to
Not greater than
Not less than
Not equal to
Greater than or equal to
Less than or equal to
Bit-string
(or logical)
operators
^ (prefix)
&
|
&:
|:
^ (infix)
Logical NOT
Logical AND
Logical OR
Logical AND THEN
Logical OR ELSE
Logical EXCLUSIVE OR
Concatenation
operator
|| String concatenation

Note

For any of the operators, the tilde character (~) can be used instead of a circumflex (^), and an exclamation point (!) can be used instead of a vertical bar (|).

The following table gives the priority of PL/I operators. Low numbers indicate high priority. For example, the exponentiation operator (**) has the highest priority (1), so it is performed first, and the OR ELSE operator (|:) has the lowest priority (9), so it is performed last.

Precedence of Operators
Operator Priority Left/Right Associative Order of Evaluation
() 0 N/A deepest first
** 1 right left to right
+ (prefix) 1 N/A N/A
- (prefix) 1 N/A N/A
^ (prefix) 1 N/A N/A
* 2 left left to right
/ 2 left left to right
+ (infix) 3 left left to right
- (infix) 3 left left to right
|| 4 left left to right
> 5 left left to right
< 5 left left to right
^> 5 left left to right
^< 5 left left to right
= 5 left left to right
^= 5 left left to right
<= 5 left left to right
>= 5 left left to right
& 6 left left to right
| 7 left left to right
^ (infix) 7 left left to right
&: 8 left left to right across entire expression
|: 9 left left to right across entire expression

The following table discusses the contexts in which PL/I performs data conversion.

Contexts in Which PL/I Converts Data
Context Conversion Performed
target = expression; In an assignment statement, the given expression is converted to the data type of the target.
entry-name
RETURNS (attribute...);
.
.
.
In a RETURN statement, the specified value is converted to the data type specified by the RETURNS option on the PROCEDURE or ENTRY statement.
RETURN (value);  
x + y
x - y
x * y
x / y
x**y
x||y
x & y
x | y
x&:y
x|:y
x ^ y
x > y
x < y
x = y
x^=y
In any expression, if operands do not have the required data type, they are converted to a common data type before the operation. For most operators, the data types of all operands must be identical. A warning message is issued in the case of a concatenation conversion.
BINARY (expression)
BIT (expression)
CHARACTER (expression)
DECIMAL (expression)
FIXED (expression)
FLOAT (expression)
OFFSET (variable)
POINTER (variable)
PL/I provides built-in functions that perform specific conversions.
PUT LIST (item,...); Items in a PUT LIST statement are converted to character-string data.
GET LIST (item,...); Character-string input data is converted to the data type of the target item.
PAGESIZE (expression)
LINESIZE (expression)
SKIP (expression)
LINE (expression)
COLUMN (expression)
format items A, B, E, F, and X
TAB (expression)
Values specified for various options to PL/I statements must be converted to integer values.
DO control-variable... Values are converted to the attributes of the control variable.
parameter Actual parameters are converted to the type of the formal parameter if necessary.
INITIAL attribute Initial values are converted to the type of the variable being initialized.

E.4 Pseudovariables

PL/I has the following pseudovariables:

A pseudovariable can be used, in certain assignment contexts, in place of an ordinary variable reference. For example:


SUBSTR(S,2,1) = 'A'; 
This assigns the character <BIT_STRING>(A) to a 1-character substring of S, beginning at the second character of S.

A pseudovariable can be used wherever the following three conditions are true:

Pseudovariables are used most often in the following locations:

Note that a pseudovariable cannot be used in preprocessor statements or in an argument list. For example:


CALL P(SUBSTR(S,2,1)); 

Here, SUBSTR is interpreted as a built-in function reference, not as a pseudovariable. The actual argument passed to procedure P is a dummy argument containing the second character of string S.

E.5 Built-In Subroutines

The following table summarizes the file-handling built-in subroutines.

Summary of File-Handling Built-In Subroutines
Subroutine Function
DISPLAY Returns information about a file.
EXTEND Allocates additional disk blocks for a file.
FLUSH Requests the file system to write all buffers onto disk to preserve the current status of a file.
FREE Unlocks all the locked records in a file.
NEXT_VOLUME Begins processing the next volume in a multivolume tape set.
RELEASE Unlocks a specified record in a file.
REWIND Positions a file at its beginning or at a specific record.
SPACEBLOCK Positions a file forward or backward a specified number of blocks.

PL/I also has the condition-handling subroutine RESIGNAL. This subroutine allows an ON-unit to pass on a condition signal and causes the condition to be resignaled for handling by a different ON-unit.


Index Contents