# Preface

This manual contains the complete description of the Compaq Fortran (formerly DIGITAL Fortran) programming language, which includes Fortran 95, Fortran 90, and High Performance Fortran language features. It contains information on language syntax and semantics, on adherence to various Fortran standards, and on extensions to those standards.

This manual applies to the following:

- Compaq Fortran for Tru64 UNIX® (formerly DIGITAL UNIX®) Alpha Systems
- Compaq Fortran for Linux® Alpha Systems
- Compaq Fortran for OpenVMSTM Alpha Systems
- Compaq Visual Fortran

For details on the features of the compilers and how to improve the run-time performance of Fortran programs, see your user manual or programmer's guide.

For more information on the Compaq Fortran products, see http://www.compaq.com/fortran.

## Intended Audience

This manual is intended for experienced applications programmers who have a basic understanding of Fortran concepts and the Fortran 95/90 language, and are using Compaq Fortran in either a single-platform or multiplatform environment.

Some familiarity with parallel programming concepts and your operating system is helpful. This manual is not a Fortran or programming tutorial.

## Structure of this Document

This manual consists of the following chapters and appendixes:

- Chapter 1 describes language standards, language compatibility, and Fortran 95/90 features.
- Chapter 2 describes program structure, the Fortran 95/90 character set, and source forms.
- Chapter 3 describes intrinsic and derived data types, constants, variables (scalars and arrays), and substrings.
- Chapter 4 describes expressions and assignment.
- Chapter 5 describes specification statements, which declare the attributes of data objects.
- Chapter 6 describes dynamic allocation.
- Chapter 7 describes constructs and statements that can transfer control within a program.
- Chapter 8 describes program units (including modules), subroutines and functions, and procedure interfaces.
- Chapter 9 summarizes all intrinsic procedures.
- Chapter 10 describes data transfer input/output (I/O) statements.
- Chapter 11 describes the rules for I/O formatting.
- Chapter 12 describes auxiliary I/O statements you can use to perform file operations on OpenVMS systems.
- Chapter 13 describes auxiliary I/O statements you can use to perform file operations on Tru64 UNIX, Linux, and Windows systems.
- Chapter 14 describes compilation control statements.
- Chapter 15 describes compiler directives.
- Chapter 16 describes scope and association.
- Appendix A describes obsolescent language features in Fortran 95 and Fortran 90.
- Appendix B describes some statements and language features supported for programs written in older versions of Fortran.
- Appendix C describes the Compaq Fortran character sets available on OpenVMS, Tru64 UNIX, and Linux systems. For information on character sets available on Windows systems, see the online documentation for those systems.
- Appendix D describes data representation models for numeric intrinsic functions.
- Appendix E summarizes the run-time library module routines available for Windows systems.
- Appendix F summarizes the library routines available for Tru64 UNIX and Linux systems.
- Appendix G summarizes the `3hpf` HPF_LIBRARY routines available for Tru64 UNIX systems.
- Appendix H summarizes Compaq Fortran extensions to the Fortran 95 Standard (including High Performance Fortran extensions).
- The Glossary contains abbreviated definitions of some commonly used terms in this manual.

## Associated Documents

The following documents contain information directly related to the topics in this manual:

- Your user manual or programmer's guide

  These manuals provide information about Compaq Fortran program development and the run- time environment. They describe compiling, linking, running, and debugging Compaq Fortran programs, run-time error-handling and I/O, performance guidelines, data types, numeric data conversion, calling other procedures and library routines, and compatibility with Compaq Fortran 77 (formerly DIGITAL Fortran 77).

  The programmer's guide for Windows systems is published by Digital Press (Butterworth-Heinemann). Its title is Digital Visual Fortran Programmer's Guide, authors: M. Etzel and K. Dickinson; ISBN: 1-55558-218-4.

- Your installation guide or getting started guide

  This guide provides information on how to install Compaq Fortran on your operating system.

- Your operating system documentation sets

  These sets provide detailed information about components and features of your operating system, such as commands, tools, libraries, and other aspects of the programming environment.

- Standards and Specifications

  The following copyrighted standard and specification documents contain precise descriptions of many of the features found in Compaq Fortran:

  - American National Standard Programming Language FORTRAN, ANSI X3.9-1978
  - American National Standard Programming Language Fortran 90, ANSI X3.198-1992

    This Standard is equivalent to: International Standards Organization Programming Language Fortran, ISO/IEC 1539:1991 (E).

  - American National Standard Programming Language Fortran 95, ANSI X3J3/96-007

    This Standard is equivalent to: International Standards Organization Programming Language Fortran, ISO/IEC 1539-1:1997 (E).

  - High Performance Fortran Language Specification, Version 1.1, Technical Report CRPC-TR-92225

## Other Sources of Information

This section alphabetically lists some commercially published documents that provide reference or tutorial information on Fortran 95, Fortran 90, and High Performance Fortran:

- Fortran 90 Explained by M. Metcalf and J. Reid; published by Oxford University Press, ISBN 0-19-853772-7.
- Fortran 90/95 Explained by M. Metcalf and J. Reid; published by Oxford University Press, ISBN 0-19-851888-9.
- Fortran 90/95 for Scientists and Engineers by S. Chapman; published by McGraw-Hill, ISBN 0-07-011938-4.
- Fortran 90 Handbook by J. Adams, W. Brainerd, J. Martin, B. Smith, and J. Wagener; published by Intertext Publications (McGraw-Hill), ISBN 0-07-000406-4.
- Fortran 90 Programming by T. Ellis, I. Philips, and T. Lahey; published by Addison-Wesley, ISBN 0201-54446-6.
- High Performance Fortran Handbook by C. Koelbel, D. Loveman, R. Schreiber, G, Steele Jr., and M. Zosel; published by MIT Press, ISBN 0-262-11185-3.
- Introduction to Fortran 90/95 by Stephen J. Chapman; published by WCB McGraw-Hill, ISBN 0-07-011969-4.
- Programmer's Guide to Fortran 90, Second Edition by W. Brainerd, C. Goldberg, and J. Adams; published by Unicomp, ISBN 0-07-000248-7.

Compaq does not endorse these books or recommend them over other books on the same subjects.

## Platform Labels

A platform is a combination of operating system and central processing unit (CPU) that provides a distinct environment in which to use a product (in this case, a language). This manual contains information for the following language platforms:

| Platform
--- | ---
Language | Operating System | CPU1
Compaq Fortran2 | OpenVMS | Alpha
| Tru64 UNIX3 | Alpha
| Linux | Alpha
| Microsoft® Windows® 2000 | ia32
| Microsoft Windows NT® 4.0 | ia32
| Microsoft Windows 98 | ia32
| Microsoft Windows Me | ia32
| Microsoft Windows 95 | ia32
| Microsoft 64-bit Windows | ia64
1 See below for a description of ia32 and ia64. 2 Formerly the DIGITAL Fortran language. 3 Formerly the DIGITAL UNIX operating system.

Information in this manual applies to all supported platforms unless it is otherwise labeled for a specific platform, as follows:

VMS | Applies to OpenVMS on Alpha processors.
U*X | Applies to Tru64 UNIX and Linux on Alpha processors.
TU*X | Applies to Tru64 UNIX on Alpha processors.
WNT | Applies to Microsoft Windows 2000 and Windows NT 4.0 on AMDTM and Intel® x86 processors, and 64-bit Windows operating systems on Intel IA-64 processors.
W9* | Applies to Microsoft Windows 98, Windows Millennium Edition (Me), and Windows 95 on AMD and x86 processors.
Alpha | Applies to operating systems on Alpha processors.
ia32 | Applies to 32-bit Windows operating systems on AMD and x86 processors.
ia64 | Applies to 64-bit Windows operating systems on IA-64 processors.

For example, the ASM intrinsic function is labeled "(Alpha only)", so this intrinsic function is valid only for operating systems running on Alpha processors.

## Compaq Fortran World Wide Web Pages

If you have Internet access and a World Wide Web (WWW) browser, you are invited to view the Compaq Fortran home page, located at the following URL:

  http://www.compaq.com/fortran

This Web site contains information about software patch kits, example programs, and additional product information.

## Send Us Your Comments

Compaq welcomes your comments on this or any other Compaq Fortran manual. You can send comments by Internet electronic mail to:

  `fortran@compaq.com`

If you have suggestions for improving particular sections or find any errors, please indicate the title, order number, and section numbers. Compaq also welcomes general comments.

## Getting Help from Compaq

If you have a customer support contract and have comments or questions about Compaq Fortran software, you can contact Compaq's Customer Support Center (CSC), preferably using electronic means such as DSNlink. In the United States, customers can call the CSC at 1-800-354-9000.

## Conventions Used in this Manual

Table 1 describes the conventions used in this manual.

Table 1 Conventions Used in This Manual

Convention | Meaning
--- | ---
    {      }
| Large braces enclose lists from which you must choose one item. For example:
    { STATUS    }
    { DISPOSE   }
    { DISP      }
    . . .
| In code examples, a horizontal ellipsis means that not all of the statements are shown. In syntax forms, the symbol means that the item preceding the ellipsis can be repeated. For example:
    s[,s] ...
[ ] | Square brackets enclose items that are optional in statements; for example:
    BLOCK DATA [nam]
In examples, square brackets are used to show arrays.
    .
    .
    .
| A vertical ellipsis in a figure means that not all of the statements are shown.
INTRINSIC, D_LINES | Uppercase letters indicate statement keywords and OpenVMS compiler options.
`monospaced` | This typeface indicates a Tru64 UNIX command or pathname, and is also used in code examples.
compiler option | This term refers to OpenVMS qualifiers, Tru64 UNIX and Linux options, and Windows options that can be used on the compiler command line.
`cat(1)` | Cross-references to online reference pages include the appropriate section number in parentheses. For example, a reference to `cat(1)` indicates that you can find the material on the `cat` command in Section 1 of the reference pages. To read online reference pages, use the `man` command. Your operating system documentation also includes reference page descriptions.
extensions | This color indicates extensions to the Fortran 95 Standard. These extensions may or may not be implemented by other compilers that conform to the language standard.
Fortran | This term refers to language information that is common to ANSI FORTRAN 77, ANSI/ISO Fortran 95/90, and Compaq Fortran.
Fortran 95/90 | This term refers to language information that is common to ANSI/ISO Fortran 95 and ANSI/ISO Fortran 90.
Fortran 95 | This term refers to language features of ANSI/ISO Fortran 95.
Fortran 90 | This term refers to language features of ANSI/ISO Fortran 90.
Message Passing Interface | This term refers to an optional license and software that allows parallel execution of programs on Tru64 UNIX systems. Without this option, programs can only execute on a single processor, either as a scalar (non-parallel) program or as a (special case) single processor parallel program.
integer | This term refers to the INTEGER(KIND=1), INTEGER(KIND=2), INTEGER (INTEGER(KIND=4)), and INTEGER(KIND=8) data types as a group.
real | This term refers to the REAL (REAL(KIND=4)), DOUBLE PRECISION (REAL(KIND=8)), and REAL(KIND=16) data types as a group.
REAL | This term refers to the default data type of objects declared to be REAL. REAL is equivalent to REAL(KIND=4), unless a compiler option specifies otherwise.
complex | This term refers to the COMPLEX (COMPLEX(KIND=4)), DOUBLE COMPLEX (COMPLEX(KIND=8)), and COMPLEX(KIND=16) data types as a group.
logical | This term refers to the LOGICAL(KIND=1), LOGICAL(KIND=2), LOGICAL (LOGICAL(KIND=4)), and LOGICAL(KIND=8) data types as a group.
Compaq Fortran, DIGITAL Fortran | These terms refer to the same language.
OpenVMS, VMS | These terms refer to the same operating system.
Tru64 UNIX, DIGITAL UNIX | These terms refer to the same operating system.
Windows systems | This term refers to all supported Microsoft® Windows® operating systems. (See Platform Labels.)
(VMS only) | This style is used in platform labels and to emphasize text.
<Tab> | This symbol indicates a nonprinting tab character.

Next Page Table of Contents