Built-in functions and subroutines are procedures provided by the Open PL/I language. They can be used wherever an expression is valid.
The built-in functions and subroutines provided by Open PL/I can be grouped into the following classes:
- Arithmetic built-in functions, which do one of the following:
- Provide information about the properties of arithmetic values
- Perform ordinary arithmetic calculations
- Manipulate variables with a specified precision, returning the value resulting from the operation.
These include:
ABS
|
INT
|
MOD
|
RANDOM
|
SIGN
|
CEIL
|
MAX
|
MULTIPLE
|
ROUND
|
TRUNC
|
FLOOR
|
MIN
|
POSINT
|
|
|
- Array-handling built-in functions, which provide information about arrays and array elements. These include:
ALL
|
DIMENSION
|
LBOUND
|
PROD
|
SUM
|
ANY
|
HBOUND
|
POLY
|
|
|
- Buffer-management built-in functions, which operate on an area of storage specified by an address and a number of bytes known as a
buffer. These include:
HEXIMAGE
|
PLIFILL
|
PLIMOVE
|
PLIOVER
|
XMLCHAR
|
- Condition-handling built-in functions, which provide information about interrupts that are caused by signaled conditions. Use the condition-handling built-in functions to determine the cause of a condition that has occurred. These functions can only be used within the scope of an ON-unit or dynamic descendant for the condition specific to the built-in function, or the ERROR or FINISH condition when raised as an implicit action. All other uses are out of context.
Condition-handling built-in functions include:
DATFIELD
|
ONCODE
|
ONKEY
|
ONSOURCE
|
ONSUBCODE
|
ONCHAR
|
ONFILE
|
ONLOC
|
|
|
- Date/time built-in functions. These functions return or manipulate date and time information in terms of days, seconds, and character date/time stamps. Some of date/time built-in functions allow you to specify the date/time patterns to be used. The time zone and accuracy for these functions are system dependent. Date/time built-in functions include:
DATE
|
DAYSTODATE
|
SECS
|
SECSTODAYS
|
VALIDDATE
|
DATETIME
|
DAYSTOSECS
|
SECSTODATE
|
TIME
|
WEEKDAY
|
DAYS
|
REPATTERN
|
|
|
|
- Floating-point inquiry built-in functions, which return information about specified floating-point variable arguments. These include:
- Input/output built-in functions, which determine the current state of a file. These built-in functions include:
COUNT
|
FILEDDINT
|
FILEOPEN
|
LINENO
|
PAGENO
|
FILEDDWORD
|
|
|
|
|
- Integer manipulation built-in functions. These functions perform operations on integer variables and return the result of the operation. These include:
- Mathematical and trigonometric built-in functions, which perform standard mathematical calculations in floating-point. Any argument that is not floating-point is converted. These built-ins include:
ACOS
|
COS
|
ERFC
|
LOG2
|
SQRT
|
ASIN
|
COSD
|
EXP
|
SIN
|
TAN
|
ATAN
|
COSH
|
LOG
|
SIND
|
TAND
|
ATAND
|
ERF
|
LOG10
|
SINH
|
TANH
|
ATANH
|
|
|
|
|
- Miscellaneous built-in functions and subroutines. These include:
COLLATE
|
OMITTED
|
PLIRETV
|
PLISRTx
|
STRING
|
FLUSH
|
PACKAGENAME
|
PLISAXA
|
PLITEST
|
TALLY
|
HEX
|
PLIDUMP
|
PLISAXB
|
PRESENT
|
UNSPEC
|
LPIPARAMCOUNT
|
PLIRETC
|
PLISAXC
|
RESIGNAL
|
|
- Precision-handling built-in functions, which manipulate variables with specified precisions, and return the value resulting from the operation. These include:
ADD
|
DECIMAL
|
FIXED
|
MULTIPLY
|
PRECISION
|
BINARY
|
DIVIDE
|
FLOAT
|
|
|
- Preprocessor built-in functions, which are invoked in the same way that programmer-defined functions are invoked, except that they must be invoked with the correct number of arguments. See the topic
Preprocessor Built-In Functions for more information.
- Pseudovariables. These can appear only:
- on the left side of an assignment statement
- as the target in a DO-specification and then only if it is one of SUBSTR, REAL, IMAG or UNSPEC
- in the data list of a GET statement or in the STRING option of a PUT statement
- as the string name in a KEYTO or REPLY option.
These include:
- Conversion built-in functions, which convert data from one data type to another. These include:
BINARYVALUE
|
BYTE
|
CHARACTER
|
CONJG
|
RANK
|
- Storage-handling built-in functions, which provide information on the storage requirements and location of variables. These include:
ADDR
|
EMPTY
|
OFFSETDIFF
|
POINTERADD/PTRADD
|
SIZE
|
ADDRDATA
|
NULL
|
OFFSETSUBTRACT
|
POINTERDIFF/PTRDIFF
|
STORAGE
|
ALLOCATION
|
OFFSET
|
OFFSETVALUE
|
POINTERSUBTRACT/PTRSUBTRACT
|
SYSNULL
|
CURRENTSTORAGE
|
OFFSETADD
|
POINTER
|
POINTERVALUE
|
|
-
String handling built-in functions, which process character-string and bit-string, graphic and WIDECHAR strings. String arguments can be an arithmetic expression to be converted to string either according to data conversion rules or according to the rules given in the function description.
Some functions do not support WIDECHAR data.
String handling built-in functions include:
BIT
BOOL
|
INDEX
|
LOWERCASE
|
REPEAT
|
TRIM
|
COPY
|
LENGTH
|
MPSTR
|
SYSVERSION
|
UPPERCASE
|
GRAPHIC
|
LOW
|
PROCEDURENAME
|
TRANSLATE
|
VALID
|
HIGH
|
|
|
|
|
- Built-in character-handing functions which accept or return WIDECHAR character-type only.
WIDECHAR / WCHAR
|
WCHARVAL
|
WHIGH
|
WLOW
|
|
- Built-in character-handing functions which accept WIDECHAR arguments where character-type arguments apply; when the return value is a character-string the return type is WIDECHAR if any WIDECHAR arguments are passed.
CENTERLEFT / CENTRELEFT
|
INDEX
|
RANK
|
SEARCH
|
TALLY
|
CENTERRIGHT / CENTRERIGHT
|
LEFT
|
REPEAT
|
SEARCHR
|
VERIFY
|
CHARACTER / CHAR
|
LENGTH
|
REVERSE
|
SUBSTR
|
VERIFYR
|
COPY
|
MAXLENGTH
|
RIGHT
|
|
|
This section describes each built-in. The built-ins are presented in alphabetical order by name. Each built-in definition includes a purpose, syntax, and description (the effect of the built-in). Examples (one or more examples of the built-in usage and results) and restrictions (any restrictions in the use of the built-in) may also be included.
Arguments to built-ins are effectively passed by value, that is, no alteration of the arguments is done.