COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

Example 195 LENGTH Function
Code:
01 STUFF-1 PIC XXXX.
01 STUFF-2 PIC 9999.
MOVE "AB" TO STUFF-1.
MOVE 12 TO STUFF-2.
DISPLAY FUNCTION LENGTH(STUFF-1).
DISPLAY STUFF-2.
DISPLAY FUNCTION LENGTH(STUFF-2).
DISPLAY FUNCTION LENGTH("ABC").
Output:
4
0012
4
3
LOG Function
LOG, a numeric function, returns a value that approximates the logarithm to the base e (natural
logarithm) of its argument.
argument
is a numeric argument greater than zero.
The returned value is approximately the logarithm to the base e of the value of argument.
Example 196 LOG Function
Code:
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A PICTURE S9V99.
PROCEDURE DIVISION.
MOVE FUNCTION LOG (1) TO A.
DISPLAY A.
MOVE FUNCTION LOG (10) TO A.
DISPLAY A.
MOVE FUNCTION LOG (100) TO A.
DISPLAY A.
MOVE FUNCTION LOG (1000) TO A.
DISPLAY A.
MOVE FUNCTION LOG (10000) TO A.
DISPLAY A.
Output:
0.00
2.30
4.60
6.90
9.21
LOG10 Function
LOG10, a numeric function, returns a value that approximates the logarithm to the base 10 of its
argument.
LOG Function 671