VMS Help  —  FORTRAN  Statements  SAVE
  Causes the values and definition of objects to be saved across
  invocations of a subprogram.

  The SAVE attribute can be specified in a type declaration statement
  or SAVE statement, and takes one of the following forms:

  Type Declaration Statement:

   type, [att-ls,] SAVE [,att-ls] :: [obj [,obj]...]

  Statement:

   SAVE [obj [,obj]...]

     type      Is a data type specifier.

     att-ls    Is an optional list of attribute specifiers.

     obj       Is the name of an object, or the name of a
               common block enclosed in slashes (such as
               /CBLOCK/).

  In VSI Fortran, the definitions of COMMON variables, and local
  variables of non-recursive subprograms (other than allocatable
  arrays or variables declared AUTOMATIC), are saved by default.  To
  enhance portability and avoid possible compiler warning messages,
  HP recommends that you use the SAVE statement to name variables
  whose values you want to preserve between subprogram invocations.

  When a SAVE statement does not explicitly contain a list, all
  allowable items in the scoping unit are saved.

  A SAVE statement cannot specify the following (their values cannot
  be saved):

   o  A blank common

   o  An object in a common block

   o  A procedure

   o  A dummy argument

   o  A function result

   o  An automatic object

   o  A PARAMETER (named) constant

  Even though a common block can be included in a SAVE statement,
  individual variables within the common block can become undefined
  (or redefined) in another scoping unit.

  If a common block is saved in any scoping unit of a program (other
  than the main program), it must be saved in every scoping unit in
  which the common block appears.

  A SAVE statement has no effect in a main program.

  The SAVE attribute is compatible with the ALLOCATABLE, DIMENSION,
  POINTER, PRIVATE, PUBLIC, STATIC, TARGET, and VOLATILE attributes.
Close Help