FORTRAN IV-H Language Reference Manual
Total Page:16
File Type:pdf, Size:1020Kb
SJDS SIGMA 5/7 FORTRAN IV-H Reference Manual SCIENTIFIC CATR SYSTEMS Price: $3.00 FORTRAN IV-H REFERENCE MANUAL for SOS SIGMA 5/7 COMPUTERS 90 09 66C August 1968 SCIENTIFIC DATA SYSTEMS/701 South Aviation Boulevard/EI Segundo, California 90245 ©1967. 1968. Scientific Data Systems. Inc. Printed in U.S.A. REVISION This publication, SDS 9009 66C, is a minor revision of FORTRAN IV-H Reference Manual, 90 09 66B (dated January 1968). A change in text from that of the previous manua I is indi cated by a vertical line in the margin of the page. RELATED PUBLICATIONS Title Publication No. Sigma 7 Computer Reference Manual 9009 50 Sigma 5 Computer Reference Manual 9009 59 Sigma 5/7 Basic Control Monitor Reference Manual 9009 53 Sigma 5/7 Symbol/Meta-Symbol Reference Manual 9009 52 Sigma 7 Mathematical Routines Technical Manual 900906 Sigma 5/7 FORTRAN IV-H Operations Manual 90 11 44 Sigma 5/7 FORTRAN IV-H Library/Run-Time Technical Manual 90 11 38 NOTICE The specifications of the software system described in this publication are subject to change without notice. The availabi lity or performance of some features may depend on a specific configuration of equipment such as additional tape units or larger memory. Customers should consult their SOS sales representative for detai Is. ii CONTENTS INTRODUCTION Input/Output Statements 27 Formatted Input/Output Statements 28 1. FORTRAN IV-H PROGRAMS Acceptable FORTRAN II Statements 28 READ Statement 29 2. DATA 4 PUNCH Statement 29 PRINT Statement 29 Limits on Values of Quantities 4 Intermediate Input/Output Statements ___ 29 Constants 4 END= and ERR= Forms of the READ Integer Constants 4 Statement 30 Real Constants 5 NAMELIST Input/Output 30 Doubl e-Precision Constants 5 Output Format 31 Compl ex Constants 5 Input Format 32 Double-Complex Constants 6 FORMAT Statements 33 Logical Constants 6 Format Specifications 34 Literal Constants 6 F Format 34 Identifi ers 7 D and E format 35 Variables 7 G Format 36 Scalars 7 I Format 37 Arrays 7 L Format 38 Array Elements 7 A Format 38 Subscripts 7 H Format 39 Functions 8 I Formats (Literal) 40 X Specification 40 3. EXPRESSIONS 9 T Specification 41 P Specification 41 Arithmetic expressions 9 / Specification (Record Separator) 42 Evaluation Hierachy 9 Parenthesized Format Specifications 43 Mixed Expressions 11 FORMAT and List Interfacing 44 Reiationai Expressions 12 FORMATs Stored in Arrays 45 . Logi cal Expressi ons 13 Auxiliary Input/Output Statements 46 Logical Operators 13 REWIND Statement 46 Eva I uation Hierarchy 14 BACKSPACE Statement 46 END FILE Statement 46 4. ASSIGNMENT STATEMENT 15 Carriage Control for Printed Output 46 5. CONTROL STATEMENTS 17 7. DECLARATION STATEMENTS 47 Labels 17 Classification of Identifi ers 47 GO TO Statements 17 Implicit Declarations 47 Unconditional GO TO statement 17 Expl icit Declarations 47 Assigned GO TO Statement 17 Confl icting and Redundant Declarations __ 47 Computed GO TO Statement 18 Array Declarations 48 ASSIGN Statement 18 Array Storage 48 IF Statement 19 References to Array EI ements 48 Arithmetic IF Statement 19 DIMENSION Statement 49 Logical IF Statement 19 IMPLICIT Statement 49 CALL Statement 20 Explicit Type Statements 50 RETURN Statement 21 Optional Size Specifications 51 DO Statement 21 Storage Allocation Statements 52 CONTINUE Statement 24 COMMON Statement 52 PAUSE Statement 24 Labeled COMMON 53 STOP Statement 25 Blank COMMON 53 END Statement 25 Arrangement of COMMON 54 Referencing of Data in COMMON 55 6. INPUT/OUTPUT 26 EQUIVALENCE Statement 55 Interactions of Storage Allocation Statements __ 57 Input/Output Lists 26 EXTERNAL Statement 58 List Items 26 BLOCK DATA Subprograms 58 Special List Considerations 27 DA TA Statement 59 iii 7. DECLARATION STATEMENTS (Cont) APPENDIXES DATA Variable List 59 A r>. SDS Sigma FORTRAN !V-H Character Set 74 DATA Constant List 60 B. SDS Sigma FORTRAN IV-H Statements 75 8. PROGRAMS AND SUBPROGRAMS 61 Main Programs 61 Subprograms 61 ILLUSTRATIONS Statement Func ti ons 61 FUNCTION Subprograms 62 l. Sample SDS FORTRAN IV-H Program 2 SUBROUTINE Subprograms 63 2. Arra y Storag e 48 ENTRY Statement 64 Arguments and Dummi es 66 Dummy Scalars 67 TABLES Dummy Arrays 67 Adj ustabl e Di mensions 68 l. Sampl e Program 2 Dummy Subprograms 69 2. Mode of Mixed Expressions Using Library Subprograms 69 Operators + - * / 11 Basic External Functions 69 3. Valid Type Combinations for Additional Library Subprograms 69 Exponentiations 11 EXIT 69 4. Evaluation of Logical Expressions 14 SUTET - Sense Light Test 72 5. Mixed Variable Types and Expression SUTE - Set Sense Light 72 Modes 15 OVERFL - Floating Overflow Test 72 6. Standard Unit Assignments 26 DVCHK - Divide Check 73 7. FORTRAN II/FORTRAN IV-H DUMP 73 Equivalent Statements 28 PDUMP 73 8. Basic External Functions 70 9. SDS EBCDIC (Extended Binary-Coded- INDEX 76 Decimal Interchange Code) 75 iv INTRODUCTION SDS Sigma FORTRAN IV-H is a one-pass compiler that operates under the Basic Control Monitor (BCM). It is designed for maximum compatibility with both ASA Standard FORTRAN and IBM 360 H-Ievel FORTRAN IV. SDS Sigma FORTRAN IV-H includes a number of features not found in ASA FORTRAN. Among these features are: ENTRY statement Doubl e compl ex data FORTRAN II READ, PRINT, and PUNCH statements IMPLICIT statement END and ERROR options on READ statements T (tab) format NAMELIST input/output Object program listing Additional! y, the facil ity of introducing in-I ine assembl y language coding into FORTRAN programs is an availabl e option, where compatibility with other FORTRAN systems is not a factor. The compiler tables, such as symbol and label tables, are dynamically allocated by FORTRAN IV-H to optimize memory usage. v 1. FORTRAN IV-H PROGRAMS SDS FORTRAN IV-H piograms are comprised of an ordered set of statements that describe the procedure to be followed during execution of the program and the data to be processed by the program. Some data values to be processed may be external to the program and read into the computer during program execution. Similarly, data values generated by the program can be written out while processing continues. Statements belong to one of two genera I classes: 1. executable statement/, that perform computation, input/output operations, and program flow control. 2. nonexecutable statement/, that provide information to the compiler about storage assignments, data types and program form, as well as providing information to the program during execution about input/output formats and data initialization. Statements defining an SDS FORTRAN IV-H program follow a prescribed format. Figure 1 is a sample FORTRAN Coding Form. Each line on the form consists of 80 spaces or columns; however, the last eight columns are used only for identification or sequence numbers and have no effect on the program. Columns 1 through 72 are used for the statements. The first field, columns 1 through 5, is used for statement labels. Statement labels allow statements to be referenced by other portions of the program. Labels are written as decimal integers, with all blanks (leading, embedded, or trailing) ignored. Section 5, JlControl Statements Jl , contains a more extensive discussion of statement labels. The body of each statement is written in columns 7 through 72, but if additiona I space is required, a statement may be continued. FORTRAN IV -H accepts an unlimited numberof continuation lines. Each continuation I ine must con tain a character other than blank or zero in column 6. The initial line of each statement contains only the char acters blank or zero in column 6. If a statement is labeled, the label must appear on the initial line ofthe statementi labels appearing on continuation lines are ignored. Column 1 may contain the character C to indicate that the line is to be treated as a comment only, with no effect upon the piogiam. Comment lines may appear anywhere in the program, except within a statement 0. e., intersper sed with continuation lines). Statements may have blanks inserted as desired to improve readability, except within literal fields (e. g., in Hollerith constants and in FORMAT statements). The set of characters acceptable to SDS Sigma FORTRAN IV-H is Letters tt: ABCDEFGHIJKLMNOPQRSTUVWXYZ Digits: 0123456789 Special characters: + - * / = () . , $ I & blank (useful)tt Special characters: <>i:@#%¢?!-I (other) This character set conforms to the Extended Binary-Coded Decimal Interchange Code (EBCDIC) standard. (See Appendix A. ) Figure 1 illustrates a sample FORTRAN IV-H program. An explanation is given in Table 1. t See Appendix B. ttThe dollar sign ($) character is accepted, though not recommended, as a letter of the alphabet. It may therefore be used in FORTRAN identifiers, such as $, FIVE$, or $300. For the purposes of the IMPLICIT statement (see Chapter 7), $ follows Z in the set of letters. FORTRAN IV-H Program PROBLEM Sa m pi e 1!l1' -\s SCIENTIFIC DATA SYSTEMS FORTRAN CODING FORM PROGRAMMER _____________________ Identification .--C FOR COMMENT rtsTATEMENT i FORTRAN STATEMENT NUMBER (J 1 5 6 7 10 15 20 25 30 35 40 45 50 • S," ., , . I C ROU iINE Tes CALCULATE FACTdRI ALS , I . c~' ., . ••••• , , , [K =' '1 • , T , , , I , , , , I i i i , I i i i i I , I i i i i i I T · I , FACT6R = , T FACT6R 1 · · - , i , I i i I , i I I i i I . I I . I , 1 0 . 0- 1 -'--'1 . T . i 1 2 K = 0 i 1 3 INRI T E ( 1 O'S • 6 ) K · . f -.- f T i i . 5 ~{F6RMAT ( I 6 ) · T . I 6 Fe'RMAT ( \ 'K :; " I 120 ) T , ri1END ·, Figure 1. Sample SDS FORTRAN IV-H Program Table 1. Sample Program Line Meaning 1,2 The character C in column 1 defines these lines as comments.