Directives
EXIT Terminate Subprogram and Return
   
Format EXIT [ERR | err_val ]

Where:

err_val Numeric expression whose value will be returned as an error status to the program initiating the subprogram (e.g., via a CALL directive).
  Restriction: You can only use this directive in subprograms. Otherwise, ProvideX returns Error #37: Directive can only execute in subprogram.
   
Description Use the EXIT directive in a subprogram to terminate the subprogram and return control to the initiating program.

You can have the subprogram return an error code value to the calling program by using EXITERR or by specifying the error value following the EXIT directive. Use an integer from 0 to 32767 for the error value. To have the calling program process an error value other than zero, use the ERR= option in the CALL directive (or use SETERR numeric expression). A value is 0 (zero), which generally indicates record busy and force an autormatic retry will not when generated by an EXIT directive..

When you use EXIT in a compound statement, it must be the final directive:

9000 PRINT "Subroutine done"; EXIT

   
See Also CALL Transfer to Subprogram.
PERFORM Call Subprogram, Pass Variables.
   
Examples

10000 ! In subprogram "SUBPR"
10005 TEST_EXIT:
10010 SETERR UNKNOWN_ERROR
10020 ENTER TEST$
10030 LET T=NUM(TEST$(5,6))
10040 EXIT
10050 UNKNOWN_ERROR:
10060 EXIT ERR