[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP Fortran for OpenVMS

User Manual

Order Number: AA--QJRWD--TE


January 2005

This manual provides information about the HP Fortran program development environment on HP OpenVMS systems.

Revision/Update Information: This revised manual supersedes the Compaq Fortran User Manual for OpenVMS Alpha Systems, Version 7.4.

Software Version: HP Fortran for OpenVMS Systems Version 8.0

Operating System: OpenVMS Industry Standard 64 Systems Version 8.2
OpenVMS Alpha Systems Version 8.2




Hewlett-Packard Company Palo Alto, California


© Copyright 2005 Hewlett-Packard Development Company, L.P.

Confidential computer software. Valid license from HP required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license.

The information contained herein is subject to change without notice. The only warranties for HP products and services are set forth in the express warranty statements accompanying such products and services. Nothing herein should be construed as constituting an additional warranty. HP shall not be liable for technical or editorial errors or omissions contained herein.

Intel and Itanium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

Printed in the US

ZK6443

This manual is available on CD-ROM.

Contents Index


Preface

This manual describes the HP Fortran compiler command, compiler, and run-time environment. This includes how to compile, link, execute, and debug HP Fortran programs on systems with Itanium or Alpha processor architectures running the HP OpenVMS operating system. It also describes performance guidelines, I/O and error-handling support, calling other procedures, and compatibility.

Note

In this manual, the term OpenVMS refers to both OpenVMS I64 and OpenVMS Alpha systems. If there are differences in the behavior of the HP Fortran compiler on the two operating systems, those differences are noted in the text.

Intended Audience

This manual assumes that:

  • 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 HP Fortran for OpenVMS Language Reference Manual).
  • You are familiar with the operating system commands used during program development and a text editor. Such information is available in the OpenVMS documentation set.
  • You have access to the HP Fortran for OpenVMS Language Reference Manual, which describes the HP Fortran 90/95 language.

Document Structure

This manual consists of the following chapters and appendixes:

  • Chapter 1 introduces the programmer to the HP 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 HP 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 HP 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 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 an HP 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.
  • Chapter 15 provides information on the Compaq Extended Math Library (CXML) (Alpha only), a comprehensive set of mathematical library routines callable from Fortran and other languages.
  • Appendix A describes the differences between HP Fortran on OpenVMS I64 systems and on OpenVMS Alpha systems.
  • Appendix B describes the compatibility between HP Fortran for OpenVMS systems and HP Fortran on other platforms, especially Compaq Fortran 77 for OpenVMS systems.
  • Appendix C describes diagnostic messages issued by the HP Fortran compiler and lists and describes messages from the HP Fortran Run-Time Library (RTL) system.
  • Appendix D lists the HP Fortran logical names recognized at compile-time and run-time.
  • Appendix E identifies the HP Fortran include files that define symbols for use in HP Fortran programs.
  • Appendix F contains examples of the use of a variety of system services.

Note

If you are reading the printed version of this manual, be aware that the version at the HP Fortran Web site and the version on the Documentation CD-ROM from HP may contain updated and/or corrected information.

Related Documents

The following documents are also useful:

  • HP Fortran for OpenVMS Language Reference Manual
    Describes the HP Fortran 90/95 source language for reference purposes, including the format and use of statements, intrinsic procedures, and other language elements.
  • HP Fortran Installation Guide for OpenVMS I64 Systems or HP Fortran Installation Guide for OpenVMS Alpha Systems
    Explain how to install HP Fortran.
  • HP Fortran online release notes
    Provide the most recent information on this version of HP Fortran. You can view or print the online release notes from:


    SYS$HELP:FORTRAN.RELEASE_NOTES (text version)
    SYS$HELP:FORTRAN_RELEASE_NOTES.PS (PostScript version)
    
  • HP Fortran online DCL HELP
    Summarizes the HP Fortran command-line qualifiers, explains run-time messages, and provides a quick-reference summary of language topics. To use online HELP, use this command:


    $ HELP FORTRAN
    
  • Intel Itanium Architecture Software Developer's Manual, Volume 1: Application Architecture
  • 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 systems, sources of programming information include the following:
    • OpenVMS Programming Environment Manual
    • HP OpenVMS Programming Concepts Manual
    • OpenVMS Programming Interfaces: Calling a System Routine
    • HP OpenVMS Debugger Manual
    • Alpha Architecture Reference Manual
    • Alpha Architecture Handbook

    For information on the documentation for the OpenVMS 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 Migrating an Application from OpenVMS VAX to OpenVMS Alpha. (For Fortran-specific porting information, see Appendix B.)
    OpenVMS Alpha to OpenVMS I64 porting information can be found in Porting Applications from HP OpenVMS Alpha to HP OpenVMS Industry Standard 64 for Integrity Servers.
    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.
    The following Web site contains comprehensive information on OpenVMS systems: http://www.hp.com/go/openvms

Reader's Comments

HP welcomes your comments on this manual. You can send comments by email to:


fortran@hp.com

HP Fortran Web Page

The HP Fortran Web page is located at:


http://www.hp.com/software/fortran

This Web site contains information about software patch kits, example programs, and additional product information. It also contains Web versions of this and other HP Fortran manuals.

Conventions

The following product names may appear in this manual:

  • HP OpenVMS Industry Standard 64 for Integrity Servers
  • OpenVMS I64
  • I64

All three names---the longer form and the two abbreviated forms---refer to the version of the OpenVMS operating system that runs on the Intel® Itanium® architecture.

The following conventions might be used in this manual:

Ctrl/ x A sequence such as Ctrl/ x indicates that you must hold down the key labeled Ctrl while you press another key or a pointing device button.
PF1 x A sequence such as PF1 x indicates that you must first press and release the key labeled PF1 and then press and release another key or a pointing device button.
[Return] In examples, a key name enclosed in a box indicates that you press a key on the keyboard. (In text, a key name is not enclosed in a box.)

In the HTML version of this document, this convention appears as brackets, rather than a box.

... A horizontal ellipsis in examples indicates one of the following possibilities:
  • Additional optional arguments in a statement have been omitted.
  • The preceding item or items can be repeated one or more times.
  • Additional parameters, values, or other information can be entered.
.
.
.
A vertical ellipsis indicates the omission of items from a code example or command format; the items are omitted because they are not important to the topic being discussed.
( ) In command format descriptions, parentheses indicate that you must enclose choices in parentheses if you specify more than one.
[ ] In command format descriptions, brackets indicate optional choices. You can choose one or more items or no items. Do not type the brackets on the command line. However, you must include the brackets in the syntax for OpenVMS directory specifications and for a substring specification in an assignment statement.
| In command format descriptions, vertical bars separate choices within brackets or braces. Within brackets, the choices are optional; within braces, at least one choice is required. Do not type the vertical bars on the command line.
{ } In command format descriptions, braces indicate required choices; you must choose at least one of the items listed. Do not type the braces on the command line.
bold type Bold type represents the introduction of a new term. It also represents the name of an argument, an attribute, or a reason.
italic type Italic type indicates important information, complete titles of manuals, or variables. Variables include information that varies in system output (Internal error number), in command lines (/PRODUCER= name), and in command parameters in text (where dd represents the predefined code for the device type).
UPPERCASE TYPE Uppercase type indicates a command, the name of a routine, the name of a file, or the abbreviation for a system privilege.
- A hyphen at the end of a command format description, command line, or code line indicates that the command or statement continues on the following line.
numbers All numbers in text are assumed to be decimal unless otherwise noted. Nondecimal radixes---binary, octal, or hexadecimal---are explicitly indicated.
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.
Fortran This term refers to language information that is common to ANSI FORTRAN-77, ANSI/ISO Fortran 90, ANSI/ISO Fortran 95, and HP Fortran 90.
Fortran 90 This term refers to language information that is common to ANSI/ISO Fortran 90 and HP 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 HP Fortran. For example, a new language feature introduced in the Fortran 95 standard.
HP Fortran Unless otherwise specified, this term (formerly Compaq Fortran) refers to language information that is common to the Fortran 90 and 95 standards, and any HP Fortran extensions, running on the OpenVMS operating system. Since the Fortran 90 standard is a superset of the FORTRAN-77 standard, HP Fortran also supports the FORTRAN-77 standard. HP Fortran supports all of the deleted features of the Fortran 95 standard.


Chapter 1
Getting Started

This chapter describes:

1.1 Fortran Standards Overview

HP Fortran for OpenVMS (formerly Compaq Fortran for OpenVMS) 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))
  • Fortran 95 standard (ISO/IEC 1539:1998 (E))

HP Fortran supports all of the deleted features of the Fortran 95 standard.

HP 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 HP Fortran may result in changes in future releases of the HP Fortran compiler, even if the changes produce incompatibilities with earlier releases of HP Fortran.

HP Fortran provides a number of extensions to the Fortran 90 and 95 standards. HP 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 standards-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 HP Fortran for OpenVMS Language Reference Manual, which defines the HP Fortran language.

1.2 HP 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 HP Fortran on your system, see the HP Fortran Installation Guide for OpenVMS I64 Systems or the HP Fortran Installation Guide for OpenVMS Alpha Systems.
  • Once HP 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 HP 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:


    $ SHOW PROCESS/QUOTA
    ...
    

    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 logical names to specify libraries and directories.
    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).
    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

    For more information on the FORT$INCLUDE logical name, 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 D).
  • Your HP 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 (an HP extension described in the HP Fortran for OpenVMS 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 HP Fortran source forms, see the HP Fortran for OpenVMS 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.


Next Contents Index