Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Fortran Compiler for HP-UX: HP Fortran Programmer's Reference > Chapter 10 HP Fortran statements

END

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

Marks the end of a program unit or procedure.

Syntax

END [keyword [name]]
keyword

is one of the keywords BLOCK DATA, FUNCTION, MODULE, PROGRAM, or SUBROUTINE. When the END statement is used for an internal procedure or module procedure, the FUNCTION or SUBROUTINE keyword is required.

name

is the name given to the program unit. If name is specified, keyword must also be specified.

Description

The END statement is the last statement of a program unit (that is, a main program, function, subroutine, module, or block data subprogram), an internal procedure, or a module procedure. It is the only statement that is required within a program unit.

Examples

The following example illustrates the use of the END statement to indicate the end of a main program. Notice that, even though the main program unit is given a name, the END PROGRAM statement does not require it:

PROGRAM main_prog
...
END PROGRAM

In the next example, the END statement marks the end of an internal function and must therefore specify the keyword FUNCTION. However, it is not required that the name, get_args, be also specified:

FUNCTION get_args (arg1, arg2)
...
END FUNCTION get_args

The following example uses the END statement to indicate the end of a block data subprogram. Because the END statement specifies the program unit name, it must also specify the keyword BLOCK DATA:

BLOCK DATA main_data
...
END BLOCK DATA main_data

Related statements

BLOCK DATA, FUNCTION, MODULE, PROGRAM, and SUBROUTINE

Related concepts

For information about program units, see “Program units”.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.