Useful functions
function(arguments)
- Argument
- Example
- Blank
- function( )
- Constant
- function(55)
- Symbol
- function(#5)
- Literal string
- function('With a literal string')
- Option recognized by function
- function(option)
- Another function
- function(function(arguments))
- Combination of argument types
- function('Literal string', #5, option)
Some of the built-in functions provided by REXX that you might find useful are:
- ABS
-
Returns the absolute value of number. For example, if you want to select segments in which field
#12
contains a value in the range -10 to +10, you can specify:ABS(#12) <= 10
- MAX
-
Returns the largest number from the list specified. For example, if you want to select segments in which any of fields
#10, #11,
or#12
contains a value greater than 55, you can specify:MAX(#10, #11, #12) > 55
- MIN
-
Returns the smallest number from the list specified. For example, if you want to select segments in which any of fields
#10, #11,
or#12
contains a value less than 0, you can specify:MIN(#10, #11, #12) < 0
- POS
-
Returns the position of one string, needle, in another, haystack. Returns 0 if needle is a null string, or is not found in haystack, or if start is greater than the length of haystack. By default the search starts at the first character of haystack (that is, the value of start is 1). You can override this by specifying start (which must be a positive whole number), the point at which the search starts. For example, if you want to select segments in which any character in field
#22
is a blank, you can specify:POS(' ',#22) > 0
- SUBSTR
-
Returns the substring of string that begins at the nth character and is of length length, padded with pad if necessary. n is a positive whole number. If n is greater than the length of string, then only pad characters are returned.
If you omit length, the rest of the string is returned. The default pad character is a blank.
For example, if you want to select segments in which characters 4-6 of field#22
are the string 'NOT', you can specify:SUBSTR(#22,4,3) = 'NOT'