CONTENTS Title Page Copyright Page Preface New and Expanded Language Features 1 Introduction to VAX FORTRAN 1.1 Elements of FORTRAN Source Programs 1.1.1 Program Units 1.1.2 Statements 1.1.3 Symbolic Names 1.1.4 Comments 1.2 Character Set 1.3 Coding Rules 1.3.1 Fixed-Format Lines 1.3.2 Tab-Format Lines 1.3.3 Statement Label Field 1.3.3.1 Comment Indicator 1.3.3.2 Debugging Statement Indicator 1.3.4 Continuation Indicator Field 1.3.5 Statement Field 1.3.6 Sequence Number Field 1.4 Compilation Control Statements 1.4.1 DICTIONARY Statement 1.4.2 INCLUDE Statement 1.4.3 OPTIONS Statement 2 Data Types, Data Items, and Expressions 2.1 Data Types 2.1.1 Storage Requirements 2.1.2 VAX Implementations of REAL * 8 2.2 Data Items 2.2.1 Constants 2.2.1.1 Integer Constants 2.2.1.2 Real Constants 2.2.1.3 Complex Constants 2.2.1.4 Octal and Hexadecimal Constants 2.2.1.5 Logical Constants 2.2.1.6 Character Constants 2.2.1.7 Hollerith Constants 2.2.2 Variables 2.2.2.1 Data Type by Specification 2.2.2.2 Data Type by Implication 2.2.3 Arrays 2.2.3.1 Array Declarators 2.2.3.2 Array Subscripts 2.2.3.3 Arrangement of Array Elements in Storage 2.2.3.4 Data Type of an Array 2.2.3.5 Array References without Subscripts 2.2.3.6 Adjustable Arrays 2.2.3.7 Assumed-Size Arrays 2.2.4 Character Substrings 2.2.5 Records 2.2.5.1 Arrangement of Records in Storage 2.2.5.2 References to Record Fields 2.2.6 Terminology Used to Refer to Data Items 2.3 Expressions 2.3.1 Arithmetic Expressions 2.3.1.1 Using Parentheses 2.3.1.2 Data Type of an Arithmetic Expression 2.3.2 Character Expressions 2.3.3 Relational Expressions 2.3.4 Logical Expressions 3 Assignment Statements 3.1 Arithmetic Assignment Statement 3.2 Logical Assignment Statement 3.3 Character Assignment Statement 3.4 Aggregate Assignment Statement 3.5 ASSIGN Statement 4 Specification Statements 4.1 BLOCK DATA Statement 4.2 COMMON Statement 4.3 DATA Statement 4.4 Data Type Declaration Statements 4.4.1 Numeric Type Declaration Statements 4.4.2 Character Type Declaration Statements 4.5 DIMENSION Statement 4.6 EQUIVALENCE Statement 4.6.1 Making Arrays Equivalent 4.6.2 Making Substrings Equivalent 4.6.3 EQUIVALENCE and COMMON Interaction 4.7 EXTERNAL Statement 4.8 IMPLICIT Statement 4.9 INTRINSIC Statement 4.10 NAMELIST Statement 4.11 PARAMETER Statement 4.12 PROGRAM Statement 4.13 RECORD Statement 4.14 SAVE Statement 4.15 Structure Declaration Block 4.15.1 Structure Declaration 4.15.2 Substructure Declarations 4.15.3 Union Declarations 4.16 VOLATILE Statement 5 Control Statements 5.1 CALL Statement 5.2 CONTINUE Statement 5.3 DO Statements 5.3.1 Indexed DO Statement 5.3.1.1 DO Iteration Control 5.3.1.2 Nested DO Loops 5.3.1.3 Control Transfers in DO Loops 5.3.1.4 Extended Range 5.3.2 DO WHILE Statement 5.4 END DO Statement 5.5 END Statement 5.6 GO TO Statements 5.6.1 Unconditional GO TO Statement 5.6.2 Computed GO TO Statement 5.6.3 Assigned GO TO Statement 5.7 IF Statements 5.7.1 Arithmetic IF Statement 5.7.2 Logical IF Statement 5.7.3 Block IF Statements 5.7.3.1 Statement Blocks 5.7.3.2 Block IF Examples 5.7.3.3 Nested Block IF Constructs 5.8 PAUSE Statement 5.9 RETURN Statement 5.10 STOP Statement 6 Subprograms - Subroutines and Functions 6.1 Subprogram Arguments 6.1.1 Actual Argument and Dummy Argument Association 6.1.1.1 Adjustable Arrays 6.1.1.2 Assumed-Size Arrays 6.1.1.3 Passed-Length Character Arguments 6.1.1.4 Character and Hollerith Constants as Actual Arguments 6.1.1.5 Alternate Return Arguments 6.1.2 Built-In Functions 6.1.2.1 Argument List Built-In Functions 6.1.2.2 %LOC Built-In Function 6.2 User-Written Subprograms 6.2.1 Statement Functions 6.2.2 Function Subprograms 6.2.2.1 Logical and Numeric Functions 6.2.2.2 Character Functions 6.2.2.3 Function Reference 6.2.3 Subroutine Subprograms - SUBROUTINE Statement 6.2.4 ENTRY Statement 6.2.4.1 ENTRY Statements in Function Subprograms 6.2.4.2 ENTRY Statements in Subroutine Subprograms 6.3 FORTRAN Intrinsic Functions 6.3.1 Intrinsic Function References 6.3.1.1 Generic References to Intrinsic Functions 6.3.1.2 Using Intrinsic Function Names 6.3.2 Character and Lexical Comparison Library Functions 6.3.2.1 Character Functions 6.3.2.2 Lexical Comparison Functions 7 I/O Statements 7.1 Components of I/O Statements 7.1.1 Control List 7.1.1.1 Syntax Rules for Control-List Parameters 7.1.1.2 Logical Unit Specifier 7.1.1.3 Internal File Specifier 7.1.1.4 Format Specifiers 7.1.1.5 Namelist Specifier 7.1.1.6 Record Specifier 7.1.1.7 Key-Field-Value Specifier 7.1.1.8 Key-of-Reference Specifier 7.1.1.9 I/O Status Specifier 7.1.1.10 Transfer-of-Control Specifiers 7.1.2 I/O List 7.1.2.1 Simple List Elements 7.1.2.2 Implied-DO Lists in I/O Statements 7.2 READ Statements 7.2.1 Sequential READ Statements 7.2.1.1 Formatted Sequential READ Statement 7.2.1.2 List-Directed Sequential READ Statement 7.2.1.3 Namelist-Directed Sequential READ Statement 7.2.1.4 Unformatted Sequential READ Statement 7.2.2 Direct Access READ Statements 7.2.2.1 Formatted Direct Access READ Statement 7.2.2.2 Unformatted Direct Access READ Statement 7.2.3 Indexed READ Statements 7.2.3.1 Formatted Indexed READ Statement 7.2.3.2 Unformatted Indexed READ Statement 7.2.4 Internal READ Statement 7.2.4.1 Formatted Internal READ Statement 7.2.4.2 List-Directed Internal READ Statement 7.3 WRITE Statements 7.3.1 Sequential WRITE Statements 7.3.1.1 Formatted Sequential WRITE Statement 7.3.1.2 List-Directed Sequential WRITE Statement 7.3.1.3 Namelist-Directed Sequential WRITE Statement 7.3.1.4 Unformatted Sequential WRITE Statement 7.3.2 Direct Access WRITE Statements 7.3.2.1 Formatted Direct Access WRITE Statement 7.3.2.2 Unformatted Direct Access WRITE Statement 7.3.3 Indexed WRITE Statements 7.3.3.1 Formatted Indexed WRITE Statement 7.3.3.2 Unformatted Indexed WRITE Statement 7.3.4 Internal WRITE Statement 7.3.4.1 Formatted Internal WRITE Statement 7.3.4.2 List-Directed Internal WRITE Statement 7.4 REWRITE Statement 7.4.1 Formatted REWRITE Statement 7.4.2 Unformatted REWRITE Statement 7.5 ACCEPT Statement 7.6 TYPE and PRINT Statements 8 I/O Formatting 8.1 General Rules for Writing FORMAT Statements 8.1.1 Input Rules for FORMAT Statements 8.1.2 Output Rules for FORMAT Statements 8.2 FORMAT Statement Syntax 8.3 Field and Edit Descriptors 8.3.1 Repeat Counts and Group Repeat Counts 8.3.2 Variable Format Expressions 8.3.3 Blank Control Editing 8.3.3.1 BN Edit Descriptor 8.3.3.2 BZ Edit Descriptor 8.3.4 Sign Control Editing 8.3.4.1 SP Edit Descriptor 8.3.4.2 SS Edit Descriptor 8.3.4.3 S Edit Descriptor 8.3.5 Integer Editing 8.3.5.1 I Field Descriptor 8.3.5.2 O Field Descriptor 8.3.5.3 Z Field Descriptor 8.3.6 Real Editing 8.3.6.1 F Field Descriptor 8.3.6.2 E Field Descriptor 8.3.6.3 D Field Descriptor 8.3.6.4 G Field Descriptor 8.3.6.5 Complex Data Editing 8.3.7 Scale Factor Editing-P Edit Descriptor 8.3.8 Logical Editing-L Edit Descriptor 8.3.9 Character Editing 8.3.9.1 A Field Descriptor 8.3.9.2 H Field Descriptor 8.3.9.3 Character Constants 8.3.10 Default Field Descriptors 8.3.11 Positional Editing 8.3.11.1 X Edit Descriptor 8.3.11.2 T Edit Descriptor 8.3.11.3 TL Edit Descriptor 8.3.11.4 TR Edit Descriptor 8.3.12 Additional Editing Operations 8.3.12.1 Q Edit Descriptor 8.3.12.2 Dollar Sign Descriptor 8.3.12.3 Colon Descriptor 8.4 Carriage Control 8.5 Format Specification Separators 8.6 External Field Separators 8.7 Run-Time Format 8.8 Format Control Interaction with I/O Lists 9 Auxiliary I/O Statements 9.1 OPEN Statement 9.1.1 ACCESS Keyword 9.1.2 ASSOCIATEVARIABLE Keyword 9.1.3 BLANK Keyword 9.1.4 BLOCKSIZE Keyword 9.1.5 BUFFERCOUNT Keyword 9.1.6 CARRIAGECONTROL Keyword 9.1.7 DEFAULTFILE Keyword 9.1.8 DISPOSE Keyword 9.1.9 ERR Keyword 9.1.10 EXTENDSIZE Keyword 9.1.11 FILE Keyword 9.1.12 FORM Keyword 9.1.13 INITIALSIZE Keyword 9.1.14 IOSTAT Keyword 9.1.15 KEY Keyword 9.1.16 MAXREC Keyword 9.1.17 NAME Keyword 9.1.18 NOSPANBLOCKS Keyword 9.1.19 ORGANIZATION Keyword 9.1.20 READONLY Keyword 9.1.21 RECL Keyword 9.1.22 RECORDSIZE Keyword 9.1.23 RECORDTYPE Keyword 9.1.24 SHARED Keyword 9.1.25 STATUS Keyword 9.1.26 TYPE Keyword 9.1.27 UNIT Keyword 9.1.28 USEROPEN Keyword 9.2 CLOSE Statement 9.3 INQUIRE Statement 9.3.1 ACCESS Specifier 9.3.2 BLANK Specifier 9.3.3 CARRIAGECONTROL Specifier 9.3.4 DIRECT Specifier 9.3.5 ERR Specifier 9.3.6 EXIST Specifier 9.3.7 FORM Specifier 9.3.8 FORMATTED Specifier 9.3.9 IOSTAT Specifier 9.3.10 KEYED Specifier 9.3.11 NAME Specifier 9.3.12 NAMED Specifier 9.3.13 NEXTREC Specifier 9.3.14 NUMBER Specifier 9.3.15 OPENED Specifier 9.3.16 ORGANIZATION Specifier 9.3.17 RECL Specifier 9.3.18 RECORDTYPE Specifier 9.3.19 SEQUENTIAL Specifier 9.3.20 UNFORMATTED Specifier 9.4 REWIND Statement 9.5 BACKSPACE Statement 9.6 ENDFILE Statement 9.7 DELETE Statement 9.8 UNLOCK Statement 10 Compiler Directives 10.1 Compiler Directive Syntax Rules 10.2 Parallel Directives 10.2.1 CPAR$ CONTEXT_SHARED 10.2.2 CPAR$ CONTEXT_SHARED_ALL 10.2.3 CPAR$ DO_PARALLEL 10.2.4 CPAR$ LOCKON, CPAR$ LOCKOFF 10.2.5 CPAR$ PRIVATE 10.2.6 CPAR$ PRIVATE_ALL 10.2.7 CPAR$ SHARED 10.2.8 CPAR$ SHARED_ALL 10.2.9 Parallel Directive Examples 10.3 General Directives 10.3.1 CDEC$ IDENT 10.3.2 CDEC$ PSECT 10.3.3 CDEC$ TITLE, CDEC$ SUBTITLE A Additional Language Features A.1 The ENCODE and DECODE Statements A.2 DEFINE FILE Statement A.3 FIND Statement A.4 PARAMETER Statement A.5 Octal Notation for Integer Constants A.6 /NOF77 Interpretation of the EXTERNAL Statement B Character Sets B.1 FORTRAN Character Set B.2 ASCII Character Set B.3 Radix-50 Constants and Character Set C FORTRAN Data Representation C.1 INTEGER * 2 Representation C.2 INTEGER * 4 Representation C.3 LOGICAL * 1 (BYTE) Representation C.4 LOGICAL * 2 and LOGICAL * 4 Representation C.5 Floating-Point Representations C.5.1 REAL * 4 (F_floating) C.5.2 REAL * 8 (D_floating) C.5.3 REAL * 8 (G_floating) C.5.4 REAL * 16 (H_floating) C.5.5 COMPLEX * 8 (F_floating) C.5.6 COMPLEX * 16 (D_floating) C.5.7 COMPLEX * 16 (G_floating) C.6 Character Representation C.7 Hollerith Representation D VAX FORTRAN Language Summary D.1 Expression Operators D.2 Statements D.3 Library Functions D.4 System Subroutine Summary D.4.1 DATE Subroutine D.4.2 IDATE Subroutine D.4.3 ERRSNS Subroutine D.4.4 EXIT Subroutine D.4.5 SECNDS Subroutine D.4.6 TIME Subroutine D.4.7 RAN Subroutine D.5 Bit Functions D.5.1 Bit Position D.5.2 Bit Function Arguments D.5.3 MVBITS Subroutine EXAMPLES 6-1 Using Multiple Function Names FIGURES 1-1 Required Order of Statements and Lines 1-2 FORTRAN Coding Form 1-3 Line Formatting Example 2-1 Array Storage 3-1 Conversion Rules for Assignment Statements 4-1 Equivalence of Substrings 4-2 Equivalence of Character Arrays 5-1 Nested DO Loops 5-2 Control Transfers and Extended Range 5-3 Examples of Block IF Constructs B-1 ASCII Character Set TABLES 1-1 Entities Identified by Symbolic Names 2-1 Data Type Storage Requirements 4-1 Equivalence of Array Storage 4-2 Equivalence of Arrays with Nonunity Lower Bounds 6-1 Argument List Built-In Functions and Defaults 6-2 Types of User-Written Subprograms 6-3 Summary of Generic Intrinsic Function Names 7-1 List-Directed Default Output Formats 8-1 FORMAT Code Summary 8-2 Effect of Data Magnitude on G Format Conversions 8-3 Size Limit of Numeric Elements Using the A Field Descriptor 8-4 Default Field Descriptor Values 8-5 Carriage Control Characters 9-1 OPEN Statement Keyword Values 9-2 Record Size (RECL) Limits 9-3 Record Size (RECL) Default Values 10-1 Common Block Default Attributes and PSECT Modification B-1 RADIX-50 Character Set with Comparative Values D-1 Expression Operators D-2 VAX FORTRAN Language Summary D-3 VAX FORTRAN Intrinsic Functions