Ending / Returning from SBX

The SBX routine will end and return to the calling program when it hits any of the following:

•   An END statement.

•   The physical end of the SBX. This is not very good form, but acts the same as END.

•   A RETURN (<expression>) statement. This is a special form of the RETURN statement used to return from a GOSUB, which takes an expression argument in parentheses. If the SBX was called as a function, via XFUNC or XFUNC$, then the <expression> is returned as the value of the function, and should be a numeric or string expression according to the way the routine is intended to be used. See External (XFUNC) Functions for details on writing and using SBX routines as functions. If the SBX was called via XCALL or VXCALL, then the <expression> is discarded and the statement treated just like END.

The only other option would be to abort directly to the dot prompt (without returning to the calling program), which you can do with the following statement:

xcall MIAMEX, MX_EXIT