Manual Order Number: 9800481 A
FORTRAN-SOPROGRAMMING MANUAL
Copyright 1978 Intel Corporation
PRINTED IN U.S.A./A151/1279/5K CP
PREFACE
Page
CONTENTS
PREFACE GLOSSARY CHAPTER INTRODUCTION TO FORTRAN
CHAPTER
FORTRAN CONCEPTS
ILLUSTRATIONS
CHAPTER PROGRAMMING GUIDELINES
APPENDIX A
FORTRAN-80STATEMENT SUMMARY
GLOSSARY
Record - A sequence of values or characters
1.1 An Introductory Example
CHAPTER INTRODUCTION TO FORTRAN
1.1.1 Comment Lines
1.1.2 Type Statement
1.1.3 Input Statements
1.1.4 Value Assignment Statement
1.1.5 Output Statements
1.2 Summary Of FORTRAN·SO Statements
1.1.6 Program Termination
1.2.1 Executable Statements
1.2.2 Nonexecutable Statements
1.2.3 Order of Statements
FEN:• • • •
2.1.3 Statements and Lines
2.1.2 The PROG RAM Statement
PROGRAM name
2.2 FORTRAN Statement Elements
2.2.1 Character Set
2.2.2 Constants and Variables
ARITHMETICOVERFLOW ERROR MURPHYSLAW
FORTRAN-80
PNAME AB HITS AVG
where
+64101 #14010
#4567Q+#AF2CH
2.2.4 Expressions and Operators
2.2.4.3 Relational Expressions
is evaluated as if it were written
10FLAG = FLAG +
IF FLAG1 .EQV. FLAG2 RETURN
15/3 + 18/9 = 5 + 2 =
2.2.5 Scope of Symbols
15/3 + 18/9 = 15/3 + 2 = 15/5 =
2.3 Notational Conventions
CALL sub arg,arg
Page
CHAPTER DEFINING VARIABLES ARRAYS, AND MEMORY
3.1Type Statements
3.1.1 REAL Type Statement
3.1.2 INTEGER Type Statement
3.1.3 LOGICAL Type Statement
•va,luernustueiA, Qp4
3.1.4 CHARACTER Type Statement
3.1.5 IMPLICIT Statement
CHARACTER * len, name ,name
v* len aryd* len
3.2 Array Definition
3.2.1 DIMENSION Statement
3.2.2 Kinds of Array Declarators
3.2.4 Referencing Array Elements
3.2.3 Properties of Arrays
ary s ,s
3.3 Assignment Statements
Dimension
Element
Declarator
3.3.1 Arithmetic Assignment Statement
TYPE OF
TYPE OF exp
RESULT
3.3.2 Logical Assignment Statement
3.3.3Character Assignment Statement
3.3.4 ASSIG N Statement
v = exp
ASSIGN stlTO name
3.3.5DATA Statement
r*c,r*c
3.4.1 EQUIVALENCE Statement
3.4 Memory Definition
DATA I,J,K/10,20,301
DATA ZEROS 110*0/1,J,K 110,20,301 &NAMES2 IOTTI
3.4.2COMMON Statement
COMMON /eb! nlist ,/ eb! nlist
3.4.2.1 Common Block Memory Sequence
3.4.3BLOCK DATA Subprograms
3.4.2.2 Named and Blank Common Blocks
3.4.4 BLOCK DATA Statement
CHAPTER 4 PROGRAM EXECUTION CONTROLS
4.1 Transferring Program Oontrol
4.1.1 Unconditional GO TO Statement
4.1.2 Computed GO TO Statement
GO TO name n, stl ,stl
IFexps1,s2,s3
4.1.3Assigned GO TO Statement
4.1.4Arithmetic IF Statement
4.1.5 Logical IF Statement
4.1.6 IF, ELSE IF, and ELSE Blocks
4.1.7 Block IF Statement
4.1.8ELSE IF Statement
4.1.9 ELSE Statement
4.1.10 END IF Statement
4.2.1 Operation of a DO Loop
4.2 Loop Control Statements
4.2.2 DO Statement
4.3 Program Termination Statements
4.2.3CONTINUE Statement
4.3.2 STOP Statement
4.3.1 PAUSE Statement
4.3.3EN 0 Statement
CHAPTER FUNCTIONS AND SUBROUTINES
5.1Intrinsic and Statement Functions
5.1.1Intrinsic Functions
A = 33 + SQRT8
5.1.2 INTRI NSIC Statement
5.1.3 Statement Functions
INTRINSIC tunc ,tunc
tunc dum ,dum ... = exp
5.1.3.2 Statement Function Limitations
5.1.3.1 Referencing Statement Functions
156.8
5.2 External Procedures
5.2.1 FUNCTION Statement
5.2.1.1 Referencing External Functions
typ FUNCTION tunc dum ,dum
5.2.2Subroutines
5.2.1.2 FUNCTION Subprogram Limitations
~RETURN
CA.~END
5.2.3 SUBROUTINE Statement
5.2.4 RETU RN Statement
5.2.5SAVE Statement
5.2.6EXTERNAL Statement
SAVE lebl ,Iebl
EXTERNAL proe ,proe
5.3 Arguments And Common Blocks Revisited
5.2.7 CALL Statement
5.3.1 Common Blocks
5.3.2 Dummy And Actual Arguments
5.3.3 Association Of Arguments
Functions And Subroutines
5.3.3.4 Procedures As Dummy Arguments
5.3.3.1 Agreement Of Argument Lengths
5.3.3.2 Variables As Dummy Arguments
5.3.3.3 Arrays As Dummy Arguments
5.3.3.5Argument Association Limitations
FX, Y,
Page
CHAPTER INPUT/OUTPUT
6.1Records, Files, And Units
6.1.1Record Properties
6.1.2 File Properties
6.1.2.1 File Existence
6.1.2.2 File Name
6.1.2.3 File Position
6.1.2.4 External And Internal Files
6.1.2.5 File Access
6.1.3 Unit Properties
6.2 File-HandlingStatements
6.2.1 OPEN Statement
6.2.1.1 Unit Specifier
6.2.1.21/0 Status Specifier
6.2.1.4 File Name Specifier
6.2.1.3 Error Specifier
6.2.1.5 File Status Specifier
6.2.1.7 Formatting Specifier
6.2.1.6 Access Method Specifier
6.2.1.8 Record Length Specifier
6.2.1.9 Blank Specifier
6.2.2CLOSE Statement
6.2.1.11 Opening A Connected Unit
6.2.2.1 Unit Specifier
CLOSE close-list
6.2.3 BACKSPACE Statement
6.2.4 REWI N D Statement
6.2.2.2 File Disposition Specifier
REWI N Darg-list
6.3 Data-Transfer 1/0 Statements
6.2.5 ENDFILE Statement
6.3.1 READ Statement
REWIND REWIND 3, IOSTAT= ERRFLG, ERR=
6.3.1.1 Control Information List
Examples
6.3.2WRITE Statement
6.3.1.2 Input List
6.3.1.3 Implied-DOList
WRITE ctl-list out-list
6.3.3 PRINT Statement
6.4Formatted And Unformatted Data Transfer
6.4.1 Unformatted Data Transfer
6.4.2.1 Printing Formatted Records
6.4.2 Formatted Data Transfer
6.4.2.2 Format Control
6.4.3.t Edit Descriptors
6.4.3FORMAT Statement
stl FORMAT flist
1 is Ff
Edit Descriptor
Absolute value of exp
Form of exp
OY1 Y2
either a sjgu ora letter indicatingthebas¢
a Z5editdesctiptor
Example
FS.2
DollytSigfjl$ijitrrrg·
6.4.4List·Directed Formatting
6.4.4.1 List-Directed Input
6.4.4.2 List-DirectedOutput
Page
7.1.1 Problem Definition
CHAPTER PROGRAMMING GUIDELINES
7.1 Program Development
7.1.2 Program Documentation
7.1.3 Refining The Problem Definition
7.1.4 Final Coding
7.2 FORTRAN Coding
7.2.1 Functions And Subroutines
7.2.2 GO TO Statement
7.2.3 Crossing Unit Lines
7.3 References
7.2.5 Reminders
X = 2217*r* *2
PI =
1972
A.1 Statement Sequence
APPENDIX A FORTRAN-80STATEMENT SUMMARY
A.2 Statement Summary
ERR = stl
ERR = stl
FORTRAN-80Statement Summary
DATA Statement Category: Nonexecutable
ELSE IF Statement Category: Executable, Block IF
EQUIVALENCE Statement
FUNCTION Statement Category: Nonexecutable
IMPLICIT Statement
OPEN Statement
fORTRAN-80Statement Summary
REWIND Statement
SUBROUTINE Statement Category: Executable
APPENDIX B INTRINSIC FUNCTIONS
B.1 Intrinsic Function Summary
Intrinsic Functions
FORTRAN-80
<ORM
CATEGORY
B.2 Notes On Intrinsic Functions
Page
APPENDIX C HOLLERITH DATA TYPE
C.1 Hollerith As A Data Type
C.2 The Hollerith Constant
C.2.1 Hollerith Constants In DATA Statements
C.4 AEditing Of Hollerith Data
C.3 Hollerith Format Specification
Hollerith Data Type
0.1 Standard Extensions To 1977 Subset
APPENDIX D EXTENSIONS TO ANSI FORTRAN
0.2Nonstandard Extensions To 1977 FORTRAN
0.3 More Specific Semantics Than 1977 FORTRAN
0.4 Differences From 1966 FORTRAN
Miscellaneous extensions Seven-dimensionalarrays
Page
ASCII CODES
APPENDIX E
Page
APPENDIX F 8080/8085 PROCESSOR DEPENDENCIES
F.1 Processor Limitations On Language
F.2 Compiler Extensions
Length
F.2.3 Reentrant Procedures
F.2.1 Lowercase Letters
F.2.2 Port Input/Output
F.2.4 Free-formLine Format
F.2.6 Default Data Lengths
F.2.5 Interpretation of DO Statements
F.2.7 Including Source Files
$0077
F.2.9 Flexibility In Standard Restrictions
F.2.8 REel Specification For Sequential Files
F.3 Unit Preconnection
INDEX
Index FREEFORM Compiler Control, F-2
FORTRAN-SO
Index
Page
NOTES
NOTES
SOFTWARE PROBLEM REPORT
inter
111111
BUSINESS REPLY CARD
Postage will be paid by Addressee
Intel Corporation Attn: Literature Department
REQUEST FOR READERSCOMMENTS
FORTRAN·80PROGRAMMING MANUAL 9800481 A
111111
BUSINESS REPLY CARD
0LIKE YOUR COMMENTS
Intel Corporation Attn: Literature Department
Page
inter
Printed in U.S.A