Digital PDFs
Documents
Guest
Register
Log In
EY-1233E-ID-001
April 1983
88 pages
Original
2.9MB
view
download
Document:
ANSI-77 FORTRAN Information Document
Order Number:
EY-1233E-ID
Revision:
001
Pages:
88
Original Filename:
OCR Text
EY-1233E-ID-OOO 1 ANSI-77 FORTRAN Information Document Prepared by Educational Services Of Digital Equipment Corporation Is t @ Di 9 ita I Eq u i pm en t Ed i t ion, Ap r i I I 98 3 Co r PJ rat ion I 98 3 • All Rights Reserved. Printed in U.S.A. The information in this document is subject to change without notice. Dig ital Equi pment Corporation assumes no responsibiliity for any errors that may a ppear in thi s man u31 • The software described in this document is furnished under a license and may not be used or copied except in accordance with the terms of such license. Di g i ta I Eq u i pm en t Co r po rat ion ass um e s no responsibility for the use or reliability of its software on equipment that is not supplied by Digital. The following are trademarks of Equi pmen t Co r po ration: DIBOL ~D~DD~D DEC MASSBUS DECrnate PDP DECnet P/OS DECsystem-IO Pro fe ssio nal DE C S YS T EM - 20 Rainbow DECUS RSTS DECwr iter RSX Dig ital TOPS-IO TOPS-20 UNIB US VAX VMS VT Wo r k Processo r 5/83-15 CONTENTS PREFACE CHAPTER 1 INTRODUCTION 1. 1 1.2 1.2. 1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 ION'rRODUCTION •••••••••.•..•••••.••••••••••••••••••• 1-1 CHARACTER CONVENorIONS •••••••••••.•••••••••••.••.•. 1-1 Character Constants and Symbolic Constants .••••• 1-1 Character Variables and Arrays •••••••••••••••••• 1-2 Character Re1atiana1 Expressions •••••••••••••••• 1-3 Ch a r act erAs s i 9 nm en t S tat 9 men t s • • • • • • • • • • • . . • • • • 1-- 4 Sub s t r in 9 Re fer en c e and De fin i t ion • • • • • • • . • • • • • • 1-4 Character Expressions ••••••.•••••••••••••.•••••• 1-S Character Var iab1es and Constants in DATA Sota tern en ts •••••••••••••••••••••••••••••••••••••• 1-6 Character Variables, Array Elements, Arrays, and Substrings in Input Lists ••••••••••••••••••• 1-5 Chara~ter Constants, Variables, Array Elements, Arrays, Substrings, and Ex pr e S5 ion sin Ou t pu t Li s t s ••••••••••••••••••••• 1-7 Character Functions ••••••••.••••••••••••••••••.• 1-7 Dummy and Actual Arguments of Type Character •••• 1-7 Intrinsic Functions that Operate on Character Data •••••••••••••••••••••••••••••••••• 1-7 Character Variable Names, Array Element Names, Array Names, and Substring Names in EQUIVALENCE Statemen ts •••••••••••••••••••••••••• 1-7 Character Variable and Arrays in COMMON Blocks •• 1-8 Charactar Variables and Expressions as the Values of the Specifiers in OPEN Stat-aments ••••• 1-8 Character Constants, Character Arrays, and Character Variables as Format Specifiers •••••••• 1-8 C ONTR OL S 'rA TEJ'v1 ENTS •••••••••••••••••.••.••••••••••• 1-8 BLOCK IF, ELSE IF, and END IF Statements •.•••••• 1-8 DO Loop Semantics ••••••••••••••••••••••••••.••• 1-10 INPUT/OUTPUT ••••••••••••••••••••••••••••••••••••• 1-10 Format Edit Descriptors •••••••••••••••••••••••• l-10 Expressions on Output Lists . . . . . . . . . . . . . . . . . . . . . 1-12 Internal Fi1es ••••••••••••••••••••••••••••••••• 1-13 Unit Specifier and Identifier •••••••••••••••••• 1-13 Format Specifier and Identifier •••••••••••••••• 1-14 ASSUMED SIZE ARRAY DECLARATORS ••••••••••••••••••• 1--14 USE OF A FOR!'1AT S'rATE1'v1ENT LABEL IN AN ASSIGN STATEMENT •••••••••••••••••••••••••.•••••••••••••• 1-14 1.2.8 1. 2.9 1.2.10 1.2. 11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.3 1.3. 1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5 1.6 iii CONTENTS (Cont) 1.7 1.8 1.9 1.10 IN'rRINSIC AND EXTERNAL STATE!~ENTS ••..•.....••.•.• 1-14 SAVE STATENlENT ...•.••.•.••..•.....••.•.•.•..••..• 1-15 NULL ARGUMENr LISTS FOR FUNCTIO~S •..•.••....•.••• 1-15 CONSTANT EXPRESSIONS ••.•..•..•..•...••...•.••.... 1-15 CHAPTER 2 TOPS-IO/20 FORTRAN 2.1 2.2 MAJOR FEA'rURES OF VERSION 7 'rHAT WERE No'r IN I·NTRODUCTION .•.•.•••••.•...••..•••...•••.•..••••.• 2-1 VE R S ION 2.2. 1 2.2.1.1 2.2.1.2 2.2.1.3 2.2.1.4 2.2.1.5 2.2.1.6 2.2.1.7 2.2.1.8 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.2.10 2.2.11 2.2.12 2.2.13 6......................................... 2 - 1 Features Supported for Character Data •...•.•••.. 2-1 Character Assignment Statements ..•.•••••.•.•.• 2-1 Character Expressions •••.•...••••..••..•..•.•• 2-2 Character Variables and Constants in DATA Sta temen ts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 Character Variables, Array Elements, Arrays, and Substrin.~s in Input Lists •••.•.•.•...••••• 2-2 Dummy and Actual ArguInents of Type Character .• 2-2 EQUIVALENCE Statements ...•••••.•...•••.•...••. 2-~ Character Variables and Arrays in COMMON Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 Namel ists ••••••..•••.•••..•.•.••.•••••.••..•.. 2-2 IF THEN ELSE Statements •.•.••••••...••••..•••••. 2-3 Expressions on Output Lists ••.•.••••••.•..•••••• 2-3 In tr insic and Gener ic Func tions a t the li'OR'rRAN-77 Full Lang uag e Level ••••••.•••.••••••• 2-3 Internal Files (.single-Record and Mu1tirecord) •. 2-3 FORTRAN-77 DO Loop Semantics •••..•••••••••.•.••• 2-4 Assumed-Size Array Declarators •••••••••••••••••• 2-4 Use of FORMAT Statement Numbecs in ASSIGN Sta tamen ts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4 ·INTRINSIC Statement; EXTERNAL Statement •••.••••• 2-4 SAVE Statement ••••.••••••.••••••••••••••••.••••• 2-4 Null Arg umen t Li st s fo r Func tio ns ••••.•••...•••• 2-4 .Minor Syntax Extensions Required by the FORTRAN-77 Standard •••••••••••••.•••••••.••.•••• 2-4 Compile Time Constant Expressions in Declar; tions, as Array Bounds, and String Bo und s ••••••••••••.•••••••.••••••••••••••••••••• 2-5 2.2.14 2.2.15 2.2.15.1 2.2.15.2 2.2.15.3 2.2.16 2.2.17 2.2.18 2.2.19 FORTRAN-77 PARAME'rER Statements •.•••••.••••••••• 2-5 DO WHILE and END DO Statements ••••••••••••••.••• 2-5 Optional Statement Label in the Indexed (Standard) DO Statement •.••••••••••••••••••••• 2-5 DO WHILE Statement •••••••••.•••••••••••••.•••• 2-n END DO Statement •••••••••..••••••••••••••••••• 2-6 LINKt ime Type-Chec king 0 f Subprog ram Arg umen ts •• 2-6 G-F1oating Double-precision Numbers •••.••••••••• 2-7 Native TOPS-20 Command Interface for the Co mp i 1 e r • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • 2 - 7 New Functionality in the ERRSET Subroutine •••••• 2-7 iv - - - - - - - - - - - - - - _.. _ - - - - - . - - - --_. ._... _-_ ..._--_._-- - - - - - - CONTENTS (Cant) 2.2.20 2.3 2.4 Utility Subroutine to Get a Free Unit Number •••• 2-8 FORTRAN-77 FEATURES THAT ARE NOT SUPPORTED •••••••• 2-8 SUMMARY OF EXTENSIONS TO THE FORTRAN-77 STANDARD •• 2-9 CHAPTER 3 VAX-II FORTRAN 3.1 3.2 3.2.1 3.2.2 3. 2. 3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.17 3.2.18 3.2.19 3.2.20 3.2.21 3.3 3.4 3.5 3.6 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 INrrRODUCTION ••••.•••••••••••••••••••••••••••.••••• 3-1 NEW FEATURES SUPPOR'rED BY VERSION 3 ••••••••••••••• 3-2 Bit Functions ••••••••••••••••••••••••••••••••••• 3-2 Debugger Commands for Source Code Debugg ing ••••• 3-3 DEFAULTFILE Keyword, in the OPEN Statement ••••••• 3-3 IMPLICIT NONE Statement ••••••••••••••••••••••••• 3-3 FORTRAN Data Manipulation Language Preprocessor.3-4 Faster I/O Interface •••••••••••••••••••••••••••• 3-4 Zero-Extending Intrinsic Functions •••••••••••••• 3-4 Library-Based INCLUDE Statement ••••••••••••••••• 3-4 Improved Math Routines •••••••••••••••••••••••••• 3-5 Namelist-Directed I/O Statements •••••••••••••••• 3-5 Optimization of Generateg Code •••••••••••••••••• 3-5 Optimization of I/O Routines •••••••••••••••••••• 3-5 Checking for Extensions to the FORTRAN-77 Standard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5 A Cross-Reference Listing ••••••••••••••••••••••• 3-5 Floating-Underflow Checking ••••••••••••••••••••• 3-6 Sub s t r in 9 - B 0 un d s Ch e c kin g • • • • • • • • • • • • • • • • • • • • • • • 3 - f) OPTIONS Statement ••••••••••••••••••••••••••••••• 3-6 FORTRAN Definitions for System Symbols •••••••••• 3-6 Trigonometric Functions in Degrees •••••••••••••• 3-6 Run - Tim e I/O Err 0 r Me s sag e s • • • • • • • • • • • • • • • • • • • • • 3 - 6 /SHOW Qualifier ••••••••••••••••••••••••••••••••• 3-7 E XTENS IONS TO THE ANS I STANDARD ••••••••••••••••••• 3-7 ADDI'rIONAL FEATURES •••••••••••••••••••••••••••••• 3-10 VAX-II FOR'rRAN COMPILER OP'rr.r>4IZATIONS •••••••••••• 3-10 COMPATIB ILITY: VAX-II FORTRAN AND FORTRAN-66 •••• 3-10 DO Loop Minimum Iteration Count •••••••••••••••• 3-11 E XT E RNA L S tat e men t • • • • • • • • • • • • • • • • • • • • • • • • • • • • • 3 -11 OPEN Statement Keyword Defaults •••••••••••••••• 3-11 OPEN Statement' Status Keyword Default •••••••••• 3-11 X Format Edit Descriptor ••••••••••••••••••••••• 3-12 CHAPTER 4 PDP-II FORTRAN 4.1 4.2 4.2.1 4.2.1.1 4.2.1.2 4.2.1.3 4.2.1.4 4.2.1.5 INTRODUCTION •••••••••••••••••••••••••••••••••••••• 4-1 NEW FEATURES ••••••••••••••••••••••••••• ~ •••••••••• ~-2 Fea t ure s Suppo r ted fo r Cha r ac te r Da ta ••••••••••• 4-2 Character Constants ••••••••••••••••••••••••••• 4-2 Substr ing Reference and Definition •••••••••••• 4-2 Character Expressions ••••••••••••••••••••••••• 4-2 Character Variables and Arrays •••••••••••••••• 4-2 Charac ter Relational Expressions •••••••••••••• 4-2 v CONTENTS 4.2.1.6 4.2.1.7 (Cont) 4.4 4.5 4.6 4.6.1 4. 6. 2 4.6.3 4.6.4 4.6.5 4.6.6 Character Assignment Statements ••••••••••••••• 4-2 Character Variables and Constants in DATA Sta temen ts •••••••••••••••••••••••••••••••••••• 4-3 Character Functions ••••••••••••••••••••••••••• 4-3 IF rrHEN ELSE Sta temen ts ••••••••••••••••••••••••• 4-3 FEATURES OF THE FULL-LANGUAGE FORTRAN AS DEFINED BY 'rHE ANS I STANDARD •••••••••••••••••••••••••••••• 4-3 Exponentiation Forms •••••••••••••••••••••••••••• 4-3 Format Edit Descriptors ••••••••••••••••••••••••• 4-3 IN'rR INS IC and EXTERN.~ L Sta temen ts ••••••••••••••• 4-4 Generic Function Selection Based on Argument Da ta Type fo r FORTRAN-De fi ned Func tio ns ••••••••• 4-4 PARAMETER Statements •••••••••••••••••••••••••••• 4-5 General ized DO Loop Parameters •••••••••••••••••• 4-5 Lower and Upper Bound s Spec ification in Array Declarators ••••••••••••••••••••••••••••••••••••• 4-5 Optional Syntax for I/O Statements (UNIT= and F1VIT~) •••••••••••••••••••••••••••••••••••••••••• • 4-5 EXTENSIONS TO THE ANSI STANDARD ••••••••••••••••••• 4-5 ADDIT IONA L FEATURES ••••••••••••••••••••••••••••••• 4-7 COMPATIBILITY: PDP-II FORTRAN AND FORTRAN-66 ••••• 4-7 DO Loop Minimum Iteration Count ••••••••••••••••• 4-7 E XT ERNA L S tat e men t • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • 4 - 7 OPEN Statement Keyword Defaults ••••••••••••••••• 4-7 OPEN Sta temen t Sta tus Keywo rd De fa ul t ••••••••••• 4-8 Blank Common Block PSECT (.$$$$.) •••••••••••• ~ •• 4-8 X Format Edit Descriptor •••••••••••••••••••••••• 4-8 CHAPTER 5 A COMPARISON OF FORTRAN LANGUAGE FEATURES 4.2.1.8 4.2.2 4.3 4.3.1 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4. 3. 8 TABLES Table No. 3-1 4-1 5-1 5-2 5-3 5-4 5-5 5-6 5-7 5-8 5-9 5-10 5-11 Title Tr ig onometr ic Func tions •••••••••••••••••••••••••• 3-6 Allowed Combinations of Types of Base and Ex I?<> nen ts ••••••••••••••.•.••••••••••••••••••.•••• 4-3 Prog ramming Considerations ••••••••••••••••••••••• 5-1 Subprogram Statements •••••••••••••••••••••••••••• 5-3 Constant and Variable Types •••••••••••••••••••••• 5-4 Da ta Type s ....•....................•.•..••....•• . 5-5 Spec ification Statements ••••••••••••••••••••••••• 5-6 Data Initialization Statement •••••••••••••••••••• 5-8 Relational Operators ••••••••••••••••••••••••••••• 5-8 Logical Operators •••••••••••••••••••••••••••••••• 5-9 Ass ig nmen t Sta temen ts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9 Control Statements •••••••••••••••••••••••••••••• 5-10 Sequential I/O Statements ••••••••••••••••••••••• 5-l2 vi - - - - ---------------- ----- Page TAB LE S Table No. 5-12 5-13 5-14 5-15 5-16 ( Co n t) Title Page F i 1 e Co n t r 0 1 Stat erne n t s • • • • • • • • • • • • • • • • • • • • • • • • • 5-1 5 Direct Access I/O Statements •••••••••••••••••••• 5-15 Indexed I/O Statements •••••••••••••••••••••••••• 5-16 For mat and Typ e s 0 f Co n v e r s ion • • • • • • • • • • • • • • • • • • 5 -1 7 Library Functions ••••••••••••••••••••••••••••••• 5-19 vii PREFACE American National Standard programmin';J Language FORTRt\N, X3.9-l978, specifies the form and establishes the ANSI interpretation of programs expressed in the FORTRAN language. Its purpose is to promote portability of FORTRAN programs for use on a var iety 0 f data processing system s. FORTRAN 77 is a reVISIon of American National Standard FORTRAN, ANSI X3.9-l966. It describes two levels of the FORTRAN 1 ang uag e, re ferred to as FORTRAN and Sub se t FORTRAN. FORTRAN 77 includes the subset, American National Standard Basic FORTRAN, ANSI X3.l0-l966. This information document provides information about ANSI-77 standard FORTRAN and Dig ital' s FORTRAN features under TOPS-lO/20, VAX, and PDP FORTRAN. The primary functions of this document are to serve as a reference point to and summary of more detailed information, and to serve as a quick review of new features and changes, such as the comparison and contrast of different versions or of different operating systems. The target audience for this document is software s pe cia lis t s wh 0 se res po n sib iIi tie sin c 1 ud e pr e sa 1 e, ins tall at ion, and warranty support 0 f FORTRAN. These spec ial ists should have the following prerequisite skills and training: programming experience; a knowledge of FORTRAN; and user-level knowledge of the TOPS-IO/20, VMS, and the several operating systems that run on the PDP-li family of computers. This document is not a tutorial in the application of FORTRAN. ix ----------------------- CHAPTER 1 INTRODUCTION 1.1 INTRODUCTION The FORTRAN language was originally developed for solving mathematically oriented problems. The engineering and scientific communities, as well as the business community use it extensively for analytical work. FORTRAN appl ications have evolved to include more general appl ications involving character and file manipulation. In March 1976 a new standard was drafted to ensure portability of FORTRAN programs that include the advanced file and character handling features. The final version of this standard was approved on 3 Apr il 1978 and is referred to in this document as the FORTRAN-77 or ANSI-77 standard. The following paragraphs summarize the appropriate sections of the FORTRAN-77 full language standard (ANSI X3.9-1978). (These sections reflect the major areas of change involved in the new v e r s ion s 0 f TO PS -1 0/2 a, VM S , and th e PD P fa mil y 0 f 0 pe rat in g systems.) This is not meant to be a complete delineation of all the changes that were added to the previous standard (ANSI X3. 9-1966). Descriptions of these changes are found in the Amer ic an Na tio nal Stand ard Prog r amm ing Lang uag e FOR TRAN, ANS I X3.9-1978 publ ished bOy-the ~errc an--Na tional Standard s -'InstItute. 'rhe following paragraphs refer to specific sections of this book. 1.2 CHARACTER CONVENTIONS 1.2.1 Character Constants and Symbolic Constants A character datum has one character storage unit in a storaSJe sequence for each character in the datum. A storage sequence 1S a sequence of storage units (either numeric or character). If a datum requires more than one storage unit in a storage sequence, these storage units are consecutive. (Section 2.13) A character datum is a string of characters consisting of any characters capable of being represented in the processor. (Blank characters are valid and significant.) The character position of each character in the string is numbered consecutively from left to rig ht • (Sec tio n 4. 8) A character constant is a string of printable ASCII characters enclosed by apostrophes. Blanks between delimiting apostrophes are significant, but the delimiting apostrophes are not counted 1-1 INTRODUCTION as part of the datum. Within a character constant, the apostrophe character is represented by two consecutive apostrophes with no space or other character between them. A character constant has the form: 'clc2c3 ••••• cn' where cl,c2,c3, ••• ,cn are printable characters. A character constant expression is a character expression in which each operand is a character constant, the symbol ic name of a char ac ter constan t, 0 r a c ha r ac ter constan t ex pr e ssio n enc losed in parentheses. (Variables, array elements, substrings, and function references are not allowed.) (Section 6.2.3) A parameter statement allows constants to be defined symbolically during compilation. Its form is: PARA.I'V1E'fER (p=e (,p=e] .) where p is a symbol ic name and e is a constant expression. The constant acquires the same data type as the symbol ic name. In particular, if P is a character constant expression, e must correspondingly be a character constant expression. The scope of a parameter is .the program unit in which it is declared. The data type of a symbol ic name is specified by a type-statement or IMPLICIT statement preceding the defining PARAMETER statement. The default length for the symbolic name is one; other lengths c an be spec i fi ed in type- sta temen ts 0 r IMPLIC 1'f sta temen ts preceding the symbolic name. (Refer to section 8.6.) rrhe following is an example of the parameter statement. CHARACTER DE UfA, EPS ILON*3 PARAMETER (DELTA='DIFF',EPSILON='SUM' ,E=2.7) 1.2.2 Character Variables and Arrays The form of a character type-statement is: CHARACTER [*len (,]] nam [,naml where nam is of the form: v (* lenl a [(d)] [*len] [v is a var iable name, symbol ic name 0 f a constan t, func tion name, or dummy procedure name; a is an array name; a(d) is an array declarator; len is the number of characters 0 f a character 1-2 IN'rRODUC TION variable, character array element, or character function.] to se c t ion 8. 4. 2. ) (Refer 'rhe length specification Gan be an unsigned integer constant, a positive-valued integer constant expression in parentheses, or an asterisk in parentheses. In the sta tem en t : CHARACTER*4 ALPHA,BETA*1,GAMMA(lO)*8 the following character declarations are made. ALPHA has a length specification of 4 BE'rA ha s a l eng th spec i fic ation 0 f 1 GAMM A has a 1 eng th s pe c i f i cat ion 0 f 8 1 • 2. 3 Ch a rae te r Re 1 at ion a I Ex pr e s s ion s A character relational expression has the form a reI b where a and b are character ·expressions and reI is a relational operator. (Refer to section 0.3.4.) This expression is interpreted as logically true if the values of the operands satisfy the relation specified by the operator; it is interpreted as false if the relation is not satisfied. (Section 6.3.5) 'rhe six relational operators are: Less than Less than or equal to Equal to Not equal to Greater than or equal to Greater than • LT. • LE. • EQ. .NE. .GE. .GT. In character relational expressions, less than means "precedes in the ASCII collating sequence." For example, the expression: 'ABCD' .LT. 'CDEF' states that 'ABCD' is less than 'CDEF'. Because this relationship does exist, the value of the expression is true. If the relationship did not exist, the value of the relationship wo uld be fal se • If the two character expressions in a relational expression not the same length, the shorter of the two is padded on 1-3 are the I N'rR ODUC TI ON right with spaces until the lengths are equal. the relational expressions: 'ABC' 'AB' .EQ. .LT. For example, in 'l\BC' 'C' the first has a value of true, even though the lengths of the expressions are not equal; and the second has a value of true even though 'AB' is longer than 'C'. 1.2.4 A Character Assignment Statements character assignment statement has the form: = e v where v is the name of a element, or character ex pr e s s ion. character variable, sub str ing ; and e c ha r ac te r a r ray is a character Execution of this statement causes e to be evaluated and v to be assigned the value of e. V and e may be of different lengths. (Section 10.4) In the full language, only as much of the value of e must be defined as is needed to define v. For example: CHARACTER X*4,Y*5 X=Y doe s not r e qu ire th a t th e sub s t ring Y ( 4 : 5) be d e fin e d • 1.2.5 Substr ing Reference and Definition character is a contiguous segment of a variable or character array element. A character sub str ing is identified by a substring name and can be assigned val ue sand referenced. (Section 5.7) A character substring A character substring reference has one of the following v( [el]: [e2]) a(s[,s] ••• ) ([e1]:[e2]) where: • v is a character variable name • a is a character array name 1-4 forms: INTRODUCTION • s i s a sub sc r i pt ex pr e s s ion • el is an optional numeric expression that specifies leftmost character position of the substring the • e2 is an optional nurner ic expression that spec ifies rightmost character position of the substring. the Character positions within a character variable or array are numbered from left to right, starting with 1. element The values of al and e2 must satisfy the inequalities: 1 • LE. e 1 • LE. e 2 • LE. len to be If el is omitted, its value is implied om itt ed, its val ue is i mpI i e d to be 1 en. character substr ing is e2 - el + 1. 1; if e2 is The 1 eng th 0 f a If el or e2 is not an integer, it is converted to an integer val ue b y t r un cat i ng its f r act i 0 na 1 pa r t • ( Sec t ion s 5. 7 • 1, 5. 7 • 2) For example, in the statement: CHARACTER TLC*8,XIN(3,4)*6 'rLC=' START' XIN(2,3)='OUTPUT' the substring name TLC(2:5) has a character value of II TART" and the substring name XIN(2,3) (4:6) has a character value of "PUrr." In the CHARACTER type statement, character variable TLC is declared as having a string length of 8 and each element of character array XIN has a string length of 6. 1. 2. 6 Char ac ter Ex pressions Character expressions (including the concatenation operator) A consist of character operands and c ha r ~c te rope r a to r s • character operand can be: 1. A character constan t 2. A symbol ic 3. A character variable 4. A character a r ray e 1 em en t 5. A character sub str ing name 0 f a c harac ter constan t 1-5 INTRODUCTION 6. A char ac ter parenthe se s 7. A character function reference. ex pression, optionall y The character operator is the concatenation character expression of the form: enclosed in (II). A operator character operand [Ilcharacter operand] ••• for example x21lxl, is interpreted 'as xl concatenated with x2. The resulting character string has the value of the value of xl on the right concatenated with the value of x2 on the left. The length of this resulting character string is the sum of the lehgths of xl and x2. Parentheses do not affect the value of a character expression. Variables, array elements, substrings, and function references are not allowed. (Sections 6.2, 6.2.1, 6.2.2.1, 6.2.2.2, 6.2.3, 6.6.5) For example, the value of the character expression i s the c ha r a c te r s t ring 'X YZAB CD' • 'XYZ'II'ASCD' 1.2.7 Character Variables and COnstants in DATA Statements The fo rm 0 f the DA'rA sta temen t i s : DATA nl ist/cl ist/ [ [ ,1 nl ist/cl ist/l ••• where nlist is a list of variable names, array names, array element names, substring names, and implied-DO lists; and clist is a constant 1 ist of the form a[ ,al ••• where each a is either a constant, a parameter, or a repetition factor of the form n* followed by a constant or parame.ter (denoting n successive appearances of the constant or parameter separated by commas) • Fo rex am pI e : CHARACTER*4 TEXT DA Tl\ TE XT / ' YY XX ' I illustrates the use of a character constant in a DATA (Re fer to sec tion 9.4.) statement. 1.2.8 Character Variables, Array Elements, Arrays, and Substrings in Input Li sts These are discussed in Section 12.8.2.1. 1-6 INTRODUCTION 1.2.9 Character Constants, Variables, Array Elements, Arrays, Substrings, and Expressions in Output Lists Input/output lists are used in READ, WRITE, or PRINT statements to spec ify data to be transferred. (Section 12.8.2.2) 1.2.10 Character Functions These include intrinsic functions, external statement functions that return values of (Sections 15.2, 15.2.2, 15.4) func tions, and type character. 1.2.11 Dummy and Actual Arguments of Type Character These are discussed in section 15.9.3.1. 1.2.12. Intr insic Functions that Operate on Character Data These functions are LEN, INDEX, CHAR, ICBAR, LGE, LGT, LLE, and LLT. (Refer to section 15.10.) LEN gives the length of the character entity. INDEX(al,a2) gives the location of substr ing a2 in string ale CHAR(i) returns the character in the i-th posi tion of the processer collating sequence. The val ue is 0 f type character of length one. ICHAR gives the position of a character in the processor collating sequence. LGE(al,a2) returns the value true if al = a2 or if al follows a2 in the ASCII standard collating sequence and returns the value false otherwise. LGT(al,a2) returns the value ·true if al follows a2 in the standard collating sequence and otherwise returns the value false. LLE (al,a2) returns the value true if al = a2 or if al precedes a2 in the standard collating sequence, and otherwise returns the value false. LLT(al,a2) returns the value true if al precedes a2 in the standard collating sequence and otherwise returns the value false. 1.2.13 Character Variable Names, Array Element Names, Array Names, and Substr ing Names in EQUIVALENCE Statements An EQUIVALENCE statement is used to specify the sharing of s to rag e un its by two 0 r m0 r e en tit i e s i n a pr og r am un it. (Sections 8.2, 8.2.1, 8.2.3) The form of the EQUIVALENCE s ta tern en t i s : E QU I VA LE NC E ( nl i s t) [ , ( nl i s t) ] ••• where nlist is a list of variable names, array element names, array names, and other character. substring names. Character strings may be equivalenced only with other character strings. The association is made between the first storage units occupied 1-7 INTRODUCTION by entities appearing in the equivalence 1 ist. Any adjacent characters may also have the same character storage unit and thus may be associated. For example: CHARACTER A*6, C(4)*4 E QU I VA LE NC E ( A, C ( 2 ) ) causes the following associations: Storage unit: 1 2 3 4 5 6 7 8 Variable A: - - - - A - Array C: - - C(2) -f- C(3) 1.2.14 Character Variable and Arrays in COMMON Blocks The fo rm of a C01VlMON sta temen t i s : COMMON [f[cb] f] nlist [,] f[cb] f nlistl ••• where cb is a common block name and nlist is a list of var iable names, array names, and array decl arator s. If a character variable or array is placed in a common block, that block must contain only character data. (Section 8.3.1) 1.2.15 Character Variables and Expressions as the Values Specifiers in OPEN Statements These are discussed in section 12.10.1. 1.2.16 Character Constants, Character Variables as Format Specifiers The form of a FORMAT statement is: Arrays, and of the Character FORMAT fs where fs is a format specification. One of the options for the format identifier is a character array name, character variable, character array element, or character expression. (Section 13.1.2) 1.3 CONTROL STATEMENTS 1.3.1 BLOCK IF, ELSE IF, and END IF Statements FORTRAN-77 ha s add ed BLOC K IF, ELSE IF, ELSE, and END statements. (Refer to sections 11.6, 11.7, 11.8, and 11.9.) IF The IF-level of a statement s is nl - n2 where nl is the number of block IF statements from the beg inning of the program unit up 1-8 - - _.. _ _. _ - - - - - - - - - - - - - - - - - - - - .... _._-_.. _.. _-_._.._.- --_._-_ .. _..... _.__._ ......_._--_. - - INTRODUCTION to and including s, and n2 is the number of END IF statements in the program unit up to but not including s. This facility enables the processor to determine which IF-THEN-ELSE statements correspond to eac h 0 the r • The form of a BLOCK IF statement is: IF (e) THEN 'it/here e is a log ical expression. The processor executes a BLOCK IF statement by first evaluating e. If the value of e is true, and the IF block is empty, the program control is passed directly to the next END IF statement. If the IF block is not empty, the first statement of the IF block is executed. If the value of e is false, control is transferred to the next ELSE IF, ELSE, or END IF statement having the same IF level as the BLOCK IF statement. (An IF BLOCK consists of all the executable statements appearing between the BLOCK IF statement up to, but no t inc 1 ud ing, the nex t ELSE IF, ELSE, 0 r END IF s ta temen t hav ing the same IF level as the BLOCK IF statement) • The fo rm of an ELSE IF sta temen t i s : ELSE IF (e) 'rHEN where e is a logical expression. An ELSE IF block consists of all the executable statements between the ELSE IF statement up to, but no t inc 1 ud ing, the nex t ELSE IF, ELSE, 0 r END IF statement having the same IF level as the ELSE IF statement. The processor executes the ELSE IF statement by first evaluating the expression e. If the value of e is true, and the ELSE IF block is empty, control is transferred directly to the next END IF statement with the same IF level. If the value of e is true, and the ELSE IF block is not empty, the first statement of the ELSE IF block is executed. If the value of e is false, control is transferred to the next ELSE IF, ELSE, or END IF statement having the same IF level as the ELSE IF statement. The form of the ELSE statement is: ELSE The form of the END IF statement is: END IF The END IF statement performs no executable function, but a s a po in t 0 f r e fe r e nc e • 1-9 serves INTRODuc'rION 1.3.2 DO Loop Seman tic 5 'rhe fo rm of a DO sta tem~n t i s : DO s [,1 i = el, e2 [,e31 where s is the statement label of an executable statement; i is the n am e 0 f a n in teg e r, rea 1 , o r d 0 ub 1 e- pr e cis ion v a ria b 1 e (called the DO variable in FORTRAN-77); el, e2, e3 are each an integer, real, or double-precision expression. El is the initial value of the DO variable, e2 is the limiting value of the DO variable, and e3 is the increment value for the DO variable. Two new features of FORTRAN-77 DO loops are: 1. The possibility of zero trip loops (The FORTRAN-66 standard did not specify how many iterations a DO loop had. Mo st processo r s, incl ud ing Dig i tal and IBM, executed loops at least once.) 2. The availability of the loop index after loop exit (previously this was not available). (Sections 11.10 t 11 r 0 ug h 11. 10 • 7) 1.4 INPUT/OUTPUT 1. 4. 1 Fa rm at Ed it De sc r i pta r s item size and format of a data or items. An edit descriptor specifies an editing function to be performed on a data item or items. (Refer to sections 13. 2, 13.5, 13.5.3, 13.5.3.1, 13.5.6, 13.5.9.2.3) A field descriptor describes the The BN edit descriptor causes the processor to ignore all the embedded and trail ing blanks it encounters within a numeric input field. It ha s the fo rm: BN blanks and the Th e e f f e c t i s t ha t 0 f act ua 11 y removing fi eld • A field of all ri'3ht-justifying the remainder of the blanks is treated as zero. The BZ edit descriptor causes the processor to treat all the embedded and trailing blanks it encounters within a numeric input field as zeros. It has the form: BZ 1-10 INTR ODUC TION The SP edit descriptor causes the processor to produce a plus character in any position where this character would otherwise be optional. It has the form: SP 'rhe S8 edit descriptor causes the pro\;essor to suppress a leading plus character from any position where this character would normally be produced as an optional character; it has the opposite effect of the SP field descriptor described below. The SS d esc r i pto r. ha s the fo rm : SS The S edit descriptor reinvokes optional plus characters n umer ic 0 ut put fi eld s. It ha s the fo rm : (+) in S The S descriptor counters the action of either the SP or SS descriptor by restoring to the processor the decision-making ability to produce plus characters on an optional basis. the The T ed it descr iptor spec ifies the position, reI ative r.to start of an external record, of the nex t character to be processed. It has the form: Tn where the term n indicates the position in the external record of the next character to be processed. The val ue of n must be greater than or equal to 1, but not greater than the number of characters allowed in the record. The TL edit descriptor is a relative tabulation tabb ing to the 1 eft. It ha s the fo rm : specifier for TLn The term n specifies that the next character to be transferred from or to a record is the nth character to the left of the current character. The value of n must be greater than or equal to 1. If the value of n is greater than or equal to the current character position, the first character in the record is ~pec i fied • The TR edit descriptor is a relative tabulation tabb ing to the r ig ht • It ha s the fo rm : TRn 1-11 specifier for IN'rRODUC'rION 'fhe term n indicates that the next character to be transferred from or to a record is the nth character to the right of the current character. The value of n must be greater than or equal to 1. The I field descriptor specifies decimal integer values. the fo rrn : It has Iw [ • en] The corresponding I/O list element must be of integer data type. On input, the I field descriptor specifies that w characters are to be read from an external file, interpreted as a decimal integer val ue, and assigned to the correspond ing I/O 1 ist element. On output, the I field descriptor specifies that the value of the correspondin'j I/O list element is to be transferred as a decimal value, right-justified, to an external field w characters long. If m is present, the external field consists of at least m di'gits; if necessary, zeros are added on the left to bring the total digits to ffi. If the value exceeds the field width, the en t ire fie 1 dis f i 11 ed wi t has t e r i s ks • 1ft h e val ue 0 f the 1 i s t element is negative, the field will have a minus sign as its leftmost, nonblank chatacter, provided the term w is large enough. Plus signs are optionally suppressed (at the discretion of the processor) unless SP is specified. rfh e G fie 1 d d esc r i pt 0 r s pe c i fie s rea lor d 0 ub 1 e pr e c 1 s 1 0 n val ue s , combin ing Eor F-type formats accord ing to the si ze 0 f the number being output. It has the form: Gw.d [Ee] The correspond ing I/O 1 ist el emen t must be 0 f real or double-precision data type, or it must be either the real or the imag inary part 0 f a complex data type. On input, the G field descr iptor does not differ from the or D de sc r i pto r s . F, E, On output, the G field descr iptor spec ifies that the val ue 0 f the corresponding I/O list element is to be transferred as a real or double-precision value in either exponential or fixed-point form depending on its magnitude, rounded to d decimal positions, and right-justified, to an external field w characters long. 1.4. 2 Ex pressions on OUtput Li sts An input/output list specifies the entities whose values transferred by a data transfer input/output statement. 1-12 -------------~ ~-~~-- -- - - - - - - - - ---- - - - - - - - - - - - - - - - - --- -~---- are An INTRODUCTION input/output 1 ist is a simple 1 ist, an impl ied-DO 1 ist, or two input/output lists separated by a comma. A simple input/output 1 ist i tern is one 0 f the following. 1. A variable 2. 3. 4• An array A character substr ing An e 1 em en t 0 fan a r ray In addition, in the full language, a simple output list may be an expression, with the exception of a character expression containing a dummy argument with a length attr ibute specified with an asterisk. (Sections 12.8.2, 12.8.2.1, 12.8.2.2, 12.8.2.3) Note that a constant, an expression involving operators or function references, or an expression enclosed in parentheses may appear as an output list item but not as an input list item. An implied-DO list is of the form: (dlist, i = el, e2 [,e3]) where i, el, e2, and e3 are as specified for the DO statement and dl ist is an input/output 1 ist. 1.4.3 Internal Files Internal files provide a means of transferring and converting data from internal storage to internal storage. An internal file is a character variable, character array element, character array, or character substring. Reading and writing records is accomplished by sequential access formatted input/output statements. 1.4.4 Unit Specifier and Identifier Th e fo rm 0 f the un i t s pe c i fie r is: [UNIT=] u vlhere u is an external unit identifier or an internal unit identifier. An external unit identifier is an integer expression with a zero or positive value or is an asterisk, identifying a particular processor-determined external unit that is preconnected for formatted sequential access. (Section 12.3.3) 1-13 INTRODUCTION 1.4.5 Format Specifier and Identifier Th e fo rm 0 f a fo rm at s pe c i fie r is: [FMT=] f where f is a statement label of a FORMAT statement, an integer variable that has been ASSIGNED the statement label of a FORMAT statement, a character array name, any character expression other than one involving concatenation of an operand whose length was specified by an asterisk and that is not the symbolic name of a constant, or an asterisk specifying list-directed formatting. If FMT= is omitted, the format spec ifier must be the second item in the control information list and the first item shall be the unit specifier without UNIT=. (Section 12.4) 1.5 ASSUMED SIZE ARRAY DECIARATORS In an array declarator for a dummy array, the upper bound of the last dimension may be spec ified by an * (Sections 5.1.2, 5.1.2.2, 5.5) The form of an array declarator is: a (d [,d] ••• ) where a is the symbol ic name 0 f the array and d decl arator • A dummy array declarator is an array array name is a dummy arg ument. declarator is a in dimension which the 1.6 USE OF A FORMAT STATEMENT IABEL IN AN ASSIGN STATEMENT 'rhe form of a statement label assignment statement is: ASSIGN s TO i where s is a statement label of an executable statement or FORMAT statement and i is an integer variable name. (Sections 10.3, 12.4) An integer variable assigned a statement number may be used only as a statement identifier in an assigned Go'ro statement or as a format identifier in an input/output statement. 1.7 INTRINSIC AND EXTERNAL STATEMENTS The INTRINSIC statement is used to identify a symbolic name as representing an intrinsic function. (Refer to sections 8.7 and 1-14 I N'rR ODUC TION 8.8.) I t perm its the name to be used as an ac tual arg wnen t. form of the INTRINSIC statement is: The INTRINSIC fun[ ,fun] ••• where fun is the symbolic name of example: an intrinsic function. For IN'rR INS IC SIN CALL AIDS(A,B,C,SIN) The form of the ExrrERNAL statement is: EXTERNAL proc[,proc] ••• where proc is the symbol ic name 0 f an ex ternal proced ure, a dummy procedure name, or a block data program unit. The ExrrERNAL statement is used to identify a symbol ic name as an external procedure or dummy procedure, and to perm it suc h a name to be used as an ac tual arg umen t. representin'~ 1.8 SAVE STATEMENT A SAVE statement is used to retain the definition of a variable, an array, or a named common block after the execution of a RETURN or END statement. (Refer to Section 8.9.) The form of a SAVE statement is: SA VE [a, [ ,a] ••• ] where each a is a named common block name preceded by a slash, a variable name, or an array name. and followed 1.9 NULL ARGUMENT LISTS FOR FUNCTIONS The form: fun () may be used to reference a function with a (Section 15.2.1) null argument list. Statement functions with null argument lists may be declared. A null, parenthesized argument list appears in the declaration. (Section 15.4.1) 1-15 I NTRODUC TION The form of a statement function statement is: f un ([ d , [ ,d • • • ]) = e where fun is the symbol ic name 0 f the statement function, d is a statement function dummy argument, and e is an expression. Parentheses may optionally be used for null argument 1 ists' in FUNCTION statements. 1.10 CONSTANT EXPRESSIONS Constant expressions (not just constants) may be used in array declarators, PARAME'rER statements, and impl ied DO-lists in DATA statements. (Sections 6.1.3, 6.1.3.1, 6.2.3, 6.4.4, 6.7, 5.1.1.1, 8.6, 9.3) 1-16 CHAPTER 2 TOPS-10/20 FORTRAN 2.1 INTRODUCTION The FORTRAN language as implemented on the TOPS-IO and TOPS-20 operating systems is compatible with and encompasses the standard described in American National Standard FORTRAN, X3.9-1978 at the subset level. TOPS-IO/20 FOR"'rRAN--alSOsupportsmostOfeatures from the FORTRAN-77 full language standard. FORTRAN provides many extensions and additions to the FORTRAN-77 standard that greatly enhance the usefulness of FORTRAN and increase its compatibility with FORrrRAN languages implemented by other computer manufacturers. The TOPS-IO/20 FORTR?\N Language Manual (AA-N383A-TK) reflects the software as of Version-7ofthe FORTRAN-IO/20 object time system (FORO'rS), and Version 7 of the FORTRAN-I 0/20 debugging program (FORDDT). This manual describes the FOR'rRAN language as implemented for the TOPS-IO operating system (FORTRAN-IO)' and the TOPS-20 operating system (FORTRAN-20) and notes any differences. It supersedes AA-J127A-TK. 2.2 MAJOR FEATURES OF VERSION 7 THAT WERE NOT IN VERSION 6 2.2.1 Features Supported for Character Data Version 7 supports character data as specified by the full language FORTRAN-77 standard. Supported features include character assignments, character relationals, substrings, concatenation, and char ac ter func tions and arg umen ts, incl ud ing functions and dummy arguments of length * Character data is supported in DATA, COMMON, and EQUIVALENCE statements; and in formatted, binary, and image mode I/O. 2.2.1.1 Character Assignment Statements - Character constants may be assigned to noncharacter variables. The standard restricts the assignment of character constants to character variables. Version 7 extends the standard to support assignment statements in which there is overlap between the left- and right-hand sides. The results of such an assignment will be as if the expression on the right-hand side were assigned to a temporary and then the value of the temporary were assigned to the left-hand side. 2-1 TOPS-IO/20 FORTRAN 2.2.1.2 Character Expressions - Version 7 extends the standard to allow concatenation of formal parameters that are length * 2.2.1.3 Character Variables and Constants in DATA Statements For compatibility with previous versions, Version 7 supports the use of character constants to initialize noncharacter variables. 2.2.1.4 Character Variables, Array Elements, Arrays, and Substrings in Input Lists - In addition to the A edit descriptor for input/output I ist items of type character, Version 7 supports the G edit descriptor. The G edit descriptor functions as the A edit desc:riptor for list items of type character. R edit descriptors are not supported for character data. 2.2.1.5 Dummy and Actual Arguments of Type Character - Version 7 extends the standard to provide support of character constants as ac tual arg uments correspond ing to dummy arg uments tha t a r e integer, real, double-precision, complex, or logical, as well as character. This feature does not work when the name of the fun c t ion call ed i s i t s elf a d umm y a r g um en t • I fan act ua I a r 9 urn en t i s 0 f type c ha r a c te rand i s not a con s tan t , the corresponding dummy must be of type character. If a dummy argument is of type character, the corresponding actual must be of type character. Actual arguments may be longer than correspond ing dummy arguments. Length * may be used for character dummy arguments. 2.2.1.6 EQUIVALENCE Statements - It is illegal to equivalence a numeric variable to a character variable. Equivalencing a numeric variable to an unaligned character variable is fatal; equivalencing a numeric variable to a word-aligned character variable is nonfatal. 2.2.1.7 Character Variables and Arrays in COMMON Blocks - When a character variable or character array is in a COMMON block, all the entities in that COMMON block must be of type character. If both character and numer ic data are spec ified in the same COMMON block, a nonfatal warning message is issued • Variables other than character var iables beg in on word boundar ies; thus a C01~MON block containing both character and numeric data would contain unused character positions. 2.2.1.8 Name1ists - Version 7 supports input, but not in namelist output. 2-2 -------.-.-- -- --~-------------.--.---~------ substrings in namelist TOPS-lO/20 FORTRAN Version 7 does not support global optimization of programs that contain character data. If the /OP'rIMIZE switch is specified for suc h a prog ram, the warn ing d iag no st ic : Global optimization not yet supported with character data - 10FT ignored is issued. 2.2.2 IF THEN ELSE Statements Version 7 supports the block statements. IF, ELSE IF, ELSE, and END IF 2. 2. 3 Ex pressions on Output Li sts variable name, an array element name, a character substr ing name, an array name, or any other expression. FORTRAN-20 extends the standard to support output list expressions that include concatenation of operands of length asterisk. An output list item can be a 2.2.4 Intrinsic and Generic runction. at the rORTRAN-77 rull Language Level Version 7 supports all intrinsic and generic functions described in section 15.10 of the FORTRAN-77 standard. The following intrinsic functions are new in Version 7. 1. DINT - Truncation for double-precision 2. ANINrr, DNINT - Nearest whole number 3. NINT, 4. DDIM - positive difference for double-prec ision 5. DPROD - Double-precision product of real arguments 6. ICHAR, CHAR, LEN, INDEX, LGE, LGT, LLE, LLT functions as described in the introduction IDNINT - Nearest integer Character The following generic function names have been added: ACOS, AINT, ANINT, ASIN, COSH, CMPLX, DBLE, DIM, LOG, LOGI0, MAX, MIN, NINT, REAL, SINH, TAN, and TANH. The second arg umen t to CMPLX is now optional. The generic function name INT has been extended to support arguments that are COMPLEX and IN'rEGER (as well as REAL and DOUBLE-PRECISION). 2.2.5 Internal Files (Single-Record and Multirecord) Version 7 conforms to the F.ORTRAN-77 standard. 2-3 TOPS-lO/20 FORTRAN 2.2.6 FORTRAN-77 DO Loop Seman tic s As an extension to the standard, Version 7 supports "ex tend ed range DO loops" (transfer into the range of a DO-loop is permitted if a previous transfer out has occurred.) 2.2.7 Assumed-Size Array Dec1arators Version 7 conforms to the FORTRAN-77 standard. 2.2.8 Use of FORMAT Statement Numbers in ASSIGN Statements Version 7 conforms to the FORTRAN-77 standard. 2.2.9 INTRINSIC Statement; EXTERNAL Statement In Version 7, if the name 0 f an intr insic function appears in an EXTERNAL statement, that name is subsequently treated as the name of a user-defined function. (This is in accordance with the FORTRAN-77 standard, but incompatible with previous versions of FORTRAN 20. In Version 6, an asterisk appearing in front of an intrinsic name in an EXTERNAL statement is required to force that name to become the name of some external procedure.) 2.2.10 SAVE Statement In Version 7, if a FORTRAN overlay contains any local variables that are SAVEd, all writable storage in that overlay is preserved. If a named COI'1MON block is SAVEd, that common block is preserved. Blank COMMON is always preserved. 2.2.11 Null Argument Lists for Functions Version 7 conforms to the FORTRAN-77 standard. FORTRAN-77 2.2.12 Minor syntax Extensions Required by the Standard The comma is optional in the following: DATA statements, COMMON statements, assigned GOTO, and after the statement number in DO sta tements. Parentheses may optionally be used for SUBROUTINE and CALL statements. null argument I ists in Statement numbers are legal on nonexecutable statements. Exponentiation to an integer power is allowed expressions in DATA statements. 2-4 in the subscript TOPS-IO/20 FORTRAN 2.2.13 Compile Time Constant Expressions in Array Bounds, and String Bounds Version 7 conforms to the FORTRAN-77 standard. Declarations, 2.2.14 FORTRAN-77 PARAMETER Statements Version 7 supports PARAIV1ETER statements in accordance FORTRAN-77 stand ard • Compi I e time ex pressions mul ti pI ication, d iv ision, or ex ponentiation 0 f COMPLEX not supported. as with the involv ing data are In Version 6 the data type of a PARA.METER was determined by the type of the constant; in Version 7 the data type is determined by its symbolic name. In Version 6 the list of parameters is never enclosed in parentheses; in Version 7 the list of parameters must be enclosed in parentheses. If the I ist of parameters is not enclosed in parentheses, the compiler assumes that it is not a FORTRAN-77 PARAMETER statement and a warning message is issued. (This warning message can be suppressed by compiling with the /NOF77 (/F66) switch.) In Version 7 (as in FORTRAN-77), PARAMETER statements may precede type declaration statements except for those statements that specify the type of parameter. In Version 6 the parameter may only be set to simple constants; in Version 7 the parameter may be set to a constant expression. 2.2.15 DO WHILE and END DO Statements The DO WHILE/ END DO support involves the following to the FORTRAN-77 standard. 2.2.15.1 Optional Statement Label in the Indexed enhancements (Standard) Statement - The syntax of the indexed DO statement is: DO DO [ s [ ,]] v= e I , e 2 [ ,e 3 ] where s is the label of the statement that terminates the I00p. If s is omitted, the loop must be terminated by an END DO statement as discussed below. 2-5 TOPS-IO/20 FORTRAN 2.2.15.2 DO WHILE Statement - The following syntax: DO [s [ ,]] WHI LE DO WHILE statement has the (e) where s is the label of the statement that terminates the loop. If s is omitted, the loop must be terminated by an END DO statement. E is a log ical expression that is tested at the beg inning of each execution of the loop, including the first. If the value of the expression is true, the statements in the body 0 f the loop are executed; if the value of the expression is false, control transfers to the statement following the loop. 2.2.15.3 END DO Statement - The END DO statement has the syntax: END DO An END DO statement terminates the range of a DO or DO WHILE statement. The END DO statement must be used to terminate a DO block if the DO or DO WHILE statement does not contain a statement label. It may also be used as a labeled terminal statement if the DO or DO WHILE statement does contain a terminal sta temen t I abel. 2.2.16 LINKtime Type-Checking of Subprogram Arguments FOR'rRAN Version 7 and LINK Version 5.1 provide limited type-checking for character constants that are passed as actual arguments that correspond to numer ic dummy arg uments. V'8rsion 7 has modified the argument passing mechanism; the argument passing mechanism for quoted strings now involves passing the address of a descriptor for the string rather than the word address of the string (as is done in Version 6). These two methods of passing arguments may b~ referred to as "passing by descriptor" and "passing by address." If an actual argument is passed by descriptor and the corresponding formal is passed by address, LINK will transform the actual argument into a passed-by-address argument if the following conditions are sa tisfied : 1. rrhe arg umen t i s a constant. 2. The str ing is in the same section as the argument block. 3. The byte po inter word in the descr iptor in the user's image is word-aligned. (The object code generated by FORTRAN Version 7 now includes descriptors for character variables, primaries, and subprogram arguments) • 2-6 TOPS-IO/20 FORTRAN No type-checking will be performed on calls involving old REL files since either the caller or the callee or both will not have LINK argument descriptor blocks. Version 7 also supports a new option to the DEBUG switch of the form /DEBUG:PARAMETERS. With this option specified, FORTRAN will generate REL file blocks that specify that illegal argument type mismatches should result in nonfatal error messages at load time. 2.2.17 G-Floating Double-Precision Numbers FORTRAN-20 Version 7 provides support for the G-floating double-precision number format. The exponent range for this number format is 2.8D-309 to 8.9D+307. G-floating is an alternative internal format for double-precision, supported only on KL model B processors. The user specifies G-floating format by specifying the /GFLOATING command line switch to the FORTRAN compiler. /NOGFLOATING (the defaul t) spec ifies the old double-prec ision format. REL files that use the two different double-prec ision formats ?re not compatible. If a user attempts to LINK together programs compiled with different values of the /GFLOATING switch, a warning will be issued at LINK time. 2.2.18 Native TOPS-20 Command Inter face for the Compiler The FORTRAN-20 Version 7 compiler's command line interface now provides support of long file names, .,?", and command recognition. COMPILE now works for any legal TOPS-20 file name. However, a user cannot do an EXECUTE or DEBUG of a long file name. (LINK does not yet support long REL file names). The syntax for the EXEC commands, EXECUTE, DEBUG, and COMPILE, is not affected by the new command scanner. 2.2.19 New Functionality in the ERRSET Subroutine Version 7 provides ERRSET trapping for additional classes of errors. Also, the user can now write his own fix-up routines for ~rithmetic exceptions. The calling sequence for ERRSET is: CALL ERRSET (N) CALL ERRSET (N,I) or CALL ERRSET (N, I, SUBR) where N equals the maximum number of error messages to type and I equals the error to which this call applies. If I equals -1 it 2-7 TOPS-10/20 FORTRAN will trap to any of the following errors. -1 is assumed. o 1 4 5 6 8 9 10 11 12 21 22 If I is not specified, Integer overflow Integer divide check Floating overflow Floating divide check Fl oa ting und er flow Library routine error Output field wid th too small Input floating over flow Input floating underflow Input integer overflow FORLIS warning s Nonstandard usag e warn ing s SUBR is the subroutine to calIon the trap. If SUBR is not specified, no routine is called on the arithmetic exception. If SUB R i s s pe c i fie d th e e f f e c t i s a s if: CALL SUBR (I, IPC, N2, ITYPE, UNFIXED, FIXED) were placed in the program just after the instruction causing the trap. I is the error number of the trap. IPC is the program counter of the trap instruction, or if the error number equals 9, IPC equals the prog ram co un ter 0 f the FOROTS call. N2 equal s the second error number (reserved for Digital). ITYPE is the data type of value. UNFIXED is the val ue returned by the processor, and FIXED is the value after the fix-up (can be changed by SUBR). 2.2.20 Utility Subroutine to Get a Free Unit Number Version 7 provides an additional FORTRAN-supplied subroutine that can be used to get an unused unit number. The routine FFUNIT (first free unit) is called by: CALL FFUNIT(IUNIT) where IUNIT is an integer variable available unit number by FFUNrr. that is set to the first 2.3 rORTRAN-77 FEATURES THAT ARE NOT SUPPORTED 1. The INQUIRE statement (used to status of a file attribute) • 2. Comment lines and blank lines may not appear between an initial line and its first continuation line, nor may the y a ppe arb e t we en two con tin ua t ion 1 in e s • 2-8 determine the current TOPS-IO/20 FORTRAN 3. The compile time expression in a PARAMETER statement cannot contain mul ti pI ication, d iv ision, or exponentiation of COMPLEX data. 2.4 SUMMARY OF EXTENSIONS TO THE FORTRAN-77 STANDARD I. II. III. Programmer convenience FOR TRAN-I i ke A. FORDD'r: command s B. Optional c hec king C. LINKtime c hec king for subprog ram arguments D. Sel ec tive suppression warning s of compil e time and run time E. User sel ec tion of d efa ul t SWITCH. INI swi tch val ues by means of F• Run tim e t r ac e b ac k 0 n PAUSE tr ac ebac k on G. INC LUDE s ta tt'~m en ts H. On TOPS-20: DIALOG mode Interactive array ? debugger c hac king bound s err 0 r s ; with and opt ional bounds string and recognition in compiler commands and Structured programming A. DO WHILE statement B. END DO statement Syntax A. End-of-l ine commen ts B. Multiple statements per line 2-9 TOPS-IO/20 FORTRAN IV. V. Very accurate single- and double-precision arithmetic A. 36-bit integer (10.5 decimal digits) B. 36-bit floating-point (8 decimal digits) C. 72-bit floating-point (18 decimal digits) D. 8-bit floating-point exponent: E. On 2060 systems, /GFL switch also provides for an II-bit e x po n en t ; 1 0 * * ( - 3 0 8 ) to 1 0 * * ( + 3 0 8 ) 10**(-38) to 10**(+38) I/O A. NAMELIST I/O B. Logical device names provide run time device assignments C. DIALOG mode spec i fier s D. IMAGE mode fil es E. APPEND access to sequential files F. DELETE, EXPUNGE, CLOSE G. Additional I/O statements provides run SAVE, time PRINT, selection PUNCH dispositions 1. REREAD read s prev io us record 2. TYPE outputs to the user's terminal 3. ACCEPT inputs from the user's terminal 4. ENCODE/DECODE formatted rather than a file reading/writing to an 2-10 -------------------------------- OPEN of in array TOPS-IO/20 FORTRAN H. DBMS-IO/20 support I. SORT-IO/20 support J. DIL-IO/20/VAX support DI L ( data in te r c ha ng e l i bra r y) is a se t 0 f call ab I e sub r 0 uti n e s that enables a COBOL or FORTRAN prog rammer to access and use data that resides on another computer system. The DIL allows you to pass data between programs on different systems or directly ,access records in files on other systems. You can use the DIL to access a single record within a file and avoid having to transfer the entire file to your system. If the accessed data is of the wrong format or data type, OIL prov ides the necessary data conversion facilities. To use the OIL in a multiple computer environment, the must be interconnected by OECnet to form a network. Refer to the Data (AA-M58IA-'rK)-.- Interch~~ge Library 2-11 User IS computers Ver sion I CHAPTER 3 VAX-II FORTRAN 3.1 INTRODUCTION VAX-II FOR'rRAN is an implementation of the full language ANSI It is a compatible superset of PDP-II FORTRAN-77 standard. FOR rrRAN-77. (You can compile ex isting PDP-II FORTRAN-77 source programs, as well as new programs that incorporate features available in VAX-II FORTRAN.) VAX-11 FORTRAN Version 3 is also upwardly compatible from the previous versions of VAX-II FORTRAN and VAX/VMS systems. This means that object files produced by VAX-II FORTRAN Version 2 can be correctly 1 inked and run on VAX/VMS Version 3. Executable images linked on previous versions of VAX/VMS systems can be run without reI inking on VAX/VMS Version 3 systems. It is al so po ssible to freel y mix obj ec t files from prev io us ver sions 0 f VAX-II FORTRAN wi th Ver sion 3 obj ect files on Version 3 VAX/VMS systems. However, there is no backward compatibility; that is, it is not possible to link or execute files from VAX-II FORTRAN Version 3 on previous versions of VAX/VMS systems. This chapter descr ibes the new features supported in Version 3 and also outlines the major features that are extensions to the standard. This information, as well as more detailed information, is fo und in the following documents. Lang_~~g e 1. VAX-II FORTRAN AA-D034C-TE 2. VAX-II FORTRAN User's Guide, (April 1982), AA-D035C-TE 3. VAX-II FORTRAN Installation Guide/Release 1982) AA-H953B-n-·---··_- ----.-----.-- The following prog rammer s. documents are Re fe renc e Manual, (Apr il of interest to 1982), (Apr il Notes VAX-II FORTRAN 1. VAX/VMS primer, AA-D030C-TE 2. VAX/VI'1S Command Language USer's Guide, AA-D023C-TE 3. VAX-II ----- Symb~ic Deb ugg er Re fe renc e Man ual, AA-D 02 6D-TE 'rhe VAX-II FORTRAN Lang uage Re ~e~~nc~ Manua!. descr ibes the FORTRAN language elements supported by VAX-II FORTRAN. It is 3-1 VAX-II FORTRAN intended to be used as a reference manual sour c e pr og ram s • in preparing FORTRAN The VAX-II FORTRAN User's Guide describes how to compile, link, debug, and--eX"ecute programs wr itten in the VAX-II FORTRAN language, using the facilities of the VAX/VMS operating system. It contains other information of interest to FORTRAN programmers, such as FORTRAN input/output, error processing, programming efficiency, compatibility between VAX-II FORTRAN and VAX-II FORTRAN 66, and compatibil ity between VAX-II FORTRAN and PDP-II FORTRAN. The VAX-II FORTRAN Installation Guide/Release Notes contains detailed instructions for installing the"VAX"=-fl FORTRAN compiler on the VAX/VMS operating system. It also contains information about the differences between VAX-II FORTRAN Version 3 and previous versions of VAX-II FORTRAN, including a short description of new features and a complete description of the /SHOW qual ifier. 3.2 NEW FEATURES SUPPORTED BY VERSION 3 3.2.1 Bit Functions The following additional have been added. 1. 2. 3• 4. 5• 6• bit-manipulation intrinsic functions IBSET sets a bit. BTEST tests a bit. IB C LR c I ear s a bit. IB IT Sex tr ac ts a bit fie I d • IS HF TC pe r fo r ms a c i r c ul a r sh i ft. MVB I'r S mov e s a bit fie 1 d • IBSET, BTEST, IBCLR, IBITS, and the subroutine MVBI'rS operate on bit fields. A bit field is a contiguous group of bits within a binary pattern, specified by a starting bit position and a length. IBSET, IBCLR, and BTEST operate on I-bit fields and do not require a length argument. IBITS and MVBI'rS operate on general bit fields. Both the starting position of a bit field and its length are arguments to these intrinsics. The MVBITS subroutine transfers a bit field from one storage location (source) to a field in a second storage location (destination). The call to MVBITS has the form: CALL MVB I'rS (m ,i ,1 en,n ,j) where m is an integer variable or array element that represents the source location (that is, the location from which a bit field is transferred); i is an integer expression that identifies the first bit position in the field transferred from m; len is an 3-2 VAX-II FORTRAN integer expression that identifies the length of the field transferred from m; n is an integer variable or array element that represents the destination location (that is, the location to which a bit field is transferred); and j is an integer expression that identifies the bit in which the transferr~d bit fie 1 d beg ins. The MVBITS subroutine transfers len bits from positions i through i + len - I of the source location (m) to positions j through j + 1 en - 1 0 f the des tin at ion 1 0 cat ion ( n) • at her bit s 0 f the destination location and all the bits of the source location remain unchanged. The val ues 0 f i + len and j + len must be less t han 3 2 • IS HF TC s h i f t s a bin a r y pat t ern; a po sit i v e sh i ftc 0 un t indicates a left circular shift, while a negative shift count indicates a right circular shift. 3. 2. 2 Debugg er Command s for So urce Cod e Debugg ing A new interface allowing FORTRAN users to access source code display fac il ity has been prov ided. debugger commands can now be used: 1. 2. 3• 4. 5. the debugger The following SET STEP SOURCE TYPE rang e EXAM INE/ SEARC H SEARC H [rang e] II str ing" SET SOURC E Refer to the VAX-II Symbolic Debugge£ Refe~~nce Manual. 3.2.3 DEFAULTFILE Keyword in the OPEN Statement The DEFAULTFILE keyword has been added to the OPEN statement. DEFAULTFILE allows you to specify a default file name that overrides the general FORTRAN defaults. 3.2.4 IMPLICIT NONE Statement The I1VIPLICIT statement now has a second format. IMPLIC IT NONE The IMPLICIT NONE statement inval idates all impl ic it defaul ts and causes error messages to be generated for names that are not explicitly typed in a type declaration statement. You must then explicitly declare the data types of all symbolic names in the program unit. If you specify IMPLIcrr NONE, no other IMPLICIT statement can be included in the program unit. 3-3 VAX-II FORTRAN 3.2.5 FORTRAN Data Manipulation Language Preprocessor An interface to an integrated FOR'rRAN data manipulation language preprocessor has been provided under Version 3. The FORTRAN qualifier /DML controls the use of the interface. The preprocessor produces an intermediate file of FORTRAN 'source code. with FORTRAN DML commands expanded into FORTRAN statements. The compiler then compiles the intermed iate files and produces an optional object and listing file. The listing file includes the DML statements and, optionally, their expansions into FORTRAN source. DML error messages appear in the correct place in the listing. The preprocessing and compilation are controlled by a single qual ifier on the FORTRAN command so that the user does not need to know that a preprocessor is present. 3.2.6 Faster I/O Interface A faster I/O interface is now provided by the following changes. 1. 1m pI ied DO loops in I/O I ists have been optimized. 2. Sinqle-element, unformatted I/O lists now use a in te r fac e. 3. A larger default record size is allowed for I/O transfers. special unformatted 3.2.7 Zero-Extending Intrinsic Functions The two new in tr insic func tions IZ EXT and JZ EXT allow fo r zero-extending arguments. FORTRAN normally converts a smaller fixed-point data type to a larger fixed-point data type by sign-extending the smaller value. This means that the high-order bits of the larger data type are set to the same value as the sign bit of the smaller data type. The functions IZEXT and JZEXT zero-extend a value to either INTEGER*2 or INTEGER*4 respectively. This means that the high-order bits of the larger data type are set to zero rather than to the sign bit of the smaller data type. The generic function ZEx'r selects IZEXT or JZEXT according to the setting of the /14 command qualifier. 3.2.8 Library-Based INCLUDE Statement The INC LUDE sta tement ha s a second format. The new format allows you to include modules from VAX/VMS text libraries. INCLUDE 'file-specification (module-name) [/(NO]LIST]' The INCLUDE statement specifies that the contents of a designated file are to be incorporated into a compilation directly following the sta tern en t • 3-4 - - - - - - ------------------ --------~------------------ VAX-Ii FORTRAN 3. 2.9 Improved Ma th Ro ut ine s The accuracy of the following math significantly. 1. 2. routines has been improved SIN COS 3. LOG 4. 5. 6. ATAN ASIN ACOS 3.2.10 Name1ist-Directed I/O Statements The following statements provide namelist-directed I/O. 1. 'rhe NAM E;LIS T s ta tem en t 2. The READ, WRI'rE, ACCEPT, TYPE, and PRINT statements, with a namelist specifier in place of format and I/O lists 3.2.11 Opt.imization of Generated Code The following improvements in compiler im pI emen ted. optimization have been 1. In-line expansion of statement functions 2• El im ina t ion 0 fred un dan t s tor e 3. El imination of redundant argument (eduction for calls to SIN and COS wi th the same arg umen ts 3.2.12 Optimization of I/O Routines The speed of the following run-time routines has been improved. 1. 2. 0 pe rat ion s library I/O processing Floating input conver sian Fo rm at in te r pr e ta t ion 3.2.13 Checking for Extensions to the FORTRAN-77 Standard The new FORTRAN qualifier /STANDARD provides optional checking for source code that does not conform to the FORTRAN-77 standard. 3.2.14 A Cross-Reference Listing The new FORTRAN qualifier /CROSS-REFERENCE provides cross-reference as part of the listing file. 3-5 an optional VAX-II FORTRAN 3.2.15 Floating-Underflow Checking The FORTRAN qualifier /CHECK=UNDERFLOW floating-under flow chec king at r un time. 3.2.16 Substring-Bounds Checking Th~ FORTRAN qualifier /CHECK=BOUNDS substring-bounds checking at run time. provides optional provides opt ional 3.2.17 OPTIONS Statement The OPTIONS statement overrides or confirms the qua I i fie r sin a pr og r am un it. FORTRAN 3.2.18 FORTRAN Definitions for System Symbols A text library FORSYSDEF.TLB containing the FORTRAN fa r system symbol s i s now prov id ed • command definitions 3.2.19 Trigonometric Functions in Degrees The trigonometric functions in Table degrees or produce results in degrees. Table 3-1 3-1 take arguments in Tr igonometr ic Func tions Func tion Desc r iption SIND, DSIND, QSIND Sine functions \vith degree arg uments COSD, DCOSD, QCOSD Cosine functions with degree arg uments TAND, DTAND, QTAND Tangent functions with degree arg uments ASIND, DASIND, QASIND Ar'c sine wi th deg ree resu1 t ACOSD, DACOSD, QACOSD Arc co sine wi th d eg ree resul t ATAND, DATAND, QATAND Arc tang en t wi th d eg ree re suI t ATAN2D, DATAN2D, QATAN2D Two-argument arc tangent with d eg r e ere s ul t 3.2.20 Run-Time I/O Error Messages Additional diagnostic information is now provided with I/O error messages. 3-6 run time VAX-II FORTRAN 3.2.21 /SHOW Qualifier The /SHOW qualifier controls listing options for INCLUDE preprocessor-generated output, and the symbol table map. files, 3.3 EXTENSIONS TO THE ANSI STANDARD The following are some of the VAX-II FORTRAN-77 extensions to the ANS I stand ard • 1. Language elements for kayed and VAX-II RMS mul tikey ISAM fil es. 2. A set of data types language FORTRAN-77 beyond those sequential specified access to for full units for LOGICAL*I, BYTE (synonymous) LOGICAL*2 IN'rEGER*2 COMPLE X*16, DOUBLE COMPLEX REAL*16 3. Explicit specification of storage allocation data types (e.g., REAL*8, INTEGER*4). 4. Data initialization in type declaration statements. 5. IMPLICIT NONE sec tio n) • 6. DO, DO WHILE, END DO statements - As an extension to the standard, VAX-II FORTRAN supports "extended range DO-loops (transfer into the range of a DO-loop is permitted if a previous transfer out has occurred) • statement (described in The DO WHILE/ END DO support involves enhancements to the FORTRAN-77 standard. A. new the features following ( stand ard) Optional statement label in the indexed DO statement. The syntax of the indexed DO statement is: DO [ s , ( ,]] v= e 1 , e 2, ( e 3 ] where s is the label. of the statement that terminates the loop. If s is omitted, the loop must be terminated by an END DO statement. 3-7 VAX-II FORTRAN B. The DO WHILE statement has the syntax: DO [s[,1] WHILE (e) where s is the label of the statement that terminates the loop. If s is omitted, the loop must be terminated by an END DO statement as discussed below. The (e) is a logical expression that is tested at the beginning of each execution of the 1 00 p, inc 1 ud ing the fi r st • If the val ue 0 f the expression is true, the statements in the body of the loop are exec uted; if the val ue 0 f the ex pr e s s ion is fa 1 se, con t r 01 tr an sf e r s to th e statement following the loop. C. The END DO statement has the syntax: END DO An END DO statement terminates the range of a DO or DO WHILE statement. The END DO statement must be used to te rm ina te a DO bloc kif the DO 0 r DO WHILE statement does not contain a statement label. It may also be used as a labeled terminal statement if the DO 0 r DO WHILE sta temen t does con ta in a te rm inal sta temen t 1 abel. 7. Bit manipulation functions. 8. Hexadecimal and octal constants and Z and 0 format edit descriptors applicable to all data types - The 0 field descriptor specifies octal integer values; the Z field descriptor specifies hexadecimal (base 16) values. 9. DEFINE FILE, FIND, ENCODE, DECODE, DELETE, REWRITE, and UNLOCK statements - The DEFINE FILE statement describes direct-access sequential files that are associated with a logical unit number. The ENCODE and DECODE statements transfe r d ate between variables or arrays in internal storage and translate that data from internal to character form, or from character to internal form, accord ing to format s pe c i fie r s • The DELETE statement deletes records in relative files and in indexed files. Specifically, it causes a record to be mar ked as del eted; record 5 so mar ked are no t acc essibl e to sub se quen tREAD 0 r REWRITE sta temen ts • 3-8 VAX-II FORTRAN The REWRITE statement transfers output data from internal storage to the current record in an indexed fil e. The UNLOCK statement unlocks records in a relative or indexed file. When a record is locked, it cannot be accessed by any other program or log ical unit. 10. ACCEPT, TYPE input/output statements The ACCEPT statement transfers input data to internal storage from external records accessed under the sequential mode of access. The TYPE statement transfers output data from internal storage to external records accessed under the sequential mode of access. 11. USEROPEN subroutine invocation at file OPEN time USEROPEN parameter has the form: The USEROPEN = P where p is an external function name. The USEROPEN keyword specifies a user-written external function that con tr 01 s the 0 pe n i ng 0 f the f i 1 e • 12. INCLUDE statement (described in new features). 13. NAMELIST - Directed I/O (described in new features) • 14. 31-character identifiers that can ( $) and und e r 1 ine ( ). 15. Comments allowed at the end of each so urce 1 ine. 16 • De b ug 17. Language elements that support the VAX-ll extended range and extended precision floating-point architectural features. include dollar sign s tat em en t sin so ur c e • A. 64- bit G-floating data type with an II-bit exponent and 53-bit mantissa, which provides a range of 0.56*10**-308 to 0.09*10**308 and a precision of 15 dec imal dig its B. l28-bit H-floating data type with a 15-bit exponent and a 113-bit mantissa, which provides a range of 0.84*10**-4932 to 0.59*10**4932 and a precision of 33 decimal digits (To execute G- and H-floating data type extended range instructions directly on the VAX-ll/780, both the KU780 and the KE780 hardware options must be 3-9 VAX-II FORTRAN present. To execute these instructions directly on the VAX-II/750, the KU750 hardware option must be present. The VAX-Il/730 does not require any additional options for G- and H-floating data type instruction execution.) 18. OIL support - 'rhe OIL (Data Interchange Library) is a set of callable subroutines that enables a COBOL or FORTRAN programmer to access and manipulate data on another VAX or a OECSYSTEM-20. To use the OIL in a multiple computer environment, the computers must be interconnected by OECnet to form a network. 3.4 ADDITIONAL FEATURES 1. Support for calls to VAX/VMS system service procedures 2. Generation of symbol deb ugger 3. Generation 0 f c ro ss- referenc e 1 isting s 4. Generation of shareable code 5. Up to 255 actual arg uments in a CALL statement 6. Up to 250 named COMMON blocks per· subprog ram tables for the VAX-II symbol ic 3.5 VAX-l! FORTRAN COMPILER OPTIMIZATIONS 1. Constant fold ing 2. Optimizations of arithmetic IF, log ical IF -'rHEN-E LSE 3. Common subexpression elimination 4. Removal of invariant expressions from DO loops 5. Allocation of general reg isters across DO loops 6. In line expansion of statement functions IF, and block 3.6 CCMPATIBILITY: VAX-ll FORTRAN AND FORTRAN-66 The VAX-II FORTRAN compiler selects FORTRAN-77 language in te r pr e ta t ion s by d e fa ul t • As are suI t , i t con ta ins c e r ta in 3-10 VAX-II FORTRAN incompatibil ities wi th FOR'l'RAN implementations that are based the previous standard, X3.9-1966. The areas affected are: I• 2. 3. 4. 5. on DO I 00 p min i In um i t era t ion co un t EXTERNAL sta temen t OPEN statement BLANK keyword default OPEN statement STATUS keyword default X format edit descriptor. 3.6.1 DO Loop Minimum Iteration Count DO The IF77 command qualifier controls the interpretation of the loop minimum iteration count. In FOR'I'RAN-77, the body of a DO loop is not executed if the' end condition of the loop is al read y satisfied when the DO statement is executed. In most implementations of FOR'l'RAN-66, the body of a DO loop is al wa ys exec uted at I east once. 3. 6. 2 EXTERNAL Statement The IF77 command qualifier controls the interpretation of the EXTERNAL statement. In FORTRAN-66 the EXTERNAL statement is used to spec i fy tha t a symbol ic name is the name 0 f e i the r a user-defined ex ternal proced ure or a FORTRAN-suppl ied func tion. In FORTRAN-77, the IN'fRINS Ie and EXTERNAL statements are used to accomplish this function. 3.6.3 OPEN Statement Keyword Defaults In FOR'rRAN-77 the OPEN statement BLANK keyword controls the interpretation of blanks in number input fields. The FORTRAN-77 default is BLANK='NULL'; that is, blanks in numeric input fields are ignored. The FOR'I'RAN-66 interpretation of blanks in numer ic input fields is equivalent to BLANK='ZERO'. If a logical unJt is opened without an explicit OPEN statement, VAX-II FORTRAN and FOR'I'RAN-66 both provide a default equivalent to BLANK=' ZERO' • The BLANK ke yword affec ts the treatment 0 f bl anks in n umer ic input fields read with the D, E, F, G, I, 0, and Z field descriptors. If BLANK='NULL' is in effect, embedded and trailing blanks are ignored; the value is converted as if the nonblank characters were right-justified in the field. If BLANK='ZERO' is in effect, embedded and trailing blanks are treated as zeros. 3.6.4 OPEN Statement Status Keyword Defaul t In FOR'rRAN-77, the OPEN statement STATUS keyword specifies ini tial status 0 f the fil e ( 'OLD', 'NEW', 'SCRATCH', or 'UNKNOWN'). Tne FOR'I RAN-77 default is STATUS='UNKNOWN'; that is, an existing file is opened or a new fil~ is created if the 1 3-11 VAX-II F ORrrRAN file does not ex ist. If you use the IF77 command qual ifier and you do not specify STATUS (or TYPE) in an OPEN statement, the compiler issues an informational message to warn you that it is using a default of STATUS='UNKNOWN'. It is advisable to include an explicit STATUS (or TYPE) keyword in every OPEN statement. 3.6.5 X Format Ed it Descr iptor The nX edit descriptor causes transmission of the next character to or from a record to occur at the position n characters to the right of the current position. In a FORTRAN-77 output statement, character positions that are skipped are not modified, and the length of the output record is not affected. However, in many FORTRAN-66 implementations, the X edit descriptor writes blanks and may extend the output record. 3-12 ---_._.._-_ ......_--_. __ ...- . __ ._--------_.- --- CHAPTER 4 PDP-II FORTRAN 4.1 INTRODUCTION PDP-II FORTRAN is an extended implementation of the ANSI subset FORTRAN-77 standard. Version 4 contains all the features 0 f the ANSI FORTRAN-77 subset, many of the full-set language features, and extensions that are not included in the ANSI FORTRAN-77 standard. This chapter describes the new features supported in Version 4 and also outlines the major features that are extensions to the standards. This information, as well as more detailed information, is found in the following documents. 1. PDP-II FORTRAN-77 Lang uage Reference Manual, 1981), AA-19791-TC 2. PDP-II FORTRAN-77 AA-1884D-TC User's 3. PDP-II FORTRAN-77 AA-KS03B-TC------- Install ation The PDP-II FORTRAN-77 Obj ect (AA-1874C- rrC)" isalso of programmers. Guide (September (September 1981) , Guid e/Rel ea se ----------- Time System interest-to Re fe renc e Man ual PDP-flFoRTRAN-77 The PDP-II FORTRAN-77 Language Reference Manual describes the syntax and semanticsOffhe-FORTRAN-77 implementation of PDP-II FORTRAN. It does not, however, present information spec ific to any operating system. The PDP-II FORTRAN-77 User's Guide contains the information ----_.- ------ ---necessary to create, link, and execute PDP-II FORTRAN-77 programs on a PDP-II processor. programming information is provided for the RSX-11M/M-PLUS, IAS, and RSTS/E operating systems. The PDP-II FORTRAN-77 Installation Guide/Release Notes the procedures-fOr install ing--PDP-ll FORTRAN RSX-IlM/M-PLUS, RSTS/E, and IAS operating systems. 4-1 describes on the PDP-II FORTRAN 4. 2 NEW FEA TURES Among the major features defined by the new ANSI subset lnnguage FORTRAN standard and not found in either the previous ANSI standard or previous versions of Dig ital PDP-II FORTRAN are: 1. CHARACTER data type 2. Block IF construct, including IF ••• THEN, ELSE IF, ELSE, and END IF statements, for conditional execution of bloc ks 0 f sta temen ts • 4.2.1 Features Supported for Character Data Version 4 supports character data as specified language FORTRAN-77 standard. by the 4.2.1.1 Character Constants - The length of a character must be in the range 1 through 255. subset constant 4.2.1.2 Substring Reference and Definition - Version 4 supports character substrings as outlined in the full-language subset. (Note that substrings are not included in the subset.) 4.2.1.3 Character Expressions A character operand can be character constant, character variable, character array element, or character substring. A character expression has the form: character operand and can be enclosed in parentheses. Note that the concatenation operator is not included in .the subset (nor in Version 4). 4.2.1.4 Character Variables and Arrays - The length specification in the character type-statement can be an unsigned integer constant or an integer-constant expression enclosed in parentheses. [An asterisk in parentheses (*) is not allowed]. When you specify CHARACTER*len, the length specification must be in the range 1 to 255. 4.2.1.5 Character Relational Expressions - Version 4 conforms to the ANSI-77 full language standard. 4.2.1.6 Character Assigrunent Statements - Version 4 conforms to the ANSI-77 subset language standard. Note that you cannot assign a numeric value to a character variable, array element, or substr ing • 4-2 PD P-ll FOR TR AN 4.2.1.7 Character Variables and Constants in DATA Statements Version 4 (and the ANSI subset language) do not support impl ied DO-lists in DATA statements. Version 4 supports LEN, INDEX, 4.2.1.8 Character Functions No te tha t CHAR is no t suppo r ted. IC HAR, LL'r, LLE, LGT, and LGE. 4.2.2 IF THEN ELSE Statements Version 4 supports the block IF, sta tements. ELSE IF, ELSE, and END IF 4.3 FEATURES OF THE FULL-LANGUAGE FORTRAN AS DEFINED BY THE ANSI STANDARD 4.3.1 Exponentiation Forms (Th i s incl ud es doubl e-prec ision and compl ex fo rms.) Tabl e 4-1 summarizes the allowed combinations of data types of base and exponent, and the data type of the result of exponentiation. The new features are underl ined. Tab1 e 4-1 Allowed Combinations 0 f Types of Base and Exponents Base Exponent Integer In teg er Real !buble Complex In teg er Real - !b uble --- Come~ex Real Real Real Do uble Complex Double Double Double Double No Complex Compl ex Com pI ex No Com pI ex 4.3.2 Format Edit Descriptors ( Th i sin c I ud e s 5, 5 P , 5S , T, T L, TR , Iw. m, and Gw. d Ee .) Ve r s ion 4 conforms to the full FORTRAN-77 standard. 4-3 PDP-II FORTRAN 4.3.3 INTRINSIC and EXTERNAL Statements Normally, the name of an intrinsic function refers to the FORTRAN library function with that name. However, the name can refer to a user-defined function under any of the following conditions: 1. The name is used in a function reference with arguments of a different data type from that normally used. 2. The name appears in an EXTERNAL statement. The EX'rERNAL and INTRINSIC statements enable the programmer to use subprogram names as actual arguments to other subprograms. The semantics of the EXTERNAL statement are different in FORTRAN 77 than in previous versions of PDP-II FORTRAN. In previous versions, the appearance of an intrinsic function name in an EXTERNAL statement caused the processor to treat the name as the name of an intrinsic function. In FOR'rRAN 77, the appearance of an intrinsic function name in an EXTERNAL statement causes the processor to treat the name as the name of an external function. In previous versions, an intrinsic function name had to be preceded by an asterisk to be treated as an external function. The /NOF77 switch allows the programmer to select the previous semantics, rather than FORTRAN-77 semantics. The following shows the equivalent statements. /F77 EXTERNAL ex t EXTERNAL in t INTRINS IC in t /NOF77 EXTERNAL ex t EXTERNAL * in t EXTERNAL in t Except when they are used in an EXTERNAL statement, intrinsic function names are local to the program unit that refers to them. Thus, they can be used for other purposes in other program units. In addition, the data type of an intrinsic function does not change if you use an IMPLICIT statement or an explicit type declaration to change the impl ied data type rules. You cannot have an intrinsic function and a user-defined function wi th the same name in the same prog ram un it. 4.3.4 Generic Function Selection Based on Argument Data Type FORTRAN-Defined Functions for Some intrinsic functions perform the same computation but handle different data types. These functions are references with the same generic name. A generic-function reference refers to the category of the computation to be performed, not to a specific function within the category. The selection of a specific function, that is, the actual computing procedure for a specific data type, is left to the compiler, which chooses a spec ific fLlnc tion wi thin a category on the basi s 0 f the data type 0 f the 4-4 PDP-II FORTRAN relevant actual ar~ument. For example, if D is a double-precision variable, the generic function reference SIN (D) refers to the double-precision sine function. You need not write DS IN (D) • Generic function references are independent from one another. Therefore, you could use both of the function references SIN (X) where X is a real variable, and SIN(D) where D is a double-prec ision var iable, in the same prog ram unit. The intrinsic and generic functions 15.10 of the FORTRAN-77 standard. are described in section 4.3.5 PARAMETER Statements Version 4 prov ides both the FORTRAN-77 and the earl ier form of the PARAMETER statement. The 1 ist in the earl ier form of the PARAMETER statement is not bounded with parentheses, and the form of the constant (rather than typing of the symbolic name) determines the data type of the variable. 4.3.6 General ized DO Loop Parameters Version 4 conforms to the full FORTRAN-77 "extended range DO loops" are supported. , standard. Moreover, 4.3.7 Lower and Upper Bounds Specifi,cation in Array Declarators Version 4 conforms to the full FORTRAN-77 standard. 4.3.8 Optional Syntax for I/O Statements (UNIT= and FMT=) Version 4 conforms to the full FORTRAN-77 standard. 4.4 EXTENSIONS TO THE ANSI STANDARD 1. Language elements for keyed and sequential access to RMS multikey ISAM files. 2. DEFINE FILE, FIND, ENCODE, DECODE, DELETE, REWRITE, and UNLOCK statements - The DEFINE FILE statement describes direct-access sequential files that are associated with a log ical unit number. The OPEN statement, which can also be used to describe direct-access sequential files, is the preferred statement. The FIND statement positions a direct-access file on a specified unit to a particular record. No data transfer ta ke s pl ac e • The ENCODE and DECODE statements transfer data between variables or arrays in internal storage and translate 4-5 PDP-II FORTRAN that data from internal to character form or from character to internal form, according to format specifiers. Similar results can be accomplished using internal files with formatted sequential WRITE and READ sta temen ts • The DELETE statement deletes records in relative files and in indexed files. Specifically, it causes a record to be marked as deleted; records so marked are not accessible to subsequent READ or REWRITE statements. The REWRITE statement repositions a sequential file currently open for sequential or append access to the beg in n i ng 0 f the f i 1 e • The UNLOCK statement unlocks records in a relative or indexed file. When a record is locked, it cannot be accessed by any other program or log ical unit. 3. TYPE and ACCEP'r input/output statements The TYPE statement transfers output data from internal storage to external records accessed under the sequential mode of access. The ACCEPT statement transfers input data to internal storage from external records accessed under the sequential mode of access. 4. Comments permitted at the end of each source 1 ine. 5. INCLUDE statement - The INCLUDE statement specifies that the contents of a designated file are to be incorporated into a compilation directly following the statement. INC LUDE ha s no e ffec t on prog ram ex ec ut io n. 6. BYTE data type - BYTE and LOGICAL*l are synonymous. 7. Explicit specification of storage allocation data type s (e.g., INTEGER*4). 8. Hexadec imal and octal constants. 9. Virtual array support for systems with memory management directives. Virtual arrays are memory-resident and require enough main memory to contain all elements of all arrays. 10. 0 and Z format edit descriptors - The 0 field descriptor specifies octal integer values; the Z field descriptor spec ifies hexadec imal (base 16) val ues. 4-'5 units for - - - - - - - - - - - - - -------------------------- PDP-II FORTRAN 4.5 ADDITIONAL FEATURES The PDP-II FORTRAN-77 compiler produces direct PDP-II machine code optimized for execution-time efficiency on a PDP-II with a floating-point processor. PDP-II FORTRAN-77 compiler o pt i m i za t ion sin c I ud e : 1. Optimizations of arithmetic and logical IF statements 2. Common sUbexpression el imination 3. Removal of invariant expressions from DO loops 4. Allocation of processor constr uc ts and DO loops. registers across block IF 4.6 C<l-tPATIBILITY: PDP-II FORTRAN AND FORTRAN-66 The PDP-II FORTRAN compiler selects FORTRAN-77 language interpretations by defa ul t. As a resul t, it contains certain incompatibilities with FOR'rRAN implementations that are based on the prev io us stand ard, X3. 9-1966. The area s a ffec ted are: 1• 2. 3. 4. 5. 6. DO 1 00 p min im urn i t era t ion co un t EXTERNAL statement OPEN statement BLANK keyword default OPEN statement STATUS keyword default Blank common block PSECT X format ed it descr iptor. 4.6.1 DO Loop Minimum Iteration Count The IF77 command qualifier controls the interpretation of the DO loop mlnlmUffi iteration count. In FORTRAN-77, the body of a DO loop is not executed if the end condition of the loop is al read y satisfied when the DO statement is executed. In most implementations of FORTRAN-66, the body of a DO loop is al wa ys executed at least once. 4.6.2 EXTERNAL Statement The IF77 command qualifier controls the interpretation of the EXTERNAL statement. In FORTRAN-66 the EXTERNAL statement is used to specify that a symbolic name is the name of either a user-defined external procedure or a FORTRAN-suppl ied function. In FORTRAN-77 the INTRINSIC and EXTERNAL statements are used to accomplish this function. 4.6.3 OPEN Statement Keyword Defaul ts In FORTRAN-77 the OPEN statement BI.J\NK keyword controls the interpretation of blanks in the number input fields. The FORTRAN-77 default is BLANK='NULL'i that is, blanks in numeric 4-7 PDP-II FORTRAN input fields are ignored. The FORTRAN-66 interpretation of blanks in numeric input fields is equivalent to BLANK='ZERO'. If a log ic al un it is 0 pened wi tho ut an ex pI ic it OPEN sta temen t, PDP-II FORTRAN and FORTRAN-66 both prov ide a defaul t equivalent to BLANK=' ZERO' • The BLANK keyword affects the treatment of blanks in numeric input fields read with the 0, E, F, G, 1,0, and Z field descriptors. If BLANK='NULL' is in effect, embedded and trailing blanks are ignored; the value is converted as if the nonblank characters were right-justified in the field. If BLANK='ZERO' is in effect, embedded and trail ing blanks are treated as zeros. 4.6.4 OPEN Statement Status Keyword Default In FORTRAN-77, the OPEN statement STATUS keyword spec ifies initial status of the file ('OLD', 'NEW', 'SCRATCH', or 'UNKNOWN'). The FORTRAN-77 default is STATUS='UNKNOWN'; that lS, an ex~isting file is opened or a new file is created if the file does not ex ist. If you use the IF77 command qual ifier and you do not specifiy STATUS (or TYPE) in an OPEN statement, the compiler issues an informational message to warn you that it is using a default of STATUS='UNKNOWN'. It is advisable to include an ex pI ic it STATUS (or TYPE) ke ywo rd in ever y OPEN sta temen t. 4. 6. 5 B1 an k Common Bloc k PS EC T (. $ $ $ $ • ) Under PDP-II FORTRAN-77, the blank common block PSECT (.$$$$.) has the SAV attribute. The SAV attribute on a PSECT has the effect of pulling that PSECT into the root segment of an overlay. 4. 6. 6 X Fo rm a t Ed it De sc r i pto r The nX edit descriptor causes transmission of the next character to or from a record to occur at the position n characters to the right of the current position. In a FORTRAN-77 output statement, character positions that are skipped are not modified and the length of the output record is not affected. However, in many FORTRAN-66 implementation, the X ed it descr iptor wr ites blanks and may extend the output record. 4-8 --~-~------- CHAPTER 5 A COMPARISON OF FORTRAN LANGUAGE FEATURES Tabl es 5-1 thro ug h 5-16 prov ide comparative fea tur es. Re fer al so to Lang uag e Fund amen tal s Table 5-1 <-AMERlCAN-> NATlOOAL STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) FORTRAN lang uag e (AA-M460A-RK). Programming Considerations II 05/8 OS/78 FORT FORT IV IV TOPS-l 0 <-PDP-11-> Vf>.:I../ RSX RSX VMS TOPS-20 RSTS/E RSTS/E RT-ll lAS Vf>.:I../11 lAS (FOR) (E77) FORTRAN F-I0 <--PDP-8--> 05/8 FORT Maximum number of dimensions allowed for an array 3 7 2 7 7 7 7 7 Infinity Mixed mode expressions - X - X X X X X X Double exponentiation (e.g., A**B**C) permitted - x2 - x2 x2 x2 x2 x2 x2 Statement number size (characters) 1-5 1-5 1-5 1-5 1-5 1-5 1-5 1-5 1-5 Maximum level of nesting for 00 loops - - 20 10 10 -3 20 20 Infinity Maximum number of characters allowed in a PAUSE message - - - - - 255 255 255 Infinity Generalized subscripts permitted - X X X X X X X X Adjustable dimensions permitted in subprogram X X - X X X X X X Specification statement can follow first executable statement - - - - - X - - x4 Generic function selection - X - - - - X X X 2 Right to left evaluation. 3 Undefined. 4 Produces warning. 5-1 A COl'-1.PARISON OF FORTRAN LANGUAGE FEATURES Table 5-1 Programming Considerations (Cont) X3.9 -77 (Full 1966 Language) OS/8 FORT II TOPS-l 0 <-PDP-ll-> VAX/ RSX VMS RSX RSTS/E RSTS/E TOPS-20 !AS OS/8 OS/78 RT-ll FORT FORT lAS VAX/II (FOR) (F77) FORTRAN F-IO IV IV Statement functions can follow executable statements or precede related specification statements - - - X X X - - x4 Maximum nunber of continuation lines 19 19 Infinity 5 5 Infinity 0-99 0-99 Infinity Embedded blanks permitted in key words X X X X X X X X X Key words reserved by the compiler - - - - - - - - - Maximum characters in a symbolic name 6 6 5 6 6 63 6 Maximum level of nesting for implied 00 loops -1 -1 2 10 10 -2 -2 -2 Infinity Comment line starts with C C,* C C C C,D,1 C,D, * ,1 C,D, * ,1 C,$,*, / ,D,1 Source code in EBCDIC -1 -1 - - - - - - - Source code in BCD - 1 - 1 - - - - - - - Source code in ASCII -1 -1 X X X X X X X End-o f-l ine corranents delimited by "1" - - - - - X X X X X x6 X X X <-AMERlCAN-> NATIONAL STANDARDS FORTRAN Label on any statement <--PDP-8--> 3 31 5 6 3 INCLUDE from source file - - - X X X INCWDE from test library - - - - X - 1 2 3 4 5 6 Not specified. Undefined. Warning given for >6. Warning given. Warning given for over 31. Not on a function statement. 5-2 A COMPARISON OF FORTRAN LANGUAGE FEATURES Table 5-2 <-AMERICAN-> NATIONAL STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) Subprogram Statements II <-PDP-ll-> VN</ TOPS-l 0 RSX RSX VMS RSTS/E RSTS/E TOPS-20 lAS as/8 OS/78 RT-ll FORT FORT lAS VN</ll (F77) FORTRAN F-IO (FOR) IV IV <--PDP-8--> as/8 FORT BLOCK DATA X Xl - X X xl xl xl Xl ENTRY entry-point [(arg[ ,arg] ••• )] - X - - - - X2 X2 X2 FUNCTION function-name (arg [ ,arg] ••• ) X X X X X x2 x2 x2 x2 function-name (arg[,arg] ••• )= X arithmetic-expression X - X X X X X X function-name (arg [ ,arg] ••• ) = logical expression X X - X X X X X X function-name (arg[,arg] ••• )= character expression - X - - - - - X X x 3 ,7 - X x4 x2 x2 x 2 ,6 x 5 ,2,7 X X X X X X X X [nITffiffi ~~LE ] PRECISION FUNCTION x3 COMPLEX LOGICAL func-name [*length] (arg [ ,arg] ••• ) SUBROUTINE subroutine-name [(arg[ ,arg] ••• )] 1 2 3 4 5 6 7 X Can have name. Permit () and no args. ·*length not permitted. INTEGER, REAL, LOGICAL only. *length ignored in most cases; flagged with warning. Also types DOUBLE COMPLEX, CHARACTER Also type CHARACTER [*length]. 5-3 A COMPARISON OF FORTRAN LANGUAGE FEATURES Table 5-3 Constant and Variable Types I 05/8 05/8 OS/78 X3.9 -77 (Full 1966 Language) FORT II FORT FORT IV IV <-PDP-ll-> VAX/ TOPS-IO VMS RSX RSX RSTS/E RSTS/E TOPS-2O RT-ll lAS lAS VAX/ll (FOR) (F77) FORTRAN F-10 Integer X X X X X X X X X Real X X X X X X X X X Double-precision X X - X - X X )( X Complex X X - X - X X X X Double complex - - - - - - - X - Logical X X - X X X X X X Literal (preceded by H) X3 - X5 X5 X5 X5 X5 X5 x5 Literal (enclosed in single quotes) - x7 x5 x5 x5 x5 x7 x7 x7 Hexadecimal - - - - - - X X - Octal - - - xl X x2 x2 x2 x6 Quadruple 'precision - - - - - - - X - Radix 50 - - - - - xl xl xl - <-AMERlCAN-> NATIONAL STANDARDS FORTRAN <--PDP-8--> CONSTANT FORMS I 2 3 5 6 7 In DATA statements only. ["ddd] allowed anywhere [Oddd] is allowed in DATA statements. In DATA, FORMAT, and subroutine arguments only. Denotes Hollerith literal. "ddd allowed anywhere. Denotes CHARACTER constant. 5-4 A COMPARISON OF FORTRAN LANGUAGE FEATURES Table 5-4 <-AMERICAN-> NATIONAL Data Types <--PDP-8--> STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) OS/8 FORT II 05/8 05/78 FORT FORT IV IV <-PDP-ll-> VAX/ TOPS-IO RSX RSX VMS RSTS/E RSTS/E TOPS-20 RT-ll lAS !AS VAX/ll (FOR) (F77) FORTRAN F-I0 Floating point REAL REAL*4 REAL*8 REAL*16 DOUBLE PRECISION X - X X - -X X - X - ~7 X - X X X X X X - - X X X X X X X X X X X X X Xs X X X Xs X - Complex COMPLEX COMPLEX*8 COMPLEX*16 DOUBLE COMPLEX X - x7 - - - - - X X - - - X - X - - - X X X X - - X - X X X X X x2 x4 xl x4 X X xl x4 X X Xs Xs X X X - Character CHARACTER*(length) CHARACTER* (*) Logical LOGICAL LOGlCAL*1 LOOICAL*2 LOGlCAL*4 X - - - X - - - - X Integer INTEGER INTEGER*1 INTEGER*2 INTEGER*4 I 2 3 4 5 7 X - - X - - X - Defaults to *2 or *4 at compile time. Implemented as *4. Four-byte allocation; two-byte precision. BYTE is synonym for LOGlCAL*I. Produces warning; * length ignored. Only with FPP hardware. 5-5 X - X - x2 xl xl - - - X3 X X X X X ~s X A COMPARISON OF FOHTRAN LANGUAGE FEATURES Table 5-5 Specification Statements <-AMERICAN-> NATIONAL STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) II <-PDP-ll-> VlVl../ TOP5-1 0 RSX RSX VMS RSTS/E RSTS/E TOP5-2 0 lAS as/8 OS/78 RT-ll FORT FORT' lAS VlVl../ll (FOR) IV IV (F77) FORTRAN F-10 PRCGRAM name - X - - - X X X X NAMELIST /namelist-name/ name [,name ••• ] [[,] /namelistname/ name [,name ••• ]] ••• 1 PARAMETER var=constant, ••• 2 PARAMETER (var=exp, ••• ) - - - - - - - X X - - - - - - X X X - X - - - X X X SAVE statement - X - - - - X X X IMPLICIT type (characters [,type(characters)] ••• - X - - - X X X X X X - X - X X x4 x - - - - - - - X4 x 3 ,S,6 lr RFAL 1[INTEGER ~ DOUBLE PRECISION COMPLEX LOGICAL <--PDP-8--> as/8 FORT S {"arne array:-declarator } functlon-name [,name i: } ...J ,array~declarator , functlon-name INTEGER RFAL [*8][*2] COMPLEX [*16] LOGICAL [*1] 11 fame array-declo } function-name [*length] [/initial-value/] 1 2 3 4 5 6 Type of symbolic name determined by constant. Type of symbolic name determined by first letter, IMPLICIT, and type declarations. Warnings produced for INTEGER*2, COMPLEX*16, LOGICAL*l. Also allows types DOUBLE COMPLEX, CHARACTER. Also allows type CHARACTER. Initial-value not allowed. 5-6 A COMPARISON OF FORTRAN LANGUAGE FEATURES Table 5-5 Specification Statements (Cont) <-AMERlCAN-> NATIONAL <--PDP-8--> <-PDP-ll-> VAX/ RSX RSX TOP5-l0 VMS X3.9 1966 -77 (Full OS/8 FORT Language) II RSTS/E RSTS/E TOP5-20 OS/8 OS/78 RT-ll !AS FORT FORT lAS VAX/ll (F77) IV IV (FOR) FORTRAN F-IO X X X X X X X X X X X - X X X X X X DIMENSION array-decl. [,array-decl.] ••• X X X X X X X X X EQUIVALENCE (name[,name] ••• ) [, (name [ ,name] ••• )] ••• X X X X X X X X X ~ X X - X X X X X X X - - - - - X X xl - X - - - - X X X - X - - - - X X X STANDARDS FORTRAN COMMON~~:y_decl.~ Knarne ,array-decl.] • •• :0 COMMON/block-name!~ame array-d ec Kname ,array-decl.~. ••• [/block-name/ ••• ] ••. EXTERNAL~SUbPrOgram-name external-proc-name ~SubprOgram-narne ] ,external-proc-name ••• EXTERNAL 1[[*] subprogram-name ~ [*]external-proc-name ••• Array declarators allow upper and lower dimension bounds INTRINSIC 1[subProgram-name~ 1 & can be used in place of *. 5-7 A COMPARISON OF FORTRAN L.ANGUAGE FEATURES Table 5-6 Data Initialization statement <-AMERICAN-> NATIONAL <-PDP-ll-> vAX! TOPS-I 0 RSX RSX VMS TOPS-20 RSTS/E RSTS/E lAS RT-ll VAX/ll lAS (FOR) (F77) FORTRAN F-IO <--PDP-8--> STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) 05/8 FORT II 05/8 OSi78 FORT FORT IV IV DATA name [,name] ••• /[number*] value [,[number*]va1ue] ••• [ , / [ , name ••• ] ••• ] ••• X xl - X X xl xl xl xl Implied DO construct - X X X X - - X X Data values converted to type of name - X - - - - X X X Data initialization allowed in type declaration statements - - - - - - - X - t Name may be an array name implying all elements of array. Table 5-7 <-AMERICAN-> NATIONAL Relational Operators <--PDP-8--> STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) 05/8 FORT II 05/8 OSi78 FORT FORT IV IV TOPS-I 0 <-PDP-ll-> VAX/ RSX VMS RSX TOPS-20 RSTS/E RSTS/E RT-ll lAS VAX/ll lAS (FOR) FORTRAN F-IO (F77) .GT. X X - X X X X X X .GE. X X - X X X X X X .LT. X X - X X X X X X .LE. X X - X X X X X X .EQ. X X - X X X X X X .NE. X X - X X X X X X > - - - - - - - - X >= - - - - - - - X < - - - - - - - - X <= - - - - - - - - X -- - - - - - - - - X # - - - - - - - - X 5-8 - - - - _..- - - - - _ . _ - - A COMPARISON OF FORTRAN LANGUAGE FEATURES Table 5-8 Logical Operators II 05/8 05/78 FORT FORT IV IV TOPS-1O <-PDP-ll-> VAX/ RSX RSX VMS TOPS-20 RSTS/E RSTS/E lAS RT-ll VAX/ll !AS (FOR) (F77) FORTRAN F-1O X - X X X X X X X X - X X X X X X .OR. X X - X X X X X X .XOR. - - - X X X X X X .E(]J. - X X X X X X X .NEQV. - X - - - - X X X Table 5-9 Assignment Statements <-AMERlCAN--> NATlOOAL <--PDP-8--> STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) 05/8 FORT .Nor. X .AND. II 05/8 05/78 FORT FORT IV IV TOPS-1O <-PDP-ll-> vAX! RSX RSX VMS TOPS-20 RSTS/E RSTS/E lAS RT-ll VAX/ll !AS FORTRAN F-IO (FOR) (F77) X X X X X X X X variable = logical expression X X - X X X X X X ASSIGN statement-number TO variable X xl - X X X xl xl xl variable = character expression - X - - - - x2 X X <-MERleAN-> NATIONAL <--PDP-8--> STANDARDS variable = arithmetic expression X3.9 1966 FORTRAN -77 (Full Language) 05/8 FORT X I Statement label may be label of a format statement. 2 Character expression must be variable, substring, or constant. 5-9 A COMPARISON OF FORTRAN LANGUAGE FEATURES Table 5-10 <-AMERICAN-> NATIONAL Control Statements <--PDP-8-->. STANDARDS <-PDP-ll-> VAX/ RSX RSX VMS RSTS/E RSTS/E RT-ll lAS lAS VAX/ll (FOR) (F77) FORTRAN TOPS-I 0 F-IO TOPS-20 FORTRAN X3.9 -77 (Full 1966 Language) OS/8 FORT II OS/8 OS/78 FORT FORT IV IV CALL subroutine-name [(argument [,arg[ ••• )] X X X X X xl xl xl X CONTINUE X X X X X X X X x 2 ,4,8 x 2 ,8, 9,10 x 2 ,8,9 X x2,8,9 DO statement-number controlvariable = inJ tial-value, test-value [ , increment] X X X X X END X X X X X X X X X GO TO statement-number X X X X X X X X GO TO (statement-number, statement-number [,statement-number] ••• ) [ ,] variable X x6 X X X X x 5 ,6 x 5 ,6 x 5 ,6 x 5 ,6 GO TO variable [[,] (statement number, statement-number [,statement-number] ••• )] X X - X X X x7 X x7 IF (arithmetic-expression) X statement-number, statement number, statement-number X X X X X X X X IF (logical-expression) executable-statement X - X X X X X X X 1 2 3 4 5 Null argument permitted. General expressions permitted. Iteration count computer but minimum of one iteration. Variable and expressions are of type INTEGER. Index may be a general expression which will be converted automatically to integer if expression of other type. 6 If index out of bounds, then acts as continue. 7 If list present and assigned label not in list, then acts as continue. 8 Optional comma after statement number. 9 Compiler switch to determine minimum iteration count (0 or 1). 10 Statement number optional. 5-10 A COMPARISON OF FORTRAN LANGUAGE FEATURES Table 5-10 Control Statements (Cont) II as/8 OS/78 FORT FORT IV IV TOPS-10 <-PDP-ll-> VM../ RSX VMS RSX RSTS/E RSTS/E TOPS-20 RT-ll !AS lAS VAX/II (FOR) FORTRAN F-IO (F77) - - - - - - - - - X - - - - X X X DO-WHILE - - - - - - - X X END 00 - - - - - - - X X PAUSE (one to six octal digits) X - - - - X X X x2 PAUSE (one to five decimal digits) - X X X X X X X x2 PAUSE 'message' - X - - - X X X X S'IDP (one to six octal digits) X - - - X X X x2 STOP (one to five decimal digits) - X - - - X X X x2 STOP 'message' - X - - - X X X X Tracing after pause - - - - - - - x4 X RETURN X X X X X X X X X RETURN (expression) - X - - - - - X X <-AMERlCAN-> NATIONAL STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) IF (logical-expression) statement-number, statement number - IF-THEN-ELSE-ENDIF <--PDP-8--> as/8 FORT 2 Up to 12 digits. 4 PAUSE enters command processor. User can STOP, CONTINUE, ASSIGN, SHOW, DEBUG, etc. 5-11 A COMPARISON OF FORTRAN LANGUAGE FEATURES Table 5-11 <-MERleAN-> NATIONAL Sequential I/O Statements <--PDP-8--> STJ\NDARDS TOPS-10 <-PDP-ll-> VAX/ RSX RSX VMS TOPS-20 RSTS/E RSTS/E RT-ll lAS VAX/l1 !AS (F77) FORTRAN F-10 (FOR) FOR'l"RAN X3.9 -77 (Full 1966 Language) as/8 FORT II as/8 as/78 FORT FORT IV IV - - - - - X X X X X X X X - - - - X X X X ACCEPT N - - - - - - - X X BACKSPACE u X X - X X X X X X ENDFILE u X X - X X X X X X PRINT f,k X X - - - X X X X PRINT f X X X X X X PRINT*,k - X X X X X PRIm' N - - - - - - - X X PUNCH f,k - - - - - - - - X PUNCH f - - - - - X PUNCH* ,K - - - - - X N = namelist-name u = uni t m.mber f = label of a format statement k = an I/O list * indicates listdirected I/O ACCEPT f,k ACCEPT f ACCEPT*,k 5-12 ~~~----~~--~~-.---~----- A COMPARISON OF FORTRAN LANGUAGE FEATURES Table 5-11 Sequential I/O Statements (Cont) <-MERleAN-> NATIONAL <--PDP-8--> STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) II as/8 05/78 FORT FORT IV IV - - 05/8 FORT <-PDP-ll-> VAX/ RSX RSX VMS RSTS/E RSTS/E lAS RT-ll TOPS-2O VAXill !AS (FOR) TOPS-I 0 (F77) FORTRAN F-IO N = namelist-name u = uni t nunber f = label of a format statement k = an I/O list * indicates listdirected I/O RFAD f,k - X - X X X X x2 x2 READ (u,f) [k] X x2 X X X X x2 RFAD (u) [k] X x3 - X X X x3 x3 x3 RFAD (u [, f] [, END=SI] [,ERR=S2] ) [k] - X - - - x l ,4 x l ,2 x l ,2 X1 ,2 RFAD* ,k - X - - - X X X X x l ,3 x l ,3 READ (u,*[,END=S]] [,ERR=S2])k - X RFADN - - - - - xl x l ,3 - - - - X X - x 3 ,s X - - X. - - - - - - - X X - X X X X X X BACKFILE u - - - - - - - - X SKIPFILE u - - - - - - - - X TYPE f[ ,k] - - - - - X X X X TYPE *[ ,k] - - - - X X X X TYPE N - - - - - - - X X RERFAD f,k - REWIND u RFAD (u,N[,END=SI] [,ERR=S2]) I 2 3 4 5 - Keywords in either order. Also UNIT = u, FMT = f. Also UNIT = u. f is mandatory (formatted only) • Also NML=N. 5-13 A COMPARISON OF r'ORTRAN LANGUAGE FEATURES Table 5-11 Sequential I/O Statements (Cont) <-AMERlCAN-> NATIONAL STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) II OS/8 OS/78 FORT FORT IV IV <-PDP-ll-.> RSX RSX RSTS/E RSTS/E RT-ll lAS lAS (FOR) (F77) <--PDP-8--> OS/8 FORT VAX/ VMS TOPS-l 0 TOPS-20 VAX/II FORTRAN F-I0 N = namelist-name u = uni t nunber f = label of a format statement k = an I/O list * indicates listdirected I/O ary = array, array element, or variable WRITE (u,f) [k] X 3 X X X X X x3 x3 x3 WRITE (u) [k] X x4 - X X X x4 x4 x4 x l ,3 x l ,3 WRITE (u[,f] [,END=SI] [ , ERR=S2] ) k - X - - - xl,S x l ,3 WRITE (u,*[,END=SI] [ , ERR=S2] ) k - xl ,4 - - - xl x l ,4 x l ,4 x l ,4 WRITE (u,N[ ,END=SI] [,ERR=S2]) - - - - - - - x6 X WRITE *,k - - - - - X WRITE f,k - - - - X WRITE f - - - - - X SKIPRECORD u - - - - - - - - X UNLOAD u - - - - - - - - X ENCODE/DECODE (cnt,fmt,ary)k - - - - - X X X X 1 3 4 5 6 Keywords in either order. Also UNIT = u, FMT = f. Also UNIT = u. f is mandatory (formatted only). Also NML=N. 5-14 A COMPARISON OF FORTRAN LANGUAGE FEATURES Table 5-12 File Control Statements II OS/8 OS/78 FORT FORT IV IV <-PDP-ll-> VAX/ TOPS-I 0 RSX RSX VMS TOPS-20 RSTS/E RSTS/E RT-ll lAS VAX/ll !AS (FOR) (F77) FORTRAN F-I0 X xl - - X X X X - X Xl - - X X X X - X - - - - - X - <-AMERlCAN-> NATlOOAL <--PDP-8--> STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) OS/8 FORT OPEN - CLOSE INQUIRE 1 Library subroutines. Table 5-13 Direct Access I/O Statements <-AMERleAN-> NATIONAL <--PDP-8--> II OS/8 OS/78 FORT FORT IV IV <-PDP-ll-> VAX! TOPS-I 0 RSX RSX VMS TOPS-20 RSTS/E RSTS/E RT-ll lAS !AS VAX/ll (FOR) (F77) FORTRAN F-I0 STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) OS/8 FORT u = unit number n = number of records in file rs = length in 16-bit words of record c = indicates unformatted v = associated variable DEFINE FILE u(n,rs,c,v) [ ,u • •• ) ••• 2 FIND (u'r) - - - X X x2,3 x2,3 - - - - - X x RFAD (u'r[,f) - x9 - X X x2 xl! xl! xl! READ (u'r[f) [ ,END=Sl) [,ERR=S2) [K) - x9 - - - x 2 ,S xl! xl! xl! WRITE (u' r[ ,f» [k) - x9 - X X x2 xl! xl! xl! WRITE (u'r[,f) [,END=SI) [ ,ERR=S2» [k) - x9 - - - x 2 ,S xl! xl! xl! DELETE (u' r[ ,ERR=s2) - - - - - - xlO xlO - X X X X X X X X X [k) lO x2,3 x lO x lO FORMAT statement: Statement-number FORMAT ( format-spec) 1 Call DEFINE FILE with different format of arguments. 2 Unformatted only. 3 Record size measured in 16-bit words (= 1/2 storage unit) • 4 Record size measured in storage units. S END= option not allowed. 6 Warning for i. 8 END=SI syntax used if record number is outside of file. 9 REC=r is syntax for direct access. 10 Also UNIT = u, REC = r. l! Also UNIT = u, REC = r, FMT = f. 5-15 A COMPARISON OF FORTRAN LANGUAGE FEATURES Table 5-14 <-AMERleAN-> NATIONAL Indexed I/O Statements <--PDP-8--> II 05/8 05i78 FORT FORT IV IV <-PDP-11-> VAX! TOPS-10 RSX RSX VMS TOPS-20 RSTS/E RSTS/E lAS RT-ll !AS VAX/ll (F77) (FOR) FORTRAN F-10 - - - - - x2 x2 - - - - - - - x2 x 2 - - - - - x - - x 2 x2 x2 - - - x2 x2 - 2 2 - x3 x3 - STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) 05/8 FORT READ (u[,f] ,KEY=k1[,KEYID=i]) [k] - READ (u[,f],KEY=k2[,KEYID=i] [ ,END=Sl] [,ERR=S2] ) [k] WRITE (u[ ,f]) 1 [k] u = unit nunber f = format specifier kl = key specifier i = key identifier sl = statement label s2 = statement label k = an I/O list WRITE (u[,f] [,END=sl] [,ERR=s2] ) [k] - - - - REWRITE (u[ ,f]) [k] - - - - REWRITE (u[ ,f] [,END=sl] [ ,ERR=2]) [k] - - - - - - x DELETE (u[ ,ERR=s2]) - - - - - - x UNLOCK (u[ ,ERR=s2] ) - - - - - - x 1 Syntax identical to sequential write. 2 Also UNIT = u, FMT = f. 3 Also UNIT = u. 5-16 2 3 3 x A COMPARISON OF FORTRAN L~NGUAGE FEATURES Table 5-15 Format and Types of Conversion <--PDP-8--> <-PDP-ll-> VAX/ NATIONAL STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) RSX RSTS/E VMS as/8 as/8 as/78 FORT II FORT IV FORT IV RSX RSTS/E RT-11 lAS (FOR) (F77) FORTRAN F-10 A (alFhammeric) X X X X X X X X X D (real D decimal exponent) X X - X - X X X X E (real E decimal exponent) X X X X X X X X X F (real, no exponent) X X· X X X X X X X G ( real) X X X X X X X X X H (literal) X X X X X X X X X , ... , (literal) - X X X X X X X X ( integer) X X X X X X X X X L (logical) X X - X X X X X X 0 (octal) - - - X X X X X X P (scale factor) X X - X X X X X X X X X X <-AMERleAN-> I Q (record length) TOPS-IO TOPS-2O lAS VAX/ll T (position indicator in record) - X - X X X X X X X (skipped data or blank) X X X X X X X X X Z (hexadecimal data) - - - - - - X X X Format specification in arrays X X - X X X X X X 5-1 7 A COMPARISON OF FORTRAN LANGUAGE FEATURES Table 5-15 Format and Types of COnversion (COnt) <-AMERlCAN-) NATIONAL STANDARDS FORTRAN <--PDP-8--) <-PDP-ll-) vAX! RSX RSX VMS TOPS-I 0 RSTS/E TOP5-2 0 X3.9 -77 (Full 1966 Language) 05/8 FORT II OS/8 OS(78 RT-ll FORT FORT lAS IV IV . (FOR) Carriage Control X X X X R (right-justified A) - - - S (control of optional + sign) - X / (record separator) X RSTS/E lAS (F77) VAX/II FORTRAN F-IO X X X X - - - - X - - - X X X X X X X X X X X X : (format scan terminator) - X - - - X X X X $ (format separator) - - - X X x3 x3 x3 x3 BN (blank = null) X X X X BZ (blank = zero) X X X X SS (suppress optional + sign) X X X X SP (print optional + sign) X X X X TL (tab left) X X X X TR (tab right) X X X X 3 Used as carriage control character also. 5-18 A COMPl\RISON OF FORTRAN LANGUAGE FEATURES Table 5-16 <-AMERICAN-> NATIONAL STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) Real X Integer Library Functions <--PDP-8--> II 05/8 OS/78 FORT FORT IV IV <-PDP-ll-> VNI./ TOPS-10 RSX RSX VMS RSTS/E RSTS/E TOPS-20 RT-ll lAS !AS VNI./ll (FOR) (F77) FORTRAN F-10 X X X X X X X X X X X X X X X X X Double-precision X X - X - X X X X Quad precision - - - - - - - X - Complex to real X X - X - X X X X Double complex to double-precision - - - - - - - X x2 Integer to real X X X X X X X X X Integer to double - X - - - -1 X X X Integer to quad - - - - - - - X - Real to integer X X X X X X X X X Double to real (obtain most significant part) X X - X - X X X X 05/8 FORT Absolute value: Conversion: Double to integer X Quad to real - - - - - - - X - Real to double X X - X - X X X X Real to quad - - - - - - - X - Byte or integer*2 to integer*4 (zero-extend) X G-floating to D-floating X X D-floating to G-floating X X 1 Available as implied conversion only. 2 Argument is a two-element double-precision array. 5-19 A COMPARISON OF FORTRAN LANGUAGE FEATURES Table 5-16 <-AMERlCAN-> NATIONAL STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) Library Functions (Cont) <--PDP-8--> II as/8 OS/78 FORT FORT IV IV as/8 FORT <-PDP-ll-> VAX/ TOPS-l 0 RSX RSX VMS TOPS-20 RSTS/E RSTS/E RT-ll lAS lAS VAX/ll (F77) (FOR) FORTRAN F-IO Complex to real (obtain real part) X X - X - X X X X Double complex to real (real part) - - - - - - - X - Complex to real (obtain imaginary part) X X - X - X X X X Double complex to double real (imaginary part) - - - - - - - X - Real to complex X X - X - X X X X Double real to double complex - - - - - - - X - Real (radians) X X X X X X X X X Real (degrees) - - - X X - - X X Double (radians) X X - X - X X x3 X Quad - - - - - - - x3 - Complex X X - X - X X X X Double complex - - - - - - - X .x 4 Sine X X - X X - X x2 X Cosine X X - X X - X x2 X Tangent X X - X X xl X x2 X Cosine: Hyperbolic (real and double) : 1 2 3 4 Real only. Also quad. Radian and degree versions. Arguments are two-element double-precision arrays. 5-20 - _ .. -.--~--- .-------~~~~- A COMPARISON OF FORTRAN LANGUAGE FEATURES Table 5-16 Library Functions (Cont) <-AMERICAN-> NATIONAL STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) II Arc-sine (real and double) X X - X X - X Arc-cosine (real and double) X X - X X - X x2 ,3 X Real X X X X X X X . x3 X Ibuble X X - X - X X x3 X Quad - - - - - - - x3 - Quotient of two arguments X X - X X X X x3 X Real (radians) X X X X X X X X X Real (degrees) - - - X X - - X X Double (radians) X X - X - X X x3 X Quad - - - - - - - x3 - Complex X X - X - X X X X Ibuble complex - - - - - - - X x4 <--PDP-8--> 05/8 FORT TOP5-l0 <-PDP-ll-> VAX! RSX VMS RSX "RSTS/E RSTS/E TOP5-20 05/8 OS/78 RT-ll lAS FORT FORT IAS VAX/ll IV (FOR) FORTRAN F-1O IV (F77) x 2 ,3 X Arc-tangent: Sine: 1 2 3 4 Real only. Also quad. Radian and degree versions. Arguments are two-element double-precision array. 5-21 A COMPARISON OF FORTRAN LANGUAGE FEATURES Table 5-16 <-AMERlCAN-> NATIONAL STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) Library Functions (Cont) <--PDP-8--> 05/8 FORT II 05/8 OS/78 FORT FORT IV IV <-PDP-ll-> Vl\I../ TOPS-10 RSX RSX VMS RSTS/E RSTS/E TOPS-20 RT-II lAS lAS Vl\I../11 (FOR) (F77) FORTRAN F-IO Tangent - X X X X - X X X Cotangent - - - - - - - - X lAND - - - - - x2 x2 x2 x2 IOR - - - - - x2 x2 x2 x2 lEOR - - - - - 2 X x2 x2 x2 Nar - - - - - x2 x2 x2 x2 - - - - - - - - - - - - - - - - Logical functions: Error function Garrrna function - - - - - - - - Switch register - - X X - X X - - Complex conjugate X X - X - X X xl X positive difference (ul-Min(u1 ,u 2» X X - X X X X X X Log garrana 1 Also double complex. 2 Available in all expressions as .AND., .OR., .XOR., and .NOT. operators for integer values. 5-22 A COMPARISON OF FORTRAN LANGUAGE FEATURES Table 5-16 <-AMERICAN-> NATIONAL STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) Library Functions (Cont) <--PDP-8--> OS/8 FORT II <-PDP-ll-> VAX/ TOPS-l 0 RSX RSX VMS RSTS/E RSTS/E TOPS-20 OS/8 OS/78 RT-ll lAS FORT FORT lAS VAX/ll IV IV (FOR) (F77) FORTRAN F-IO Bit set - - - X - Bit test - - - X - Bit clear - - - X - Shift - - X X - Circular shift - - - X - Insert bits - - - X - Move bits - - - X - Real X X X X X X X X X Double X X - X - X X X X Quad - - - - - - - X - Complex X X - X - X X X X Double complex - - - - - - - X xl Real X X X X X X X X X Double X X - X - X X X X Quad - - - - - - - X - Complex X X - X - X X X X Double complex - - - - - - - X xl Exponential: Logarithm: 1 Arguments are two-element double-precision arrays. 5-23 A COMPARISON OF FOR'fRAN LANGUAGE FEATURES Table 5-16 <-AMERlCAN-> NATIONAL STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) Library Functions (Cont) <--PDP-8--> II 05/8 OS/78 FORT FORT IV IV <-PDP-ll-> VAX/ TOPS-1 0 RSX RSX VMS RSTS/E RSTS/E TOPS-20 RT-ll !AS lAS VAX/ll (FOR) (F77) FORTRAN F-IO 05/8 FORT Square root: Real X X X X X X X X X Double X X - X - X X X X Quad - - - - - - - X - Complex X X - X - X X X X Double complex - - - - - - - X xl Real to real X X X X X X X X X Real to integer X X X X X X X X X Double to integer X X - X - X X X X Quad to integer - - - - - - - X - Real X X - X X X X X X Integer X X X X X X X X X Double-precision X X - X - X X X X Truncation: 1 Arguments are two-element double-precision arrays. 5-24 .~ COMPARISON OF FORTRAN LANGUAGE FEATURES Table 5-16 Library Functions (Cont) <-AMERICAN-> NATIONAL STANDARDS FORTRAN X3.9 -77 (Full 1966 Language) II TOPS-l 0 <-PDP-ll-> VAX/ RSX VMS RSX RSTS/E RSTS/E TOPS-20 lAS as/8 OS/78 RT-ll FORT FORT lAS VAX/II FORTRAN F-I0 (FOR) (F77) IV IV Maximum value (Number of arguments ~2 for all functions) X X - X X X X X X Minimum value (Number of arguments ~2 for all functions) X X - X X X X X X Real X X - X X X X X X Integer X X - X X X X X X Double-precision X X - X - X X X X Quad precision - - - - - - - X - Test sense switch - - - X - X X X X Random number - - - - - X X X X Convert sign magnitude to 2s complement and vice versa - - - - - - - - - - - - - - - - X <--PDP-8--> as/8 FORT Transfer of sign: Remainder of time limit DIVERT run time error messages to a file X ERRSET controls handling of error conditions X DATE, TIME X TRACE X 5-25 Reader's Comments ANSI-77 FORTRAN Information Document EY-1233E-ID-OOOl Your comments and suggestions will help us in our continuous effort to improve the quality and usefulness of our pUblications. What is your general reaction to this manual? In your jUdgment is it complete, accurate, well organized, well written, ctcJIs it easy to use? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ What faults or errors have you found in the manual? _ _~~_~~~_ _ _~~_~_~_~~_ Does this manual satisfy the need you think it was intended to satisfy? _~~_~~_~~_~~~_ Does it satisfy your needs? _~~~~~~~~~_~~_ o Why? ___________________________ Please send me the current copy of the Technical Documentation Catalog, which contains information on the remainder of DIGITAL's technical documentation. Name ~ ______ ~ _ _ _ _ _ _ __ Street _~~~~~~~~~~~~~~~~_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __ City _~ Title Company _________________ State/Country __________________ Department _ _ _ _ _ _ _ _ _~~~___ Zip Additional copies of this document are available from: Digital Equipment Corporation ESD&P Order Processing 12A Esquire Road North Billerica, MA 01862 Order No. EY-1233E-ID MRO Do Not Tear - Fold Here and Staple III II I No Postage Necessary if Mailed in the United States BUSINESS REPLY MAIL FIRST CLASS PERMIT NO.33 MAYNARD, MA. POSTAGE WILL BE PAID BY ADDRESSEE I Digital Equipment Corporation Educational Services/Quality Assurance 12 Crosby Drive (BUO/E08) Bedford, MA 01730 Digital Equipment Corporation • Bedford, Ma. 01730
Home
Privacy and Data
Site structure and layout ©2025 Majenko Technologies