3. Embedded QUEL for COBOL : Precompiling, Compiling, and Linking an EQUEL Program : Coding Requirements for Writing EQUEL Programs : COBOL Function Calls
 
Share this page                  
COBOL Function Calls
COBOL supports function calls with the USING clause for UNIX or the GIVING clause for VMS. This allows a function to return a value into a declared data item. EQUEL generates many of these statements by assigning the return values into internally declared data items, and then checking the result of the function by checking the value of the data item. This is less efficient than other languages that check the return value of a function using its implicit value (stored in a register). The generated COBOL has the overhead of assigning the value to a data item. An EQUEL/COBOL generated function call that tests the result can look like:
UNIX:
lCALL "IIFUNC" USING IIRESULT
IF (IIRESULT = 0) THEN ... 
VMS:
CALL "IIFUNC" GIVING IIRESULT
IF (IIRESULT = 0) THEN ...