Compaq Fortran
User Manual for
Tru64 UNIX and
Linux Alpha Systems


Previous Contents Index

Chapter 7
7 Compaq Fortran Input/Output (I/O)
     7.1     Logical I/O Units
     7.2     Types of I/O Statements
     7.3     Forms of I/O Statements
     7.4     Types of Files and File Characteristics
         7.4.1         File Organizations
         7.4.2         Internal Files and Scratch Files
         7.4.3         Record Types, Record Overhead, and Maximum Record Length
             7.4.3.1             Portability Considerations of Record Types
             7.4.3.2             Record Overhead
             7.4.3.3             Maximum Record Length
         7.4.4         Other File Characteristics
     7.5     Opening Files: OPEN Statement
         7.5.1         Using Preconnected Standard I/O Files
         7.5.2         OPEN Statement Specifiers
         7.5.3         Methods to Specify the Unit, File Name, and Directory
         7.5.4         Accessing Files: Implied and Explicit File and Pathnames
         7.5.5         How Compaq Fortran Applies a Default Pathname and File Name
         7.5.6         Coding File Locations in an OPEN Statement
         7.5.7         Using Environment Variables
     7.6     Obtaining File Information: INQUIRE Statement
         7.6.1         Inquiry by Unit
         7.6.2         Inquiry by File Name
         7.6.3         Inquiry by Output Item List
     7.7     Closing a File: CLOSE Statement
     7.8     Record Operations
         7.8.1         Record I/O Statement Specifiers
         7.8.2         Record Access Modes and File Sharing
             7.8.2.1             Sequential Access
             7.8.2.2             Direct Access
             7.8.2.3             Limitations of Record Access by File Organization and Record Type
             7.8.2.4             File Sharing
         7.8.3         Specifying the Initial Record Position
         7.8.4         Advancing and Nonadvancing Record I/O
         7.8.5         Record Transfer
             7.8.5.1             Input Record Transfer
             7.8.5.2             Output Record Transfer
     7.9     User-Supplied OPEN Procedures: USEROPEN Specifier
         7.9.1         Restrictions of Called USEROPEN Functions
         7.9.2         Example USEROPEN Program and Function
     7.10     Format of Compaq Fortran Record Types
         7.10.1         Fixed-Length Records
         7.10.2         Variable-Length Records
         7.10.3         Segmented Records
         7.10.4         Stream File Data
         7.10.5         Stream_CR and Stream_LF Records
Chapter 8
8 Run-Time Errors and Signals
     8.1     Compaq Fortran Run-Time Library Default Error Processing
         8.1.1         Run-Time Message Format
         8.1.2         Message Catalog Location
         8.1.3         Values Returned to the Shell at Program Termination
         8.1.4         Forcing a Core Dump for Severe Errors
     8.2     Handling Run-Time Errors
         8.2.1         Using the END, EOR, and ERR Branch Specifiers
         8.2.2         Using the IOSTAT Specifier
         8.2.3         Using the 3f Library Routines to Return Operating System Errors
     8.3     Signal Handling
     8.4     Run-Time Error Messages
Chapter 9
9 Data Types and Representation
     9.1     Summary of Data Types and Characteristics
     9.2     Integer Data Representations
         9.2.1         Integer Declarations and f90/fort Compiler Options
         9.2.2         INTEGER (KIND=1) or INTEGER*1 Representation
         9.2.3         INTEGER (KIND=2) or INTEGER*2 Representation
         9.2.4         INTEGER (KIND=4) or INTEGER*4 Representation
         9.2.5         INTEGER (KIND=8) or INTEGER*8 Representation
     9.3     Logical Data Representations
     9.4     Native IEEE Floating-Point Representations and Exceptional Values
         9.4.1         REAL and COMPLEX Declarations and f90/fort Compiler Options
         9.4.2         REAL (KIND=4) or REAL*4 Representation
         9.4.3         REAL (KIND=8) or REAL*8 Representation
         9.4.4         REAL (KIND=16) or REAL*16 Representation
         9.4.5         COMPLEX (KIND=4) or COMPLEX*8 Representation
         9.4.6         COMPLEX (KIND=8) or COMPLEX*16 Representation
         9.4.7         COMPLEX (KIND=16) or COMPLEX*32 Representation
         9.4.8         Exceptional Floating-Point Representations
     9.5     Character Representation
     9.6     Hollerith Representation
Chapter 10
10 Converting Unformatted Numeric Data
     10.1     Endian Order of Numeric Formats
     10.2     Little Endian Floating-Point Format
     10.3     Native and Supported Nonnative Numeric Formats
     10.4     Limitations of Numeric Conversion
     10.5     Methods of Specifying the Unformatted Numeric Format
         10.5.1         Environment Variable FORT_CONVERTn Method
         10.5.2         Environment Variable FORT_CONVERT.ext Method
         10.5.3         OPEN Statement CONVERT='keyword' Method
         10.5.4         OPTIONS Statement /CONVERT=keyword Method
         10.5.5         Command-Line -convert keyword Option Method
     10.6     Additional Information on Nonnative Data
Chapter 11
11 Procedure Data Interfaces and Mixed Language Programming
     11.1     Compaq Fortran Procedures and Argument Passing
         11.1.1         Explicit and Implicit Interfaces
         11.1.2         Types of Compaq Fortran Subprograms
         11.1.3         Using Procedure Interface Blocks
         11.1.4         Passing Arguments and Function Return Values
         11.1.5         Passing Arrays as Arguments
         11.1.6         Passing Pointers as Arguments
         11.1.7         Compaq Fortran Array Descriptor Format
         11.1.8         Argument-Passing Mechanisms and Built-In Functions
             11.1.8.1             Passing Addresses --- %LOC Function
             11.1.8.2             Passing Arguments by Immediate Value --- %VAL Function
             11.1.8.3             Passing Arguments by Reference --- %REF Function
             11.1.8.4             Examples of Argument Passing Built-in Functions
     11.2     Using the cDEC$ ALIAS and cDEC$ ATTRIBUTES Directives
         11.2.1         cDEC$ ALIAS directive
         11.2.2         cDEC$ ATTRIBUTES Directive
             11.2.2.1             C Property
             11.2.2.2             ALIAS Property
             11.2.2.3             REFERENCE and VALUE Properties
             11.2.2.4             EXTERN and VARYING Properties
     11.3     Calling Between Compaq Fortran and C
         11.3.1         Compiling and Linking Files
         11.3.2         Procedures and External Names
         11.3.3         Invoking a C Function from Compaq Fortran
         11.3.4         Invoking a Compaq Fortran Function or Subroutine from C
         11.3.5         Equivalent Data Types for Function Return Values
         11.3.6         Argument Association and Equivalent Data Types
             11.3.6.1             Compaq Fortran Intrinsic Data Types
             11.3.6.2             Equivalent Compaq Fortran and C Data Types
         11.3.7         Example of Passing Integer Data to C Functions
         11.3.8         Example of Passing Character Data Between Compaq Fortran and C
         11.3.9         Example of Passing Complex Data to C Functions
         11.3.10         Handling User-Defined Structures
         11.3.11         Handling Scalar Pointer Data
         11.3.12         Handling Arrays
         11.3.13         Handling Common Blocks of Data
     11.4     Calling Between Parallel HPF and Non-Parallel HPF Code
Chapter 12
12 Compaq Fortran Library Routines
     12.1     Overview of Compaq Fortran Library Routines
     12.2     3f Routines
     12.3     3hpf Routines
     12.4     Reference Pages for the 3f and 3hpf Routines
     12.5     EXTERNAL or INTRINSIC Declarations
     12.6     Example Using the 3f Library Routine shcom_connect
     12.7     Example of the 3f Library Routines irand and qsort
Chapter 13
13 Using the Compaq Extended Math Library (CXML)
     13.1     What Is CXML?
     13.2     CXML Routine Groups
     13.3     Using CXML from Fortran
     13.4     CXML Program Example
     13.5     CXML Documentation
Chapter 14
14 Controlling Floating-Point Exceptions
     14.1     Overview of Controlling Floating-Point Exceptions
     14.2     Using the for_fpe_flags.f File
         14.2.1         Bit Definitions in File for_fpe_flags.f
     14.3     Calling the for_get_fpe and for_set_fpe Functions
         14.3.1         Calling for_get_fpe
         14.3.2         Calling for_set_fpe
     14.4     File fordef.f and Its Usage
Appendix A
Appendix A Compatibility: Compaq Fortran 77 and Compaq Fortran on Multiple Platforms
     A.1     Compaq Fortran and Compaq Fortran 77 Compatibility on Various Platforms
     A.2     Compatibility with Compaq Fortran 77 for Compaq Tru64 UNIX Systems
         A.2.1         Major Language Features for Compatibility with Compaq Fortran 77 for Compaq Tru64 UNIX Systems
         A.2.2         Language Features Provided Only by Compaq Fortran 77 for Compaq Tru64 UNIX Systems
         A.2.3         Improved Compaq Fortran Compiler Diagnostic Detection
         A.2.4         Compiler Command-Line Differences
     A.3     Language Compatibility with Compaq Visual Fortran
     A.4     Compatibility with Compaq Fortran 77 and Compaq Fortran for OpenVMS Systems
         A.4.1         Language Features Specific to Compaq Fortran 77 and Compaq Fortran for OpenVMS Systems
         A.4.2         OpenVMS Data Porting Considerations
             A.4.2.1             Matching Record Types
             A.4.2.2             Copying Files
         A.4.3         Nonnative VAX Floating-Point Representations
             A.4.3.1             VAX F_float REAL (KIND=4) or REAL*4
             A.4.3.2             VAX G_float REAL (KIND=8) or REAL*8
             A.4.3.3             VAX D_float REAL (KIND=8) or REAL*8
             A.4.3.4             VAX F_float COMPLEX (KIND=4) or COMPLEX*8
             A.4.3.5             VAX G_float and D_float COMPLEX (KIND=8) or COMPLEX*16
             A.4.3.6             VAX H_float Representation
     A.5     Calling Between Compaq Fortran 77 and Compaq Fortran
         A.5.1         Argument Passing and Function Return Values
         A.5.2         Using Data Items in Common Blocks
         A.5.3         I/O to the Same Unit Number
Appendix B
Appendix B Compaq Fortran Environment Variables
     B.1     Commands for Setting and Unsetting Environment Variables
         B.1.1         Bourne Shell (sh) and Bourne Again Shell (bash) and Korn Shell (ksh) Commands
         B.1.2         C Shell (csh) Commands
     B.2     Compile-Time Environment Variables
     B.3     Run-Time Environment Variables
Appendix C
Appendix C Compiler Output Listings
     C.1     Source-Code Section of the Output Listing
     C.2     Machine-Code Section of the Output Listing
         C.2.1         How Generated Code and Data are Represented in Machine-Code Listings
         C.2.2         Assembler Code Represented in Machine-Code Listings
     C.3     Compilation Summary of the Output Listing
Appendix D
Appendix D Parallel Library Routines
     D.1     OpenMP Fortran API Run-Time Library Routines
         D.1.1         Library Routines That Control and Query the Parallel Execution Environment
             D.1.1.1             omp_get_dynamic
             D.1.1.2             omp_get_max_threads
             D.1.1.3             omp_get_nested
             D.1.1.4             omp_get_num_procs
             D.1.1.5             omp_get_num_threads
             D.1.1.6             omp_get_thread_num
             D.1.1.7             omp_in_parallel
             D.1.1.8             omp_set_dynamic
             D.1.1.9             omp_set_nested
             D.1.1.10             omp_set_num_threads
         D.1.2         General-Purpose Lock Routines
             D.1.2.1             omp_destroy_lock
             D.1.2.2             omp_init_lock
             D.1.2.3             omp_set_lock
             D.1.2.4             omp_test_lock
             D.1.2.5             omp_unset_lock
     D.2     Other Parallel Threads Routines
         D.2.1         _OtsGetMaxThreads or mpc_maxnumthreads
         D.2.2         _OtsGetNumThreads or mpc_numthreads
         D.2.3         _OtsGetThreadNum or mpc_my_threadnum
         D.2.4         _OtsInitParallel
         D.2.5         _OtsInParallel or mpc_in_parallel_region
         D.2.6         _OtsSetNumThreads
         D.2.7         _OtsStopWorkers or mpc_destroy
Index
Index
Examples
1-1 Sample Main Program
1-2 Sample Main Program that Uses a Module and Separate Function
1-3 Sample Module
1-4 Sample Separate Function Declaration
4-1 Sample Program SQUARES
4-2 Sample Debugging Session Using Program Squares
5-1 Using the -assume dummy_aliases Option
6-1 Aligned Loop
6-2 Transformed Loop Using Code Replication
6-3 Distributed Loop
6-4 Decomposed Loop Using Locks
6-5 Decomposed Loop Using a REDUCTION Clause
6-6 Code Using Parallel Region
6-7 Code Using Multiple Threads
6-8 Code Using Multiple Processors
6-9 Code Using Shared Variables
6-10 Code Looking at a Shared Variable Value
7-1 C Function Called by USEROPEN Procedure
7-2 Compaq Fortran USEROPEN Main Calling Program
8-1 Example of Stack Trace Information
8-2 Error Handling OPEN Statement File Name
11-1 Calling C Functions and Passing Integer Arguments
11-2 Calling C Functions and Passing Integer Arguments
11-3 C Functions Called by a Compaq Fortran Program
11-4 Calling C Functions and Passing Integer Arguments
11-5 Compaq Fortran Program Calling a C Function
11-6 C Interface Function Called by Compaq Fortran
11-7 Calling C Functions and Passing Complex Arguments
11-8 Calling C Functions and Passing Pointer Arguments
11-9 C Functions Receiving Pointer Arguments
11-10 C Function That Receives an Explicit-Shape Array
11-11 Compaq Fortran Program That Passes an Explicit-Shape Array
12-1 Using the 3f Routine shcom_connect
12-2 Using the 3f Routines irand and qsort
13-1 Fortran Example Program Using CXML
A-1 Compaq Fortran Program Calling a Compaq Fortran 77 Subroutine
A-2 Compaq Fortran 77 Subroutine Called by a Compaq Fortran Program
C-1 Sample Source Code Listing
C-2 Sample Machine-Code Listing
C-3 Sample Compilation Summary on Tru64 UNIX Systems
C-4 Sample Compilation Summary on Linux Systems
Figures
2-1 Driver Programs and Software Components
5-1 Common Block with Unaligned Data
5-2 Common Block with Naturally Aligned Data
5-3 Common Block with Naturally Aligned Reordered Data
5-4 Derived-Type Naturally Aligned Data (in CATALOG_SPRING : ( ,))
5-5 Memory Diagram of REC for Naturally Aligned Records
7-1 Fixed-Length Records
7-2 Variable-Length Records Less Than 2 Gigabytes
7-3 Variable-Length Records Greater Than 2 Gigabytes
7-4 Segmented Records
7-5 Stream File Records
7-6 Stream_CR and Stream_LF Records
9-1 INTEGER (KIND =1) or INTEGER*1 Representation
9-2 INTEGER (KIND =2) or INTEGER*2 Representation
9-3 INTEGER (KIND =4) or INTEGER*4 Representation
9-4 INTEGER (KIND =8) or INTEGER*8 Representation
9-5 LOGICAL Representations
9-6 REAL (KIND =4) or REAL*4 Representation
9-7 REAL (KIND =8) or REAL*8 Representation
9-8 REAL (KIND =16) or REAL*16 Representation
9-9 COMPLEX (KIND =4) or COMPLEX*8 Representation
9-10 COMPLEX (KIND =8) or COMPLEX*16 Representation
9-11 COMPLEX (KIND =16) or COMPLEX*32 Representation
9-12 CHARACTER Data Representation
10-1 Little Endian and Big Endian Storage of an INTEGER Value
10-2 Sample Unformatted File Conversion
A-1 VAX F_float REAL (KIND =4) or REAL*4 Representation
A-2 VAX G_float REAL (KIND =8) or REAL*8 Representation
A-3 VAX D_float REAL (KIND =8) or REAL*8 Representation
A-4 VAX F_float COMPLEX (KIND =4) or COMPLEX*8 Representation
A-5 VAX G_float COMPLEX (KIND =8) or COMPLEX*16 Representation
A-6 VAX D_float COMPLEX (KIND =8) or COMPLEX*16 Representation
A-7 VAX H_float REAL*16 Representation (VAX Systems)
Tables
1 Conventions Used in This Document
1-1 Main Tools for Program Development and Testing
2-1 File Suffixes Recognized as Fortran 95/90 Source Files
2-2 Other File Name Suffixes
2-3 Compiler Limits
2-4 Libraries Automatically Searched When Using the f90 Command
3-1 f90 and fort Command Categories and Options
3-2 Interaction of File Suffix and the -free and -fixed Options on Source Form
3-3 Summary of Floating-Point Exception Command-Line Options
4-1 Command-Line Options Affecting Traceback and Symbol Table Information
4-2 Summary of Debugger Commands
4-3 Fortran Data Types and Debugger Equivalents
5-1 Options That Affect Run-Time Performance
5-2 Options that Slow Run-Time Performance
5-3 Output Argument Array Types
5-4 Levels of Optimization with Different -O n Options
6-1 OpenMP Fortran API Compiler Directives
6-2 Operators/Intrinsics and Initialization Values for Reduction Variables
6-3 Compaq Fortran Parallel Compiler Directives
6-4 OpenMP Fortran API Environment Variables
6-5 Compaq Fortran Parallel Environment Variables
7-1 Summary of I/O Statements
7-2 Available I/O Statements and Record I/O Forms
7-3 Compaq Fortran Record Types
7-4 Bytes Required for Record Overhead
7-5 Environment Variables and Preconnected Files
7-6 OPEN Statement Functions and Specifiers
7-7 Examples of Applying Default Pathnames and File Names
7-8 Implicit Compaq Fortran Logical Units
7-9 Allowed Record Access for File Organizations and Record Types
8-1 Severity Levels of Run-Time Messages
8-2 Signals Caught by the Compaq Fortran Run-Time Library
8-3 Run-Time Error Messages and Explanations
9-1 Compaq Fortran Intrinsic Data Types, Storage, and Numeric Ranges
9-2 Exceptional Floating-Point Numbers
10-1 Unformatted Numeric Formats, Keywords, and Supported Data Types
11-1 Calling Conventions for ATTRIBUTES Options
11-2 C Property and External Names
11-3 C Property and Argument Passing
11-4 Equivalent Function Declarations in C and Compaq Fortran
11-5 Compaq Fortran and C Data Types
12-1 Summary of Language Interface (" Jacket") 3f Library Routines
12-2 Summary of 3f Library Routines Providing Special Functions
12-3 3f Functions and Subroutines
12-4 Compaq Fortran 3hpf HPF_LOCAL_LIBRARY Library Routines
13-1 CXML Routine Groups
14-1 Bit Definitions in File for_fpe_flags.f
14-2 Symbols in File fordef.f
A-1 Summary of Language Compatibility
A-2 Equivalent Record Types for OpenVMS Fortran and Compaq Fortran on Compaq Tru64 UNIX or Linux Alpha Systems
B-1 Compile-Time Environment Variables
B-2 Run-Time Environment Variables
D-1 OpenMP Fortran API Run-Time Library Routines
D-2 Other Parallel Threads Routines


Previous Next Contents Index