For Fortran

You can set and alter the user return code using the SYSRCS or SYSRCX Fortran services. You can test the value of this field using SYSRCT. Depending on how the enclave is terminated, the value of the user return code could become the enclave return code.

If the enclave terminates as a result of a STOP statement or a CALL SYSRCX statement that explicitly specifies a value to be used as a return code, then that value becomes the enclave user return code. For example, either of the following Fortran statements terminate the enclave and sets the enclave return code to 101:
  • STOP 101
  • CALL SYSRCX(101)
If the enclave terminates as a result of a language construct that depends on a previously established enclave user return code, then the previously established enclave user return code becomes the enclave return code. For example, the following sequence of Fortran statements sets the enclave return code to 201:
  • CALL SYSRCS(201)
  • CALL EXIT

The call to SYSRCS sets the enclave user return code to 201 and the call to EXIT causes the enclave user return code to be used as the enclave return code.

The return code modifier depends on the operating system and the severity of the condition, as shown in Table 1.

Table 1. Return code modifiers used by Language Environment to determine enclave return codes
Condition severity Return code modifier
2 2000
3 3000
4 4000

If the enclave terminates due to an unhandled condition and the ABTERMENC(RETCODE) runtime option is in effect, then the enclave return code is the sum of the enclave user return code and the return code modifier. For example, when CALL SYSRCS(201) is executed and termination occurs as a result of an unhandled condition of severity 3, the enclave return code is 3201.