02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Terminology and concepts<br />

Program units and procedures<br />

Terminology and concepts<br />

The following sections define the terms and explain the concepts that are mentioned<br />

throughout this chapter.<br />

Program units<br />

A program consists of the following program units:<br />

Main program unit<br />

External procedure, which can be either a subroutine or a function<br />

Module program unit<br />

Block data program unit<br />

A complete executable program contains one (and only one) main program unit and zero or<br />

more other program units, each of which is separately compilable. A program unit is an<br />

ordered set of constructs, statements, comments, and INCLUDE lines. The heading statement<br />

identifies the kind of program unit; it is optional in a main program unit only. An END<br />

statement marks the end of a program unit.<br />

The only executable program units are the main program and external procedures.<br />

Program execution begins with the first executable statement in the main program and ends<br />

(typically) with the last. During execution, if the main program references an external<br />

procedure, control passes to the procedure, which executes and returns control to the main<br />

program. An executing procedure can also reference other procedures or even reference itself<br />

recursively.<br />

The main program unit is described in “Main program” on page 126, and external procedures<br />

are described in “External procedures” on page 129.<br />

The nonexecutable program units are:<br />

The module program unit, which contains data declarations, user-defined type<br />

definitions, procedure interfaces, common block declarations, namelist group<br />

declarations, and subprogram definitions used by other program units. Modules are<br />

described in “Modules” on page 158.<br />

The block data program unit, which specifies initial values for variables in named<br />

common blocks. Block data program units are described in “Block data program unit” on<br />

page 166.<br />

Chapter 7 123

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!