Reverse, Right, Sign – IBM SC34-5764-01 User Manual

Page 213: Sourceline, Space, Right sign, Sourceline space

Advertising
background image

REVERSE

REVERSE(string)

returns string, swapped end for end.

Here are some examples:

REVERSE('ABc.')

->

'.cBA'

REVERSE('XYZ ')

->

' ZYX'

RIGHT

RIGHT(string,length

,pad

)

returns a string of length length containing the rightmost length characters of string. The string returned is
padded with pad characters (or truncated) on the left as needed. The default pad character is a blank. The
length must be a positive whole number or zero.

Here are some examples:

RIGHT('abc

d',8)

->

'

abc

d'

RIGHT('abc def',5)

->

'c def'

RIGHT('12',5,'0')

->

'00012'

SIGN

SIGN(number)

returns a number that indicates the sign of number. The number is first rounded according to standard
REXX rules, just as though the operation number+0 had been carried out. Returns -1 if number is less than
0

; returns 0 if it is 0; and returns 1 if it is greater than 0.

Here are some examples:

SIGN('12.3')

->

1

SIGN(' -0.307')

->

-1

SIGN(0.0)

->

0

SOURCELINE

SOURCELINE(

n

)

returns the line number of the final line in the program if you omit n, or returns the nth line in the program
if you specify n. If specified, n must be a positive whole number and must not exceed the number of the
final line in the program.

Here are some examples:

SOURCELINE()

->

10

SOURCELINE(1)

->

'/* This is a 10-line REXX program */'

SPACE

SPACE(string

,

n

,pad

)

returns the blank-delimited words in string with n pad characters between each word. If you specify n, it
must be a positive whole number or zero. If it is 0, all blanks are removed. Leading and trailing blanks are
always removed. The default for n is 1, and the default pad character is a blank.

Functions

Chapter 14. Functions

191

Advertising