Application programming on z/OS
Previous topic | Next topic | Contents | Glossary | Contact z/OS | PDF


PL/I program structure

Application programming on z/OS

PL/I is a block-structured language, consisting of packages, procedures, statements, expressions, and built-in functions, as shown in Figure 1.

PL/I programs are made up of blocks. A block can be either a subroutine, or just a group of statements. A PL/I block allows you to produce highly modular applications, because blocks can contain declarations that define variable names and storage classes. Thus, you can restrict the scope of a variable to a single block or a group of blocks, or you can make it known throughout the compilation unit or a load module.

Figure 1. PL/I application structure
PL/I application structure

A PL/I application consists of one or more separately loadable entities, known as a load modules. Each load module can consist of one or more separately compiled entities, known as compilation units. Unless otherwise stated, a program refers to a PL/I application or a compilation unit.

A compilation unit is a PL/I package or an external procedure. Each package can contain zero or more procedures, some or all of which can be exported. A PL/I external or internal procedure contains zero or more blocks.

A PL/I block is either a PROCEDURE or a begin block, any of which contains zero or more statements and/or zero or more blocks. A procedure is a sequence of statements delimited by a procedure statement and a corresponding end statement, as shown in Figure 2. A procedure can be a main procedure, a subroutine, or a function.

Figure 2. A PROCEDURE block
 A:  procedure;
             statement-1
             statement-2
  
      .
  
      .
  
      .
            
            statement-n
            end Name;

A begin block is a sequence of statements delimited by a begin statement and a corresponding end statement, as shown in Figure 3. A program is terminated when the main procedure is terminated.

Figure 3. BEGIN block
 B:  begin;
      statement-1
      statement-2
  
      .
  
      .

      statement-n
      end B;




Copyright IBM Corporation 1990, 2010