Programming Statements


Statements That Define and Execute Modules

Modules are used for two purposes:

  • to create a user-defined subroutine or function. That is, you can define a group of statements that can be called from anywhere in the program.

  • to define variables that are local to the module. That is, you can create a separate environment with its own symbol table (see Understanding Symbol Tables).

A module always begins with a START statement and ends with a FINISH statement. A module is either a function or a subroutine. When a module returns a single parameter, it is called a function. A function is invoked by its name in an assignment statement. Otherwise, a module is a subroutine. You can execute a subroutine by using either the RUN statement or the CALL statement.