A PROCEDURE declaration defines a procedure and associates a procedure identifier with it. The procedure can then be invoked by using the procedure identifier.
<procedure declaration>
──┬───────────┬─┬──────────────────┬─ PROCEDURE ──<procedure heading>──► ├─ PRIVATE ─┤ └─<procedure type>─┘ └─ PUBLIC ──┘ ►─ ; ──<procedure body>────────────────────────────────────────────────┤
<procedure type>
──┬─<word type>──────────────┬─────────────────────────────────────────┤ ├───────────────┬─ STRING ─┘ └─<string type>─┘
<procedure heading>
──<identifier>─┬─────────────────────────┬─────────────────────────────┤
├─<formal parameter part>─┤
└─ () ────────────────────┘The PRIVATE and PUBLIC specifiers can only be used for procedures that are declared within a structure block or a connection block. The PRIVATE specifier limits visibility of the procedure to the scope of the structure block or the connection block. A PRIVATE procedure cannot be accessed using a structure or connection block qualifier. The PUBLIC specifier allows the procedure to be accessed using a structure or connection block qualifier. If neither PRIVATE nor PUBLIC is specified, the default value is PUBLIC and access to the procedure using a structure or connection block qualifier is allowed.
A procedure becomes a function by preceding the word PROCEDURE with a procedure type and by assigning a value (the result to be returned by the procedure) to the procedure identifier somewhere within the procedure body. This kind of procedure is referred to in ALGOL as a typed procedure. For examples of typed procedures, see procedures RESULT, HEXPROC, MATCH, and MUCHO under “Examples of PROCEDURE Declaration” later in this section. A typed procedure can be used either as a statement or as a function. When used as a statement, the returned result is automatically discarded.
If the <string type> variable is not specified in the <procedure type> construct in the declaration of a string procedure, then the string procedure is of the default character type. The default character type can be designated by the compiler control option ASCII. If no such compiler control option is used, the default character type is EBCDIC. For more information, refer to Default Character Type.
If a program is a procedure, parameters can be passed to it. If the procedure is initiated through CANDE (which passes only one parameter, a quoted string), then the formal parameter must be declared as a real array with an asterisk lower bound. If the procedure is initiated through Work Flow Language (WFL), a formal parameter for a string actual parameter must be declared as a real array with an asterisk lower bound. Both CANDE and WFL pass strings as arrays. For more information, refer to the EXECUTE command in the CANDE Operations Reference Manual and the RUN statement in the Work Flow Language (WFL) Programming Reference Manual. When the program is initiated, the array is allocated the minimum number of words needed to contain the string plus at least one null character (48"00"), which is appended to the end of the string.

