COBOL Manual for TNS and TNS/R Programs

Intrinsic Functions
HP COBOL Manual for TNS and TNS/R Programs522555-006
14-53
REVERSE Function
REVERSE Function
REVERSE, an alphanumeric function, returns a string that is the same as its argument,
except that the characters are in reverse order.
argument
is an alphabetic or alphanumeric argument at least one character in length.
The returned value is the same as argument, except that the characters are in
reverse order. That is, if argument has n characters, then the i th character of
argument is the (n - i +1)th character of the returned value.
Example 14-36. REVERSE Function
Code:
DISPLAY FUNCTION REVERSE ("A")
DISPLAY FUNCTION REVERSE ("1234567")
DISPLAY FUNCTION REVERSE ("stressed")
DISPLAY FUNCTION REVERSE ("ABC 123")
Output:
A
7654321
desserts
321 CBA
( )
REVERSEFUNCTION argument
VST459.vsd