If a prototyped procedure is defined to return a value then you must call the procedure within an expression if you want to make use of the return value. Use the procedure name in a manner that is consistent with the data type of the specified return value. For example, if a procedure is defined to return a numeric, then the call to the procedure within an expression must be where a numeric would be expected.
Figure 63 shows the prototype for a procedure CVTCHR that takes a numeric input parameter and returns a character string. Figure 64 shows how the procedure might be used in an expression.
* Prototype for CVTCHR
* - returns a character representation of the numeric parameter
* Examples: CVTCHR(5) returns '5 '
* CVTCHR(15-124) returns '-109 '
D CVTCHR PR 31A
D NUM 30P 0 VALUE
C EVAL STRING = 'Address: ' +
C %TRIM(CVTCHR(StreetNum))
C + ' ' + StreetName
* If STREETNUM = 427 and STREETNAME = 'Mockingbird Lane', after the
* EVAL operation STRING = 'ADDRESS: 427 Mockingbird Lane'