Compaq Fortran
Compaq Fortran
User Manual for
OpenVMS Alpha Systems
Order Number:
AA-QJRWB-TE
April 1999
This manual provides information about the Compaq Fortran (formerly DEC
Fortran 90 and DIGITAL Fortran 90) program development environment on
Compaq OpenVMS Alpha systems.
It describes compiling, linking, running, and debugging Compaq Fortran
programs. It also describes the run-time environment, including
run-time performance, I/O and error-handling support, data types,
numeric data conversion, calling other procedures, and compatibility
with Compaq Fortran 77 (formerly DEC Fortran).
Revision/Update Information:
This manual replaces the DEC Fortran 90 User Manual for OpenVMS AXP
Systems AA-QJRWA-TE.
Software Version:
Compaq Fortran for OpenVMS Alpha Systems Version 7.2 or higher
Compaq Computer Corporation
Houston, Texas
First Printing, April 1995
Revision, April 1999
Copyright ©1995, 1999 Compaq Computer Corporation
Compaq, the COMPAQ logo, DEC, DECnet, DIGITAL, POLYCENTER, VAX, and VMS
are registered in the U.S. Patent and Trademark Office.
AXP, DEC Fortran, DECwindows, OpenVMS, and VAX FORTRAN are trademarks
of Compaq Computer Corporation.
Microsoft, NT, and Windows are either trademarks or registered
trademarks of Microsoft Corporation in the United States and other
countries.
CRAY is a registered trademark of Cray Research, Incorporated.
Hewlett-Packard and HP-UX are registered trademarks of the
Hewlett-Packard Company.
IBM is a registered trademark of International Business Machines, Inc.
IEEE is a registered trademark of the Institute of Electrical and
Electronics Engineers, Inc.
KAP is a registered trademark of Kuck and Associates, Inc.
Motif is a registered trademark of the Open Software Foundation, Inc.,
licensed by Compaq;
OpenMP and the OpenMP logo are trademarks of OpenMP Architecture Review
Board.
RISC System/6000 is a registered trademark of International Business
Machines, Inc.
SUN is a registered trademark of Sun Microsystems, Inc.
System\370 is a registered trademark of International Business
Machines, Inc.
UNIX is a registered trademark in the United States and other countries
licensed exclusively through X/Open Company Ltd.
Other product names mentioned herein may be trademarks of respective
companies.
Compaq shall not be liable for technical or editorial errors
or omissions contained herein. The information in this document is
subject to change without notice.
Cover graphic, photographs: Copyright © 1997 PhotoDisc, Inc.
Cover graphic, image: CERN, European Laboratory for Particle Physics:
ALICE detector on CERN's future accelerator, the LHC, Large Hadron
Collider.
This document is available on CD-ROM.
This document was prepared using VAX DOCUMENT, Version V3.2-1m.
Preface
This manual describes the Compaq Fortran compiler command, compiler, and
run-time environment. This includes how to compile, link, execute, and
debug Compaq Fortran programs on an Alpha system (Alpha processor
architecture) running the Compaq OpenVMS Alpha operating system. It
also describes performance guidelines, I/O and error-handling support,
calling other procedures, and compatibility.
Intended Audience
This manual makes the following assumptions about you, the reader:
- You already have a basic understanding of the Fortran 90/95
language. Tutorial Fortran 90/95 language information is widely
available in commercially published books (see the online release notes
or the Preface of the Compaq Fortran Language Reference Manual).
- You are familiar with the operating system commands used during
program development and a text editor. Such information is available in
your operating system documentation set.
- You have access to the Compaq Fortran Language Reference Manual, which describes the Compaq
Fortran 90/95 language.
Structure of This Document
This manual consists of the following chapters and appendixes:
- Chapter 1 introduces the programmer to the Compaq Fortran compiler,
its components, and related commands.
- Chapter 2 describes the FORTRAN command qualifiers in detail.
- Chapter 3 describes how to link and run a Compaq Fortran program.
- Chapter 4 describes the OpenVMS Debugger and some special
considerations involved in debugging Fortran programs. It also lists
some relevant programming tools and commands.
- Chapter 5 describes ways to improve run-time performance,
including general software environment recommendations, appropriate
FORTRAN command qualifiers, data alignment, efficiently performing I/O
and array operations, other efficient coding techniques, profiling, and
optimization.
- Chapter 6 provides information on Compaq Fortran I/O, including
statement forms, file organizations, I/O record formats, file
specifications, logical names, access modes, logical unit numbers, and
efficient use of I/O.
- Chapter 7 lists run-time messages and describes how to control
certain types of I/O errors in your I/O statements.
- Chapter 8 describes the native Fortran OpenVMS Alpha data types,
including their numeric ranges, representation, and floating-point
exceptional values. It also discusses the intrinsic data types used
with numeric data.
- Chapter 9 describes how to access unformatted files containing
numeric little endian and big endian data different than the format
used in memory.
- Chapter 10 describes how to call routines and pass arguments to
them.
- Chapter 11 describes how to utilize OpenVMS Record Management
Services (RMS) from a Compaq Fortran program.
- Chapter 12 describes how to access records using indexed
sequential access.
- Chapter 13 gives an introduction on how to exchange and share
data among both local and remote processes.
- Chapter 14 describes facilities that
can be used to handle---in a
structured and consistent fashion---special conditions (errors or
program-generated status conditions) that occur in large programs with
many program units.
- Appendix A describes the compatibility between Compaq Fortran for
OpenVMS Alpha systems and Compaq Fortran on other platforms, especially
Compaq Fortran 77 for OpenVMS systems.
- Appendix B describes diagnostic messages issued by the
Compaq Fortran compiler and lists and describes messages from the
Compaq Fortran Run-Time Library (RTL) system.
- Appendix C lists the Compaq Fortran logical names recognized at
compile-time and run-time.
- Appendix D identifies the Compaq Fortran include files that define
symbols for use in Compaq Fortran programs.
- Appendix E contains examples of the use of a variety of system
services.
Associated Documents
The following documents may also be useful to Compaq Fortran programmers:
- Compaq Fortran Language Reference Manual
Describes the Compaq Fortran 95 source language
for reference purposes, including the format and use of statements,
intrinsic procedures, and other language elements. Compaq Fortran
extensions to the appropriate Fortran standard are identified by
blue color in the printed and online documents. It also
provides an overview of new Fortran 90 and Fortran 95 features (not
available in FORTRAN-77). Language differences among Compaq Fortran
platforms are identified.
- Compaq Fortran Installation Guide for OpenVMS Alpha Systems
Explains how to install Compaq Fortran on OpenVMS
Alpha systems using POLYCENTER® Software Installation (PCSI)
software, including prerequisites and requirements.
- Compaq Fortran online release notes
Provide the most recent information on this version of
Compaq Fortran. You can view or print the ASCII version of the online
release notes from:
- SYS$HELP:FORTRAN.RELEASE_NOTES
Other forms of the release notes (PostScript) are also provided,
using the file name:
- SYS$HELP:FORTRAN_RELEASE_NOTES.*
- Compaq Fortran online DCL HELP
Summarizes the Compaq Fortran command-line qualifiers, explains
run-time messages, and provides a quick-reference summary of language
topics. To use online HELP, type either of the following commands:
- Operating system documentation
The operating system
documentation set describes the DCL commands (such as LINK), OpenVMS
routines (such as system services and run-time library routines),
OpenVMS concepts, and other aspects of the programming environment.
For OpenVMS Alpha systems, sources of programming information
include the following:
- OpenVMS Programming Environment Manual
- OpenVMS Programming Concepts Manual
- OpenVMS Programming Interfaces: Calling a System Routine
- OpenVMS Debugger Manual
- Alpha Architecture Reference Manual
- Alpha Architecture Handbook
For information on the documentation for the OpenVMS Alpha
operating system, including a list of books in the programmer's kit,
see the Overview of OpenVMS Documentation.
OpenVMS VAX® to OpenVMS Alpha porting
information can be found in the Migrating an Application from
OpenVMS VAX to OpenVMS Alpha. (For Fortran-specific porting
information, see Appendix A.)
You can also use online DCL HELP for various OpenVMS commands and most
routines by typing HELP. For the Debugger (and other tools), type HELP
after you invoke the Debugger. For information on operating system
messages, use the HELP/MESSAGE command.
- Other layered product documentation
If you are using a
programming-related layered product package from Compaq®, consult
the appropriate documentation for the layered product package for use
of that product.
Sending Compaq Your Comments on This
Manual
We welcome your comments on this or any other Compaq Fortran manual.
You can send comments to us in the following ways:
- Internet electronic mail: fortran@compaq.com
- FAX: 603-884-0120 Attn: Languages Documentation,
ZKO2-3/K35
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 the Compaq 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.
You may also send comments, questions and suggestions about the Compaq
Fortran product to the following Internet mail address:
fortran@compaq.com. Please note, however, that this address is for
informational inquiries only. It is not a formal support channel.
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.
Conventions Used in this Document
This manual uses the conventions shown in Table 1:
Table 1 Conventions Used in This Document
Convention |
Meaning |
$
|
This manual uses a dollar sign ($) to represent the user prompt.
|
[Return]
|
This symbol indicates that you must press the named key on the keyboard.
|
Ctrl/
x
|
This symbol indicates that you must press the Ctrl key while you
simultaneously press the key labeled
x.
|
$
FORT
_File:
|
This manual displays system prompts and responses using a monospaced
font. Typed user input is displayed in a bold monospaced font.
|
newterm
|
Bold type indicates the introduction of a new term in text.
|
variable
|
Italic type indicates important information, a complete title of a
manual, or variable information, such as user-supplied information in
command or option syntax.
|
|
Large braces enclose lists from which you must choose one item. The
large braces do not appear in HTML output. For example:
|
[ ]
|
Square brackets enclose items that are optional. For example:
BLOCK DATA [nam]
|
...
|
A horizontal ellipsis means that the item preceding the ellipsis can be
repeated. For example:
s[,s]...
|
.
.
.
|
A vertical ellipsis in a figure or example means that not all of the
statements are shown.
|
real
|
This term refers to all floating-point intrinsic data types as a group.
|
complex
|
This term refers to all complex floating-point intrinsic data types as
a group.
|
logical
|
This term refers to logical intrinsic data types as a group.
|
integer
|
This term refers to integer intrinsic data types as a group.
|
DECwindows, DECwindows Motif
|
References to DECwindows or DECwindows Motif refer to DECwindows Motif
software.
|
Fortran
|
This term refers to language information that is common to ANSI
FORTRAN-77, ANSI/ISO Fortran 90, ANSI/ISO Fortran 95, and Compaq
Fortran 90.
|
Fortran 90
|
This term refers to language information that is common to ANSI/ISO
Fortran 90 and Compaq Fortran. For example, a new language feature
introduced in the Fortran 90 standard.
|
Fortran 95
|
This term refers to language information that is common to ISO Fortran
95 and Compaq Fortran. For example, a new language feature introduced
in the Fortran 95 standard.
|
Compaq Fortran
(DEC Fortran 90)
|
The term Compaq Fortran (formerly DEC Fortran 90 and DIGITAL Fortran
90) refers to language information that is common to the Fortran 90 and
95 standards, and any Compaq Fortran extensions. Since the Fortran 90
standard is a superset of the FORTRAN-77 standard, Compaq Fortran also
supports the FORTRAN-77 standard. Compaq Fortran supports all of the
deleted features of the Fortran 95 standard.
|
Compaq Fortran 77
(DEC Fortran)
|
The term Compaq Fortran 77 (formerly DEC Fortran) refers to language
information that is common to the FORTRAN-77 standard and any Compaq
Fortran 77 extensions.
|
VMS®, OpenVMS
|
References to VMS, VMS system, OpenVMS, or OpenVMS system refer to the
OpenVMS operating system.
|
Chapter 1
Getting Started
Compaq Fortran (formerly DEC Fortran 90 and DIGITAL Fortran 90)
conforms to:
- The American National Standard Fortran 90 (ANSI X3.198-1992), which
is the same as the International Standards Organization standard
(ISO/IEC 1539:1991 (E)).
- The Fortran 95 standard (ISO/IEC 1539:1998 (E)).
Compaq Fortran supports all of the deleted features of the Fortran 95
standard.
Compaq Fortran also includes partial support for the High Performance
Fortran Language Specification.
Compaq Fortran also includes support for programs that conform to the
previous Fortran standards (ANSI X3.9-1978 and ANSI X3.0-1966), the
International Standards Organization standard ISO 1539-1980 (E), the
Federal Information Processing Institute standard FIPS 69-1, and the
Military Standard 1753 Language Specification.
The ANSI committee X3J3 is currently answering questions of
interpretation of Fortran 90 ands 95 language features. Any answers
given by the ANSI committee that are related to features implemented in
Compaq Fortran may result in changes in future releases of the Compaq
Fortran compiler, even if the changes produce incompatibilities with
earlier releases of Compaq Fortran.
Compaq Fortran provides a number of extensions to the Fortran 90 and 95
standards. Compaq Fortran extensions to the latest Fortran standard are
generally provided for compatibility with Compaq Fortran 77 extensions
to the ANSI FORTRAN-77 standard.
When creating new programs that need to be standard-conforming for
portability reasons, you should avoid or minimize the use of extensions
to the latest Fortran standard. Extensions to the appropriate Fortran
standard are identified visually in the Compaq Fortran Language Reference Manual, which defines the
Compaq Fortran language.
This chapter provides information on the following topics:
- A summary of aspects of the Fortran 90/95 language related to the
Compaq Fortran program development environment on OpenVMS Alpha systems
( Section 1.1)
- The commands used to create, compile, link, and run a small program
( Section 1.2)
- The commands used to create, compile, link, and run a sample main
program that has separate files for a module and a function declaration
( Section 1.3)
- A summary of the important program development stages and tools
( Section 1.4)
1.1 The Compaq Fortran Programming Environment
The following aspects of Fortran 90/95 are relevant to the compilation
environment and should be considered before extensive coding begins:
- To install Compaq Fortran on your system, first obtain the
appropriate OpenVMS Alpha Software Product Library (media) CD-ROM. Then
perform the installation using the POLYCENTER Software Installation
(PCSI) utility (PRODUCT INSTALL command), as described in Compaq Fortran Installation Guide for OpenVMS Alpha Systems.
- Once Compaq Fortran is installed, you can:
- Use the FORTRAN command to compile source files. Use the LINK
command to link object files into executable programs.
- Use the online HELP FORTRAN command and this manual to provide
information about the FORTRAN command.
- Make sure you have adequate process memory space, especially if
your programs use large arrays as data. Your system manager (or
designated privileged user) may be able to overcome this problem by
checking and possibly increasing the following:
- Your process memory (working set)
Your system manager can use
the Authorize Utility to adjust your process working set quotas, page
file quota, and limits.
- System-wide virtual memory limits
Your system manager can use
SYSGEN to change parameters (such as WSMAX and VIRTUALPAGECNT), which
take effect after the system is rebooted.
- Page file space on your system
Your system manager can use
SYSGEN or AUTOGEN to increase page file sizes or create new page files.
Your system manager needs to INSTALL any new page files available to
the system by modifying system startup command procedures and rebooting
the system.
- System hardware resources, such as physical memory and disk space
You can check the current memory limits using the SHOW WORKING_SET
command. To view peak memory use after compiling or running a program,
use the SHOW PROCESS/ACCOUNTING command. Your system manager can use
these commands (or SHOW PROCESS/CONTINUOUS) for a currently running
process and the system-side MONITOR command.
For example, the
following DCL (shell) commands check the current limits and show the
current use of some of these limits:
$ SHOW WORKING_SET
...
$ SHOW PROCESS/ACCOUNTING
...
|
- Make sure you have an adequate process open file limit,
especially if your programs use a large number of module files.
During compilation, your application may attempt to use more module
files than your open file limit allows. In this case, the Compaq Fortran
compiler will close a previously opened module file before it opens
another to stay within your open file limit. This results in slower
compilation time. Increasing the open file limit may improve
compilation time in such cases.
You can view the per-process limit
on the number of open files (Open file quota or FILLM) by using the
SHOW PROCESS/QUOTA command:
Your system manager needs to determine the maximum per-process
limit for your system by checking the value of the CHANNELCNT SYSGEN
parameter and (if necessary) increasing its value.
- You can define the
FORT$LIBRARY logical name to specify a user-defined text library that
contains source text library modules referenced by INCLUDE statements.
The compiler searches first for libraries specified on the command line
and also in the system-supplied default library (see Section 2.4).
If you need to set these logical names frequently, consider setting
them in your LOGIN.COM file, or ask your system manager to set them as
system-wide logical names in a system startup command procedure.
For more information on using FORT$LIBRARY, see Section 2.2.4.
- You can define the FORT$INCLUDE logical name to specify a directory
to be searched for the following files:
- Module files specified by a USE statement (module name is used as a
file name)
- Source files specified by an INCLUDE statement, where a file name
is specified without a directory name
- Text library files specified by an INCLUDE statement, where a file
name is specified without a library name
You can also use the FORTRAN command line to specify:
- Additional directories to be searched
- The name of a library to be searched
- Whether to search in the process default directory or the directory
where the source file resides that references the include source file
or text library
For more information on the FORT$INCLUDE logical name and related
FORTRAN command qualifiers, see Section 2.2.3 and Section 2.2.4.
If
you need to set logical names frequently, consider setting them in your
LOGIN.COM file, or ask your system manager to set them as system-wide
logical names in a system startup command procedure.
Several other
logical names can similarly be used during program execution (see
Appendix C).
- Your Compaq Fortran source files can be in free or fixed form. You
can indicate the source form used in your source files by using certain
file types or a command-line qualifier:
- For files using fixed form, specify a file type of FOR or F.
- For files using free form, specify a file type of F90.
- You can also specify the /SOURCE_FORM qualifier on the FORTRAN
command line to specify the source form for all files on that command
line.
For example, if you specify a file as PROJ_BL1.F90 on a FORTRAN
command line (and omit the /SOURCE_FORM=FIXED qualifier), the FORTRAN
command assumes the file PROJ_BL1.F90 contains free form source code.
A special type of fixed source form is tab form (a Compaq extension
described in the Compaq Fortran Language Reference Manual).
- Each source file to be compiled must contain at
least one program unit (main program, subroutine, function, module,
block data). Consider the following aspects of program development:
- Modularity and Efficiency
For a large application, using a set
of relatively small source files promotes incremental application
development.
When application run-time performance is important,
compile related source files together (or the entire application). When
compiling multiple source files, separate file names with plus signs
(+) to concatenate source files and create a single object file. This
allows certain interprocedure optimizations to minimize run-time
execution time (unless you specify certain qualifiers).
- Code reuse
Modules, external subprograms, and included files
allow reuse of common code.
Code used in multiple places in a program should be placed in a module,
external subprogram (function or subroutine), or included file.
When using modules and external subprograms, there is one copy of
the code for a program. When using INCLUDE statements, the code in the
specified source file is repeated once for each INCLUDE statement.
In most cases, using modules or external subprograms makes programs
easier to maintain and minimizes program size.
For More Information:
- On modules, see Section 2.2.3.
- On include files, see Section 2.2.4.
- On Compaq Fortran source forms, see the Compaq Fortran Language Reference Manual.
- On recognized file types, see Section 2.2.1.
- On the types of subprograms and using an explicit interface to a
subprogram, see Chapter 10.
- On performance considerations, including compiling source programs
for optimal run-time performance, see Chapter 5.
- On logical names, see the OpenVMS User's Manual.
1.2 Commands to Create and Run an Executable Program
Example 1-1 shows a short Fortran 90/95 main program using free form
source.
Example 1-1 Sample Main Program |
! File hello.f90
PROGRAM HELLO_TEST
PRINT *, 'hello world'
PRINT *, ' '
END PROGRAM HELLO_TEST
|
To create and revise your source files, use a text editor, such as the
Extensible Versatile Editor (EVE). For instance, to use EVE to edit the
file HELLO.F90, type:
The following FORTRAN command compiles the program named HELLO.F90. The
LINK command links the compiled object file into an executable program
file named HELLO.EXE:
$ FORTRAN HELLO.F90
$ LINK HELLO
|
In this example, because all external routines used by this program
reside in standard OpenVMS libraries searched by the LINK command,
additional libraries or object files are not specified on the LINK
command line.
To run the program, type the RUN command and the program name:
If the executable program is not in your current default directory,
specify the directory before the file name. Similarly, if the
executable program resides on a different device than your current
default device, specify the device name and directory name before the
file name.
For More Information:
- On the OpenVMS programming environment, see the operating system
documents listed in Preface of this manual.
- On specifying files on an OpenVMS system, see OpenVMS User's Manual.