The following examples show how the procedure body of a procedure can vary in complexity from a simple unlabeled statement to a block.
The following example declares SIMPL to be an untyped procedure with no parameters. The body of SIMPL is a single statement.
PROCEDURE SIMPL; X := X + 1
The following example declares TUFFER to be an untyped procedure with one parameter, PARAM, which is a call-by-value real variable. The body of TUFFER consists of a single statement.
PROCEDURE TUFFER(PARAM); VALUE PARAM; REAL PARAM; X := X + PARAM
In the following example, procedure RESULT is a typed procedure that returns a real value. The value to be returned is assigned to the procedure identifier by the following assignment:
RESULT :=cXc+cPARAM;
RESULT has two parameters, a call-by-name real variable and a file.
REAL PROCEDURE RESULT(PARAM,FYLEIN);
REAL PARAM;
FILE FYLEIN;
BEGIN
.
.
.
RESULT := X + PARAM;
.
.
.
ENDThe following example declares HEXPROC to be a typed procedure that returns a hexadecimal string value. The value to be returned is assigned to the procedure identifier in the assignment that makes up the body of HEXPROC.
HEX STRING PROCEDURE HEXPROC; HEXPROC := 4"123"
The following example declares MATCH to be a typed procedure that returns a Boolean value. MATCH has three parameters that are all call-by-value integer variables.
BOOLEAN PROCEDURE MATCH(A,B,C); VALUE A,B,C; INTEGER A,B,C; MATCH := A=B OR A=C OR B=C
The following example is a FORWARD PROCEDURE declaration for the procedure FURTHERON. For more information, refer to FORWARD REFERENCE Declaration.
PROCEDURE FURTHERON; FORWARD
The following example declares MUCHO to be a double-precision procedure with three parameters. DBL1 is a call-by-name double-precision variable, DBL2 is a call-by-value double-precision variable, and BOOL is a call-by-value Boolean variable. The body of MUCHO is a block.
DOUBLE PROCEDURE MUCHO(DBL1,DBL2,BOOL);
VALUE DBL2,BOOL;
DOUBLE DBL1,DBL2;
BOOLEAN BOOL;
BEGIN
REAL LOCALX,LOCALY;
.
.
.
MUCHO := DOUBLE(LOCALX,LOCALY);
END OF MUCHOThe following example declares GETDATA to be a by-calling procedure. The selection procedure is SELECTDATASOURCE. GETDATA has one parameter, a one-dimensional real array, A, with an asterisk lower bound, meaning that the lower bound is to be passed as a parameter.
PROCEDURE GETDATA(A); % BY-CALLING PROCEDURE ARRAY A[*]; BY CALLING SELECTDATASOURCE
The following example declares NUMRECORDS to be an entry point in the library DATAHANDLER. The entry point is exported from DATAHANDLER with the name COUNTRECS, but will be called NUMRECORDS in this program.
INTEGER PROCEDURE NUMRECORDS(TYPE); % LIBRARY ENTRY POINT VALUE TYPE; INTEGER TYPE; LIBRARY DATAHANDLER (ACTUALNAME="COUNTRECS")

