next up previous contents
Next: External Procedures Up: The Building Blocks of Previous: The Building Blocks of   Contents

Program Units

An F95 application will usually consist of several program units. One of them is the main program unit, where the execution of the program starts, and where, usually, it ends if everything went all right with the computation. The main program unit is delimited by the following keywords:

program $\langle$program_name$\rangle$
$\qquad \vdots$  
end program pname

The other four types of program units defined in F95 are external functions, external subroutines, modules and block data units. The beginnings and ends of these units are designated by the following syntaxes, respectively:

function $\langle$function_name$\rangle$
end function $\langle$function_name$\rangle$
subroutine $\langle$subroutine_name$\rangle$
end subroutine $\langle$subroutine_name$\rangle$

module $\langle$module_name$\rangle$
end module  $\langle$module_name$\rangle$

block data $\langle$block_data_name$\rangle$
end block data $\langle$block_data_name$\rangle$

As a general principle, the programming task is divided into smaller subtasks, which are then individually solved. Different program units can implement different subtasks; programming units are standalone, in the sense that they do not depend upon implementation details in the body of other program units; the units communicate to each other via specific interfaces, so one unit only needs to be aware of the interfaces to other program units.

Adrian Sandu 2001-08-26