Sheltran - PERFORM and PROC
Form:
C To invoke a procedure section:
PERFORM <procedure name>
C To define a procedure section:
PROC <procedure name>
<statement>...
CPROC
Notes:
- The procedure name must not be longer than 31 characters.
- The statements in a PROC may not include:
- STOP or RETURN
- XWHILE, XREPEAT or XFOR unless the corresponding loop is wholly
included within the range of the PROC-CPROC construct.
- A procedure section may only be defined in a program after all
PERFORMs to that PROC have occurred, i.e. PROCs normally preceed the
END statement.
- A PERFORM in a FOR-loop causes non-standard FORTRAN to be
generated.
Actions:
Whenever a PERFORM statement is encountered, the appropriate statements
between PROC and CPROC are executed.
Example:
.
.
PERFORM CLFILE
.
.
.
.
PROC CLFILE
FOR LUN=1,NUNITS
CLOSE(UNIT=LUN)
CFOR
CPROC