Introducing Built-In Functions

The assembler provides built-in functions for the SETA, SETB and SETC expressions.

Each function returns one value - an arithmetic value for SETA, a binary bit for SETB, and a character string for SETC.

There are two different forms of invocation for the built-in functions:

In either format, the operand is an expression of the type expected by the built-in function. (The particular details of the number of operands and the operand type are provided with the information for each built-in function.)

Conditional-assembly functions do not always behave like functions in traditional high-level languages. The results of a function might not be automatically converted to the type expected in the invoking expression, and nested invocations may not produce expected results. In general, it is safest to invoke only one conditional assembly function in a SET expression or AIF statement.

Some functions are available in one format, some are available in both. Table 57, which provides a summary of all the built-in functions, shows the forms in which a function is available.

Because some function names such as AND and OR are used both as arithmetic operators and as logical connectives, their use may appear to be ambiguous. For example, the function (1 AND 2) in an arithmetic expression would be interpreted as the logical AND of the two 32-bit SETA expressions 1 and 2, resulting in zero. In a logical expression, the two nonzero operands would be converted to 1 (meaning "true") and the result would be 1. Similarly, the function (1 XOR 2) in an arithmetic expression would have value 3, while in a logical expression it would have value 0.

To avoid ambiguities, such function names are interpreted as arithmetic operators in SETA statements, and as logical operators in SETB and AIF statements.

Table 57. Summary of Built-In Functions and Operators
Function Type L-E1 F-I2 Result3 Operands3 Topic
A2B Representation conversion X C A ***
A2C Representation conversion X C A ***
A2D Representation conversion X C A ***
A2X Representation conversion X C A ***
AND Logical X A A ***
AND Logical X B B ***
AND NOT Logical X B B ***
B2A Representation conversion X A C ***
B2C4 Representation conversion X C C ***
B2D Representation conversion X C C ***
B2X4 Representation conversion X C C ***
BYTE Representation conversion X X C A ***
C2A Representation conversion X A C ***
C2B4 Representation conversion X C C ***
C2D Representation conversion X C C ***
C2X4 Representation conversion X C C ***
D2A Representation conversion X A C ***
D2B Representation conversion X C C ***
D2C Representation conversion X C C ***
D2X Representation conversion X C C ***
DCLEN String manipulation X A C ***
DCVAL String manipulation X C C ***
DEQUOTE String manipulation X C C ***
DOUBLE String manipulation X X C C ***
FIND String scanning X X A C ***
INDEX String scanning X X A C ***
ISBIN Validity checking X B C ***
ISDEC Validity checking X B C ***
ISHEX Validity checking X B C ***
ISSYM Validity checking X B C ***
LOWER String manipulation X X C C ***
NOT Logical X X A A ***
NOT Logical X B B ***
OR Logical X A A ***
OR Logical X B B ***
OR NOT Logical X B B ***
SIGNED Representation conversion X X C A ***
SLA Shift X A A ***
SLL Shift X A A ***
SRA Shift X A A ***
SRL Shift X A A ***
SYSATTRA Information retrieval X C C ***
SYSATTRP Information retrieval X C C ***
UPPER String manipulation X X C C ***
X2A Representation conversion X A C ***
X2B4 Representation conversion X C C ***
X2C4 Representation conversion X C C ***
X2D Representation conversion X C C ***
XOR Logical X A A ***
XOR Logical X B B ***
XOR NOT Logical X B B ***
Notes:
  1. If a X is in this column, the function is available in the "logical-expression" format.
  2. If a X is in this column, the function is available in the "function-invocation" format.
  3. Possible values in these columns are:
    A
    Arithmetic
    B
    Binary
    C
    Character
  4. For these functions, the maximum length of the operand (and output) is the maximum string length that the assembler supports, currently 1024.

[ Top of Page | Previous Page | Next Page | Contents | Index ]