Table 1 describes the type of operand allowed for each unary operator and the type of the result. Table 2 describes the type of operands allowed for each binary operator and the type of the result. Table 3 describes the type of operands allowed for each built-in function and the type of the result. Prototyped procedures support whatever data types are defined in the prototype definition.
| Operation | Operand Type | Result Type |
|---|---|---|
| - (negation) | Numeric | Numeric |
| + | Numeric | Numeric |
| NOT | Indicator | Indicator |
| Operator | Operand 1 Type | Operand 2 Type | Result Type |
|---|---|---|---|
| + (addition) | Numeric | Numeric | Numeric |
| + (addition) | Date | Duration | Date |
| + (addition) | Time | Duration | Time |
| + (addition) | Timestamp | Duration | Timestamp |
| - (subtraction) | Numeric | Numeric | Numeric |
| - (subtraction) | Date | Duration | Date |
| - (subtraction) | Time | Duration | Time |
| - (subtraction) | Timestamp | Duration | Timestamp |
| * (multiplication) | Numeric | Numeric | Numeric |
| / (division) | Numeric | Numeric | Numeric |
| ** (exponentiation) | Numeric | Numeric | Numeric |
+ (concatenation)![]() |
Character, Graphic, UCS-2![]() |
Character, Graphic, UCS-2![]() |
Character, Graphic, UCS-2![]() |
| + (add offset to pointer) | Basing Pointer | Numeric | Basing Pointer |
| - (subtract pointers) | Basing Pointer | Basing Pointer | Numeric |
| - (subtract offset from pointer) | Basing Pointer | Numeric | Basing Pointer |
| Note: For
the following operations the operands may be of any type, but the
two operands must be of the same type.
|
|||
| = (equal to) | Any | Any | Indicator |
| >= (greater than or equal to) | Any | Any | Indicator |
| > (greater than) | Any | Any | Indicator |
| <= (less than or equal to) | Any | Any | Indicator |
| < (less than) | Any | Any | Indicator |
| <> (not equal to) | Any | Any | Indicator |
| AND (logical and) | Indicator | Indicator | Indicator |
| OR (logical or) | Indicator | Indicator | Indicator |
| Operation | Operands | Result Type |
|---|---|---|
| %ABS | Numeric | Numeric |
| %ALLOC | Numeric | Pointer |
| %BITAND | Character:character{:character...} | Character |
| %BITAND | Numeric:numeric{:numeric...} | Numeric |
| %BITNOT | Character | Character |
| %BITNOT | Numeric | Numeric |
| %BITOR | Character:character{:character...} | Character |
| %BITOR | Numeric:numeric{:numeric...} | Numeric |
| %BITXOR | Character:character | Character |
| %BITXOR | Numeric:numeric | Numeric |
%CHAR![]() |
Character, Graphic, UCS-2 {: ccsid
}![]() |
Varying length character with specified
CCSID![]() |
%CHAR![]() |
Numeric![]() |
Varying length character with job
CCSID![]() |
%CHAR![]() |
Date, Time or Timestamp {: Format
of Date, Time, or Timestamp}![]() |
Character with job CCSID![]() |
| %CHECK | Character, Graphic, or UCS-2 {: Numeric} | Numeric |
| %CHECKR | Character, Graphic, or UCS-2 {: Numeric} | Numeric |
| %DATE | {Character, Numeric, or Timestamp {: Date Format}} | Date |
| %DAYS | Numeric | Numeric (duration) |
| %DEC | Character : Numeric constant : Numeric constant | Numeric (packed) |
| %DEC | Numeric {: Numeric constant : Numeric constant} | Numeric (packed) |
| %DEC | Date, time or timestamp {: format} | Numeric (packed) |
| %DECH | Character : Numeric constant : Numeric constant | Numeric (packed) |
| %DECH | Numeric : Numeric constant : Numeric constant | Numeric (packed) |
| %DECPOS | Numeric | Numeric (unsigned) |
| %DIFF | Date, Time, or Timestamp : Date,
Time, or Timestamp : Unit {: Fractional-seconds}![]() |
Numeric (duration) (compatible with both) |
| %DIV | Numeric : Numeric | Numeric |
| %EDITC | Non-float Numeric : Character Constant of Length 1 {:*CURSYM | *ASTFILL | character currency symbol} | Character (fixed length) |
| %EDITFLT | Numeric | Character (fixed length) |
| %EDITW | Non-float Numeric : Character Constant | Character (fixed length) |
| %EOF | {File name} | Indicator |
| %EQUAL | {File name} | Indicator |
| %ERROR | Indicator | |
| %FLOAT | Character | Numeric (float) |
| %FLOAT | Numeric | Numeric (float) |
| %FOUND | {File name} | Indicator |
%GRAPH![]() |
Character, Graphic, or UCS-2 {: ccsid}![]() |
Graphic with specified CCSID![]() |
| %HOURS | Numeric | Numeric (duration) |
| %INT | Character | Numeric (integer) |
| %INT | Numeric | Numeric (integer) |
| %INTH | Character | Numeric (integer) |
| %INTH | Numeric | Numeric (integer) |
| %LEN | Any | Numeric (unsigned) |
| %LOOKUPxx | Any : Any array {: Numeric {: Numeric}} | Numeric (unsigned) |
| %MINUTES | Numeric | Numeric (duration) |
| %MONTHS | Numeric | Numeric (duration) |
| %MSECONDS | Numeric | Numeric (duration) |
| %OCCUR | Multiple Occurrence Data Structure | Multiple Occurrence Data Structure |
| %OPEN | File name | Indicator |
| %PARMS | Numeric (integer) | |
| %REALLOC | Pointer : Numeric | Pointer |
| %REM | Numeric : Numeric | Numeric |
| %REPLACE | Character : Character {: Numeric {: Numeric}} | Character |
| %REPLACE | Graphic : Graphic {: Numeric {: Numeric}} | Graphic |
| %REPLACE | UCS-2 : UCS-2 {: Numeric {: Numeric}} | UCS-2 |
%SCAN![]() |
Character : Character {: Numeric {: Length}}![]() |
Numeric (unsigned)![]() |
%SCAN![]() |
Graphic : Graphic {: Numeric {: Length}}![]() |
Numeric (unsigned)![]() |
%SCAN![]() |
UCS-2 : UCS-2 {: Numeric {: Length}}![]() |
Numeric (unsigned)![]() |
%SCANR![]() |
Character : Character {: Numeric {: Length}}![]() |
Numeric (unsigned)![]() |
%SCANR![]() |
Graphic : Graphic {: Numeric {: Length}}![]() |
Numeric (unsigned)![]() |
%SCANR![]() |
UCS-2 : UCS-2 {: Numeric {: Length}}![]() |
Numeric (unsigned)![]() |
| %SCANRPL | Character : Character : Character {: Numeric {: Numeric}} | Character |
| %SCANRPL | Graphic : Graphic : Graphic {: Numeric {: Numeric}} | Graphic |
| %SCANRPL | UCS-2 : UCS-2 : UCS-2 {: Numeric {: Numeric}} | UCS-2 |
| %SECONDS | Numeric | Numeric (duration) |
| %SHTDN | Indicator | |
| %SQRT | Numeric | Numeric |
| %STATUS | {File name} | Numeric (zoned decimal) |
| %STR | Basing Pointer {: Numeric} | Character |
| Note: When
%STR appears on the left-hand side of an expression, the second operand
is required.
|
||
| %SUBARR | Any: Numeric {:Numeric} | Any (same type as first operand) |
| %SUBDT | Date, Time, or Timestamp : Unit | Numeric (unsigned) |
%SUBDT![]() |
Date, Time, or Timestamp : Unit
: Digits { : Fractional-seconds }![]() |
Numeric (packed decimal)![]() |
| %SUBST | Character : Numeric {: Numeric} | Character |
| %SUBST | Graphic : Numeric {: Numeric} | Graphic |
| %SUBST | UCS-2 : Numeric {: Numeric} | UCS-2 |
| %THIS | Object | |
| %TIME | {Character, Numeric, or Timestamp {: Time Format}} | Time |
| %TIMESTAMP | {Character, Numeric {: Timestamp
Format { : Fractional-seconds}}}![]() |
Timestamp |
%TIMESTAMP![]() |
{*SYS,Timestamp,Date { Fractional-seconds
}}![]() |
Timestamp![]() |
| %TLOOKUPxx | Any table: Any table {: Any} | Indicator |
| %TRIM | Character { : Character } | Character |
| %TRIM | Graphic { : Graphic} | Graphic |
| %TRIM | UCS-2 { : UCS-2 } | UCS-2 |
| %TRIML | Character { : Character } | Character |
| %TRIML | Graphic { : Graphic} | Graphic |
| %TRIML | UCS-2 { : UCS-2 } | UCS-2 |
| %TRIMR | Character { : Character } | Character |
| %TRIMR | Graphic { : Graphic} | Graphic |
| %TRIMR | UCS-2 { : UCS-2 } | UCS-2 |
| %UCS2 | Character, Graphic, or UCS-2 {: ccsid} | Varying length UCS-2 value with specified CCSID |
| %UNS | Character | Numeric (unsigned) |
| %UNS | Numeric | Numeric (unsigned) |
| %UNSH | Character | Numeric (unsigned) |
| %UNSH | Numeric | Numeric (unsigned) |
| %XFOOT | Numeric | Numeric |
| %XLATE | Character, Graphic, or UCS-2 : Character, Graphic, or UCS-2 : Character, Graphic, or UCS-2 {: Numeric} | Character, Graphic, or UCS-2 |
| %YEARS | Numeric | Numeric (duration) |
| Note: For
the following built-in functions, arguments must be literals, named
constants or variables.
|
||
| %PADDR | Character | Procedure or prototype pointer |
| %SIZE | Any {: *ALL} | Numeric (unsigned) |
| Note: For
the following built-in functions, arguments must be variables. However,
if an array index is specified, it may be any valid numeric expression.
|
||
| %ADDR | Any | Basing pointer |
| %ELEM | Any | Numeric (unsigned) |
| %NULLIND | Any | Indicator |
| Note: The
following built-in functions are not true built-in functions in that
they do not return a value. They are used in some free-form operations.
|
||
| %FIELDS | Any{: Any {: Any ...} | Not Applicable |
| %HANDLER | Prototype name : Any | Not Applicable |
| %KDS | Data structure {: numeric } | Not Applicable |
| %XML | Character or UCS-2 { : Character } | Not Applicable |