10.12 Procedures

Syntax

PROCEDURE procname statement

Procname must be a valid internal name and be unique from any other procedure name. This name will be used in a DO statement to call the following statement. When the statement has been processed, an automatic return is implied, and execution will resume on the statement following the procedure call. Statement can be any valid statement as described at the beginning of the section on statements. The keyword PROCEDURE may be abbreviated to PROC.

Procedures may be declared before or after the special procedure MAIN.

Purpose

Procedures provide a means of separating out commonly used statements or grouping together statements that perform a certain function.

Examples:

PROCEDURE adjust_bal

IF debit_flag THEN

balance := trans_amount;

ELSE

alance := -trans_amount;

PROCEDURE headings

BEGIN

PRINT TAB(20),

"C u s t o m e r M a s t e r",

NL, "Customer":18, "Name":36,

"Balance", NL, NL;

END