pTAL Reference Manual (G06.24+, H06.09+, J06.03+)

Arithmetic Expressions
An arithmetic expression is a sequence of operands and arithmetic operators that computes a
single numeric value of a specific data type.
+, -
are unary plus and minus operators. The default is unary plus.
operand
is one of the elements in Table 24 (page 72).
arithmetic-operator
is one of the following:
+, -, *, /Signed arithmetic operator
'+', '-', '*', '/', '\'Unsigned arithmetic operator
LOR, LAND, XORLogical operator
Table 24 Operands in Arithmetic Expressions
ExampleDescriptionElement
var[10]The identifier of a simple variable,
array element, pointer, structure data
Variable
item, or equivalenced variable, with
or without @ or an index
103375A character string or numeric constantConstant
file_sizeThe identifier of a named constantLITERAL
$LEN (x)The invocation of a procedure that
returns a value
Function invocation
x := yAny expressionexpression
(x := y)Any expression, enclosed in
parentheses
(expression)
@label_aThe identifier of a procedure,
subprocedure, or label prefixed with
Code space item
@ or a read-only array optionally
prefixed with @, with or without an
index
Table 25 Arithmetic Expressions
ExampleSyntax
var-1operand
-var-1- operand
+var-1 * 2+ operand arithmetic-operator operand
var-1 / var-2operand arithmetic-operator operand
var-1 / (-var-2)operand arithmetic-operator operand
72 Expressions