HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
SAVE (statement and attribute)
Chapter 10 457
Derived type objects
Records
If the name of a common block appears in
save-list
, it must be delimited by slashes (for
example, /my_block/); all variables in the named common block are saved. If a common block
is saved in one program unit, it must be saved in all program units (except main) where it
appears.
HP Fortran always saves all common blocks.
The following must not appear in
save-list
:
Formal argument names
Procedure names
Selected items in a common block
Variables declared with the AUTOMATIC statement or attribute
Function results
Automatic data objects (such as automatic arrays, allocatable arrays, automatic character
strings, and Fortran 90 pointers)
Initializing a variable in a DATA statement or in a type declaration statement implies that the
variable has the SAVE attribute, unless the variable is in a named common block in a block
data subprogram.
A SAVE statement in a main program unit has no effect.
Examples
The SAVE statement in the following example saves the variables a, b, and c, as well as the
variables in the common block dot:
SUBROUTINE matrix
SAVE a, b, c, /dot/
RETURN
The SAVE statement in the next example saves the values of all of the variables in the
subroutine fixit:
SUBROUTINE fixit
SAVE
RETURN
Related statements
AUTOMATIC and STATIC