COBOL RETURNING, RETURN-CODE, getReturnValue, and getReturnCode parameters

If the COBOL module specifies a RETURNING parameter, it can be retrieved from the stub using the stub.getReturnValue() method. The method returns the Java™ object representation of the RETURNING parameter, which is the data bindings class generated by the COBOL call stub generator tool.

See the following information about the COBOL module and its parameters:

  • If the COBOL module does not specify a RETURNING parameter, then the getReturnValue() method is not generated for the stub.
  • If the COBOL module sets the RETURN-CODE special register, its value can be retrieved from the stub using the stub.getReturnCode() method. The method returns an int.
  • If the COBOL module does not set the RETURN-CODE special register, then the getReturnCode() method always returns 0.
  • If the COBOL module specifies a RETURNING parameter, and sets the RETURN-CODE special register, then COBOL ignores the RETURN-CODE register. In this case, the stub.getReturnValue() method returns the RETURNING parameter, and the stub.getReturnCode() method always returns 0.
Table 1. stub.getReturnValue() and stub.getReturnCode() methods return summary . This table summarizes what is returned by the stub.getReturnValue() and stub.getReturnCode() methods based on what is specified in the COBOL code.
COBOL specifies: stub.getReturnValue() stub.getReturnCode()
RETURNING The RETURNING parm 0
RETURN-CODE (not generated) RETURN-CODE
Both RETURNING and RETURN-CODE The RETURNING parm 0
Neither (not generated) 0