CONTENTS Title Page Copyright Page Preface New Features 1 Compiling DEC Fortran Programs 1.1 Functions of the Compiler 1.2 The FORTRAN Command 1.2.1 Specifying Input Files 1.2.2 Specifying Output Files 1.2.3 Qualifiers to the FORTRAN Command 1.2.3.1 /ANALYSIS_DATA Qualifier 1.2.3.2 /ASSUME Qualifier 1.2.3.3 /BLAS Qualifier 1.2.3.4 /CHECK Qualifier 1.2.3.5 /CONVERT Qualifier 1.2.3.6 /CROSS_REFERENCE Qualifier 1.2.3.7 /D_LINES Qualifier 1.2.3.8 /DEBUG Qualifier 1.2.3.9 /DESIGN Qualifier 1.2.3.10 /DIAGNOSTICS Qualifier 1.2.3.11 /DIRECTIVES Qualifier 1.2.3.12 /DML Qualifier 1.2.3.13 /ERROR_LIMIT Qualifier 1.2.3.14 /EXTEND_SOURCE Qualifier 1.2.3.15 /F77 Qualifier 1.2.3.16 /G_FLOATING Qualifier 1.2.3.17 /I4 Qualifier 1.2.3.18 /LIBRARY Qualifier 1.2.3.19 /LIST Qualifier 1.2.3.20 /MACHINE_CODE Qualifier 1.2.3.21 /MATH_LIBRARY Qualifier 1.2.3.22 /OBJECT Qualifier 1.2.3.23 /OPTIMIZE Qualifier 1.2.3.24 /PARALLEL Qualifier 1.2.3.25 /RECURSIVE Qualifier 1.2.3.26 /SHOW Qualifier 1.2.3.27 /STANDARD Qualifier 1.2.3.28 /SYNCHRONOUS_EXCEPTIONS Qualifier 1.2.3.29 /TERMINAL Qualifier 1.2.3.30 /VECTOR Qualifier 1.2.3.31 /WARNINGS Qualifier 1.3 Using Text Libraries 1.3.1 Using the LIBRARY Commands 1.3.2 Naming Text Modules 1.3.3 Specifying Library Files on the FORTRAN Command Line 1.3.4 Search Order of Libraries 1.3.4.1 User-Supplied Default Libraries 1.3.4.2 System-Supplied Default Library 1.4 Using CDD/Repository 1.4.1 Accessing CDD/Repository from DEC Fortran Programs 1.4.2 DEC Fortran and CDD/Repository Data Types 1.5 Compiler Limits, Diagnostic Messages, and Error Conditions 1.5.1 Compiler Limits 1.5.2 Compiler Diagnostic Messages and Error Conditions 1.6 Compiler Output Listing Format 1.6.1 Source Code Section 1.6.2 Machine Code Section 1.6.3 Storage Map Section 1.6.4 Compilation Summary Section 2 Linking and Running DEC Fortran Programs 2.1 Linking DEC Fortran Programs 2.1.1 Functions of the Linker 2.1.2 The LINK Command 2.1.2.1 Linker Output File Qualifiers 2.1.2.2 /DEBUG and /TRACEBACK Qualifiers 2.1.2.3 Linker Input File Qualifiers 2.1.2.4 Linker Symbol Table Qualifier 2.1.2.5 Linker Options File Qualifier 2.1.2.6 Other Linker Qualifiers 2.1.3 Linker Messages 2.2 Running DEC Fortran Programs 2.2.1 The RUN Command 2.2.2 System Processing at Image Exit 2.2.3 Interrupting a Program 2.2.4 Returning Status Values to the Command Interpreter 2.3 Finding and Correcting Run-Time Errors 3 Using the VMS Debugger 3.1 Overview 3.2 Getting Started with the Debugger 3.2.1 Compiling and Linking a Program to Prepare for Debugging 3.2.2 Establishing the Debugging Configuration 3.2.3 Invoking the Debugger 3.2.4 Ending a Debugging Session 3.2.5 Notes on Debugger Support for DEC Fortran 3.3 Sample Debugging Session 3.4 Debugger Command Summary 3.4.1 Starting and Terminating a Debugging Session 3.4.2 Controlling and Monitoring Program Execution 3.4.3 Examining and Manipulating Data 3.4.4 Controlling Type Selection and Symbolization 3.4.5 Controlling Symbol Lookup 3.4.6 Displaying Source Code 3.4.7 Using Screen Mode 3.4.8 Editing Source Code 3.4.9 Defining Symbols 3.4.10 Using Keypad Mode 3.4.11 Using Command Procedures and Log Files 3.4.12 Using Control Structures 3.4.13 Debugging Multiprocess Programs 3.4.14 Additional Commands 3.5 Debugging Multiprocess Programs 4 DEC Fortran Input/Output 4.1 Overview of DEC Fortran I/O 4.1.1 Identifying Logical Input/Output Units 4.1.2 Interprocess Communication 4.1.3 Types of I/O Statements 4.1.4 Forms of I/O Statements 4.2 Elements of I/O Processing 4.2.1 File Specifications 4.2.2 Logical Names and Logical Unit Numbers 4.2.2.1 FORTRAN Logical Names 4.2.2.2 Implied FORTRAN Logical Unit Numbers 4.2.2.3 File Specification in an OPEN Statement 4.2.2.4 Assigning Files to Logical Units 4.2.3 File Organizations, I/O Record Types, and Access Modes 4.2.3.1 File Organizations 4.2.3.2 Scratch Files 4.2.3.3 Internal Files 4.2.3.4 I/O Record Formats 4.2.3.5 Record Access Modes 4.3 Buffering of Output Data 5 Error Processing 5.1 Run-Time Library Default Error Processing 5.2 Using the ERR and END Specifiers 5.3 Using the IOSTAT Specifier 6 Using DEC Fortran in the Common Language Environment 6.1 VMS Procedure-Calling Standard 6.1.1 Register and Stack Usage 6.1.2 Return Values of Procedures 6.1.3 Argument Lists 6.2 Argument-Passing Mechanisms 6.2.1 Passing Arguments by Reference-%REF Function 6.2.2 Passing Arguments by Descriptor-%DESCR Function 6.2.3 Passing Arguments by Immediate Value-%VAL Function 6.2.4 Passing Addresses-%LOC Function 6.2.5 Examples of Argument Passing Built-In Functions 6.2.6 Object Code Examples 6.2.6.1 Argument-Passing Examples 6.2.6.2 Examples of Argument List Built-In Functions 6.2.6.3 Character Function Example 6.3 VMS System Routines 6.3.1 VMS Run-Time Library Routines 6.3.2 VMS System Services Routines 6.4 Calling Routines-General Considerations 6.5 Calling VMS System Services 6.5.1 Obtaining Values for System Symbols 6.5.2 Calling System Services by Function Reference 6.5.3 Calling System Services as Subroutines 6.5.4 Passing Arguments to System Services 6.5.4.1 Immediate Value Arguments 6.5.4.2 Address Arguments 6.5.4.3 Descriptor Arguments 6.5.4.4 Data Structure Arguments 6.5.4.5 Examples of Passing Arguments 7 Using VMS Record Management Services 7.1 RMS Data Structures 7.1.1 Using FORSYSDEF Modules to Manipulate RMS Data Structures 7.1.2 The File Access Block 7.1.3 The Record Access Block 7.1.4 The Name Block 7.1.5 Extended Attributes Blocks 7.2 RMS Services 7.2.1 Declaring RMS System Service Names 7.2.2 Arguments to RMS Services 7.2.3 Checking Status from RMS Services 7.2.4 Opening a File 7.2.5 Closing a File 7.2.6 Writing Data 7.2.7 Reading Data 7.2.8 Other Services 7.3 User-Written Open Procedures 7.3.1 Examples of USEROPEN Routines 7.3.2 RMS Control Structures 7.4 Example of Block Mode I/O 8 Interprocess Communications 8.1 Local Processes-Sharing and Exchanging Data 8.1.1 Sharing Images in Shareable Image Libraries 8.1.2 Sharing Data in Installed Common Areas 8.1.3 Synchronizing Access 8.1.4 Sharing Data in Files 8.1.5 Using Mailboxes to Pass Information 8.1.6 Sending and Receiving Data Using Mailboxes 8.2 Remote Processes-Sharing and Exchanging Data 8.2.1 Remote File Access 8.2.2 Network Task-to-Task Communication 9 Condition-Handling Facilities 9.1 Default Condition Handler 9.2 User-Program Interactions with the CHF 9.2.1 Establishing and Removing Condition Handlers 9.2.2 Signaling a Condition 9.2.3 Condition Values and Symbols Passed to CHF 9.3 Operations Performed in Condition Handlers 9.4 Coding Requirements of Condition Handlers 9.5 Returning from a Condition Handler 9.6 Use of LIB$ Routines as Condition Handlers 9.6.1 Overflow/Underflow Detection Enabling Routines 9.6.2 Floating Underflow Exceptions 9.6.2.1 Specifying CHECK=UNDERFLOW 9.6.2.2 Establishing a Handler for Underflow 9.6.2.3 Enabling and Disabling Underflow Exceptions 9.6.3 Floating Reserved Operand Faults 9.6.4 Matching Condition Values to Determine Program Behavior 9.6.5 Converting Faults and Traps 9.6.6 Changing a Signal to a Return Status 9.6.7 Changing a Signal to a Stop 9.7 Condition Handler Examples 10 DEC Fortran Implementation Notes 10.1 DEC Fortran Program Section Usage 10.2 Storage Allocation and Fixed-Point Data Types 10.2.1 Integer Data Types 10.2.1.1 Relationship of INTEGER * 2 and INTEGER * 4 Values 10.2.1.2 Integer Constant Typing 10.2.1.3 Integer-Valued Intrinsic Functions 10.2.2 BYTE (LOGICAL * 1) Data Type 10.2.3 Zero-Extend Intrinsic Functions for Converting Data Types 10.3 Iteration Count Model for Indexed DO Loops 10.3.1 Cautions Concerning Program Transportability 10.3.2 Iteration Count Computation 10.4 ENTRY Statement Arguments 10.5 Floating-Point Data 10.5.1 Floating-Point Data Characteristics 10.5.1.1 Reserved Operand Faults 10.5.1.2 Representation of 0.0 10.5.1.3 Sign Bit Tests 10.5.2 Effect of the /G_FLOATING Qualifier 10.5.3 Conversion Between D_floating and G_floating Data Types 10.5.3.1 Run-Time Library Conversion Functions 10.5.3.2 Run-Time Library Conversion Subroutines 10.5.3.3 Sample Conversions 11 Using Structures and Records 11.1 Structures 11.2 Records 12 Using Character Data 12.1 Character Substrings 12.2 Building Character Strings 12.3 Character Constants 12.4 Declaring Character Data 12.5 Initializing Character Variables 12.6 Passed-Length Character Arguments 12.7 Character Intrinsic Functions 12.7.1 CHAR Intrinsic Function 12.7.2 ICHAR Intrinsic Function 12.7.3 INDEX Intrinsic Function 12.7.4 LEN Intrinsic Function 12.7.5 LGE, LGT, LLE, LLT Intrinsic Functions 12.8 Character I/O 12.9 Character Data Examples 13 Using Indexed Files 13.1 Creating an Indexed File 13.2 Writing Indexed Files 13.2.1 Duplicate Values in Key Fields 13.2.2 Preventing the Indexing of Alternate Key Fields 13.3 Reading Indexed Files 13.4 Updating Records 13.5 Deleting Records 13.6 Current Record and Next Record Pointers 13.7 Exception Conditions A Contents of the FORTRAN System Library FORSYSDEF B Data Storage and Representation B.1 Summary of Data Types and Characteristics B.2 Integer Data Representations B.2.1 INTEGER * 1 Representation B.2.2 INTEGER * 2 Representation B.2.3 INTEGER * 4 Representation B.3 Logical Data Representations B.3.1 LOGICAL * 1 (BYTE) Representation B.3.2 LOGICAL * 2 and LOGICAL * 4 Representation B.4 Floating-Point Representations B.4.1 REAL * 4 (F_floating) B.4.2 REAL * 8 (D_floating) B.4.3 REAL * 8 (G_floating) B.4.4 REAL * 16 (H_floating) B.4.5 COMPLEX * 8 (F_floating) B.4.6 COMPLEX * 16 (D_floating) B.4.7 COMPLEX * 16 (G_floating) B.5 Character Representation B.6 Hollerith Representation C Converting Unformatted Files C.1 Supported Unformatted Numeric File Formats C.2 Methods of Specifying the Data Format C.2.1 OPEN statement CONVERT='keyword' Method C.2.2 Logical Name FOR$CONVERT nnn Method C.2.3 OPTIONS Statement /CONVERT= keyword Method C.2.4 FORTRAN Command /CONVERT= keyword Qualifier Method C.2.5 Additional Notes on Unformatted Data Files D Using System Services-Examples D.1 Calling RMS Procedures D.2 Using an AST Routine D.3 Accessing Devices Using Synchronous I/O D.4 Communicating with Other Processes D.5 Sharing Data D.6 Displaying Data at Terminals D.7 Creating, Accessing, and Ordering Files D.8 Accessing Help Libraries D.9 Creating and Managing Other Processes E Compatibility With FORTRAN-66 E.1 Minimum Iteration Count for DO Loops E.2 EXTERNAL Statement E.3 OPEN Statement Keyword Defaults E.3.1 BLANK Keyword Default E.3.2 OPEN Statement's STATUS Keyword Default E.4 X Format Edit Descriptor E.5 Open Operation on a Connected Unit F Compatibility With PDP-11 FORTRAN F.1 Language Differences F.1.1 Logical Tests F.1.2 Floating-Point Results F.1.3 Character and Hollerith Constants F.1.4 Logical Unit Numbers F.1.5 Assigned GO TO Label List F.1.6 DISPOSE= ' PRINT ' Specification F.2 Run-Time Support Differences F.2.1 Run-Time Library Error Numbers F.2.2 Error Handling and Reporting F.2.2.1 Continuing After Errors F.2.2.2 I/O Errors with IOSTAT or ERR Specified F.2.2.3 OPEN/CLOSE Statement Errors F.2.3 OPEN Statement Keywords F.3 Utility Subprograms F.3.1 ASSIGN Subprogram F.3.2 CLOSE Subprogram F.3.3 ERRSET Subprogram F.3.4 ERRSNS Subprogram F.3.5 ERRTST Subprogram F.3.6 FDBSET Subprogram F.3.7 IRAD50 Subprogram F.3.8 RAD50 Function F.3.9 RAN Function F.3.10 RANDU Subprogram F.3.11 R50ASC Subprogram F.3.12 USEREX Subprogram G Diagnostic Messages G.1 Diagnostic Messages from the DEC Fortran Compiler G.1.1 Source Program Diagnostic Messages G.1.2 Compiler-Fatal Diagnostic Messages G.2 Diagnostic Messages from the Run-Time System G.3 DICTIONARY Error Messages EXAMPLES 1-1 Sample Listing of Source Code 1-2 Sample Listing of Machine Code 1-3 Sample Storage Map Section 1-4 Sample Compilation Summary 2-1 Sample DEC Fortran Program and Traceback 3-1 Sample Program SQUARES 3-2 Sample Debugging Session Using Program SQUARES 3-3 Sample DEC Fortran Multiprocessing Source Program 3-4 Sample Multiprocessing Debugging Session 6-1 Subroutine Using a Data Structure Argument 6-2 Ctrl/C Trapping Example 12-1 Character Data Program Example (Source) 12-2 Character Data Program Example (Output) G-1 Sample Diagnostic Messages (Listing Format) FIGURES 1-1 Creating and Using a Text Library 6-1 Structure of a VMS VAX Argument List 6-2 Example of a VMS VAX Argument List 9-1 Sample Stack Scan for Condition Handlers 9-2 Effects of Calls to LIB$SIGNAL or LIB$STOP 10-1 General Format of Floating-Point Data TABLES 1 Conventions Used in This Document 1-1 FORTRAN Command Qualifiers 1-2 Commands to Control Library Files 1-3 Compiler Limits 2-1 LINK Command Qualifiers 2-2 /DEBUG and /TRACEBACK Qualifiers 4-1 Available I/O Statements 4-2 Predefined System Logical Names 4-3 Implicit FORTRAN Logical Units 4-4 Valid Combinations of Record Access Mode and File Organization 5-1 Summary of Run-Time Errors 6-1 VMS VAX Register Usage 6-2 Function Return Values 6-3 Run-Time Library Facilities 6-4 System Services 6-5 DEC Fortran Implementation of VMS Data Types 6-6 Variable Data Type Requirements 7-1 RMS Fields Available with USEROPEN 9-1 Severity Codes for Exception Condition Values 9-2 Condition-Handler Function Return Values 10-1 PSECT Names and Attributes 10-2 DEC Fortran PSECT Attributes A-1 Contents of System Library FORSYSDEF B-1 DEC Fortran Data Types and Storage C-1 Nonnative Numeric Formats, Keywords, and Supported Data Types F-1 Default Logical Unit Numbers G-1 Source Program Diagnostic Messages G-2 Run-Time Diagnostic Messages G-3 Run-Time Diagnostic Messages for Parallel Processing G-4 CRX Error Messages