Previous Topic: *Program Mode

Next Topic: *Reload Subfile

*Return Code

The *Return Code field contains a return code that is passed between all standard functions. This field may be used to communicate with the calling and called functions.

You can add extra conditions to the *Return Code field. A special facility is provided on the Edit Field Conditions panel for this field, which allows you to define conditions by selecting from existing message functions. The conditions created have the same name as the selected message function (for example, user quit requested) and have the message identifier used to implement the message (USR0156) as a condition value.

If you want to specify a fast exit (for example, pressing F15 when using a function that is called by another function exits you from both functions), the *Return Code field would be used in the PGM context as follows:

  1. In the called program you would use the *Exit Program built-in function to specify an exit from the program when F15 is pressed. The parameter for this function is the *Return code field which you would specify as the condition *User QUIT requested:

.—CASE <<< |—CTL.*CMD key is CF15 <<< | Add new records function <<< | *Exit program - return code CND. *User QUIT requested <<< ‘—ENDCASE

  1. In the calling program you would specify, immediately after the call to the subsidiary function, that if the return code returned corresponds to the condition *User QUIT requested, quit the (calling) program:

Execute subsidiary function

.—CASE <<< |—PGM. *Return code is *User QUIT requested <<< | *Exit program - return code CND. *User QUIT requested <<< ‘—ENDCASE