HiLMAs reference
Back

Subroutine Handling

Next

ROUTINE

   ROUTINE subroutine,sist-op[,(param1,param2,...)]

 

Description

ROUTINE statement define the start of an external subroutine written in Hilmas; that is a routine compiled separately and linkedited with another program. It replace PROGRAM statement that in a Hilmas external routine is forbidden: like PROGRAM statement must be the first instruction of the routine, must be unique and must be closed by the RETURN statement that replace ENDPROG.
ROUTINE has the same parameters of PROGRAM with besides a list of variables that are parameters passed by the calling program (param1, param2, etc.).
These variables can be of any type provided that:

Whereas IBM calling convention is a parameter passing by address, is transformed by Hilmas into a value passing, so original values in calling program are never modified and routine works only on a local copy of the passed parameters. Original values of the parameters can be modified adding a list of parameters to RETURN statement, that ends the subroutine.

The source of the main program can be written in any language, provided that standard IBM conventions of calling parameters are followed.

Parameter specifications

Parameter Name Mode Type coding Remark
1 subroutine fixed name     Name of the subroutine
2 operating-system fixed name      Can be only CMS,TSO,CICS,MVS,DOS
3 param1 Output Any    
4 param2 Output Any    
5 .... Output Any    

 

 


RETURN

RETURN [(param1,param2,...)]

 

Description

RETURN define the phisical end of external subroutine; param1, param2, etc. are optional and are the same parameters in input to the routine, if you want to change these values in the calling program. Parameters should not be the same variables specified in ROUTINE statement, provided that the order and the type is the same. This list can be shorted if you don't want give back the last parameters; every variable can also be replaced by a point (.) if you want to skip return of this variable.

To do a premature exit from the routine use EXIT instruction.

 

Parameter specifications

Parameter Name Mode Type coding Remark
3 param1 Input Any    
4 param2 Input Any    
5 .... Input Any    

 

Examples

 


Back Start Next
CALL Top PARSE