Instruction Manual

Language Reference Reference 271
Publication 1398-PM601A-EN-P October 2000
WORDS
SUB
Subroutine Program Structure
Purpose Mark the beginning of a subroutine and assign a name (up to eight characters) to the
subroutine. Subroutines must end with a RETURN statement. Subroutines cannot be
nested-that is, another subroutine cannot be called from within a subroutine. Program
flow must return from the present subroutine before calling another subroutine.
Syntax SUB name
name Subroutine names can be up to 32 characters long. Names cannot
be keywords of reserved words. They must begin with a letter and
contain only alphanumeric characters and underscores ( _ ).
Remarks Subroutines should be located at the end of program after all of the statements of the
main program. An END statement should follow the RETURN of the last subroutine
in a program. Subroutines of one program are not accessible to another program.
See Also RETURN, CALL
Example
SUB MySub
... Statements
RETURN
SYSERROR
Cause System Error System
Purpose Used to cause a system error. If set to a number, this will cause a system fault.
Syntax SYSERROR= value
value Value can be a constant, a nonvolatile flag Gn, a volatile Vn, or
another system variable.
Remarks Refer to the Appendix Error Messages on page 418 for a list of errors.
See Also FLAG, ENUM, WFLAG, WNUM, SYSWARN
Example
SYSERROR = 35 ;will cause an Excessive Speed fault.