Overview | Statement List | Example
PROC[/dummy argument list]
This statement is used to establish a subprogram in GRIP. PROC must be the first statement in the subprogram and contains all of the dummy arguments. Subprograms are complete programs which perform specific tasks under the directions of calling programs. The subprogram may be executed as often as necessary by the calling program and may in turn call other subprograms. A subprogram may contain any number of source statements. To terminate the program, a HALT statement is used.
If values are to be passed from the calling program to the subprogram, there must be a dummy argument in the argument list for each value or array. A maximum of 25 are allowed. In addition, the dummy arguments must be of the same type and quantity as those being passed by the calling program.
Except for simple numerical values and constants, all dummy arguments must be declared. Objects and numbers are declared the same in the sub-program as in a main program. For string variables, however, the length parameter may not be declared.
The variables in a subprogram, including those in the dummy argument list, are considered local variables and are known only to the subprogram. For this reason the same variable names may be used in the main program and individual subprograms without conflict. It should be noted, however, that it is the location in the argument and not the variable name, that determines what the assignment is. For example, if the call statement, "CALL/'SUB1',X,Y,Z", was issued and the PROC statement in the subprogram was, "PROC/Z,Y,X", the variable assignment in the subprogram would be Z=X, Y=Y and X=Z.
The maximum number of externals/subroutine calls in a program is 50.
Parameter |
Description |
dummy argument list |
A list of arguments or variables which are passed from the calling program to the subroutine. |