HiLMAs reference
Back

Subroutine Handling

Next

SUBDEF

SUBDEF subroutine[,SAVEVAR=(var1,var2,...)]

 

Description

This statement defines the start of an internal subroutine. The subroutine name must match the name in calling GOSUB statement.

All the variables defined in main program are visible in this subroutine, so there isn't parameter passing in this type of subroutine.
SAVEVAR= is only for recursive subroutines and normally is not needed. SAVEVAR saves the named variables (all that are used inside the subroutine if this must self-recall) in a previously defined stack (with LSTACK= parameter in PROGRAM statement): this is necessary to permit a self-recall.

 

Parameter specifications

Parameter Name Mode Type coding Remark
1 subroutine fixed name      
  SAVEVAR=        

 

 


ENDSUB

ENDSUB

 

Description

This statement defines the end of an internal subroutine.
For every SUBDEF must be one and only one ENDSUB. Use SUBEXIT statement to leave a subroutine before its end.

 

Examples

 


Back Start Next
GOSUB Top SUBEXIT