The RETURNING phrase in COBOL is used in CALL and FUNCTION statements to specify the variable that will receive the value returned by a subprogram or intrinsic function. It is essential for modern modular and functional COBOL programming.
1234567891011* CALL statement with RETURNING CALL "SUBPROG" USING arg1 arg2 RETURNING result-var * FUNCTION statement with RETURNING COMPUTE result-var = FUNCTION MAX(a, b) * Example subprogram header PROCEDURE DIVISION USING arg1 arg2 RETURNING result-var * Example with both USING and RETURNING CALL "CALCULATE-TAX" USING income, rate RETURNING tax-amount
RETURNING is used to specify the receiving variable for a returned value from a subprogram or function.
1. What is the primary use of the RETURNING phrase in COBOL?
2. Which COBOL statement commonly uses the RETURNING phrase?
3. How is RETURNING used with intrinsic functions?
4. Which of the following is a valid RETURNING usage?
5. Is RETURNING required in all CALL statements?