DEC 10 AFDO D Decsystem10 FORTRAN IV Programmer's Reference Manual

DEC-10-AFDO-D decsystem10 FORTRAN IV Programmer's Reference Manual DEC-10-AFDO-D decsystem10 FORTRAN IV Programmer's Reference Manual

User Manual: DEC-10-AFDO-D decsystem10 FORTRAN IV Programmer's Reference Manual

Open the PDF directly: View PDF PDF.
Page Count: 158

DownloadDEC-10-AFDO-D Decsystem10 FORTRAN IV Programmer's Reference Manual
Open PDF In BrowserView PDF
FORTRAN IV
PROGRAMMEItS
REFERENCE MANUAL

DEc-r O-AFDO-D

FORTRAN IV
PROGRAMMER'S
REFERENCE MANUAL

The information in this document reflects the software as of
Version 26 of the FORTRAN Compiler and Version 32 of the
run-time operat:ng system (LI 840).

DIGITAL EQUIPMENT CORPORATION • MAYNARD, MASSACHUSETTS

1st Printing March 1967
2nd Printing (Rev) Novemb~r 1967
3rd Printing (Rev) September 1968
4th Printing April 1969
5th Printing June 1969
6th Printing September 1969
7th Printing (Rev) February 1970
Update Pages October 1970
Update Pages February 1971
Update Pages October 1971
Update Pages May 1972

Copyright © 1967, 1968, 1969, 1970, 1971, 1972 by Digital Equipment Corporation

The material in this manual is for informa-

tion purposes and is subject to change without notice.

The following are trademarks of Digital Equipment
Corporation, Maynard Massachusetts:
DEC
FLIP CHIP
DIGITAL

PDP
FOCAL
COMPUTER LAB

CONTENTS
Page
SECTION 1 THE PDP-l0 FORTRAN LANGUAGE
CHAPTER 1 INTRODUCTION TO THE FORTRAN LANGUAGE

1.1

Line Format

1-1

1. 1. 1

Statement Number Field

1-1

1. 1.2

Line Continuation Field

1-1

1. 1.3

Statement Field

1-2

1. 1.4

Comment Line

1-3

1.2

Character Set

1-3

CHAPTER 2 CONSTANTS, VARIABLES, AND EXPRESSIONS

2. 1

Constants

2-1

2.1.1

Integer Constants

2-1

2.1.2

Real Constants

2-1

2.1.3

Double Precision Constants

2-2

2.1.4

Octal Constants

2-2

2.1.S

Complex Constants

2-2

2.1.6

Logical Constants

2-3

2.1.7

Literal Constants

2-3

2.2

Variables

2-4

2.2.1

Scalar Variables

2-4

2.2.2

Array Variables

2-4

2.3

Expressions

2-6

2.3.1

Numeric Expressions

2-6

2.3.2

Logical Expressions

2-8

CHAPTER 3 THE ARITHMETIC STATEMENT

3. 1

3-1

General Description

CHAPTER 4 CONTROL STATEMENTS

4.1

GO TO Statement

4-1

4.1.1

Unconditional GO TO Statements

4-1

4.1.2

Computed GO TO Statements

4-1

4.1.3

Assi gned GO TO Statement

4-2

iii

CONTENTS (Cont)
Page

4.2

IF Statement

4-2

4.2.1

Numerical IF Statements

4-3

4.2.2

Logical IF Statements

4-3

4.3

DO Statement

4-4

4.4

CONTINUE Statement

4-6

4.5

PAUSE Statement

4-6

4.6

STOP Statement

4-7

4.7

EN D Statement

4-7

CHAPTER 5

DATA TRANSMISSION STATEMENTS

5. 1

Nonexecutable Statements

5-1

5.1.1

FORMAT Statement

5-1

5.1.2

NAMELIST Statement

5-11

5.2·
5.2.1

Data Transmission Statements
Input/0 utput Li sts

5-13
5-14

5.2.2

Input/Output Records

5-15

5.2.3

PRINT Statement

5-15

5.2.4

PUNCH Statement

5-16

5.2.5

TYPE Statement

5-16

5.2.6

WRITE Statement

5-16

5.2.7

READ Statement

5.2.8

REREAD Statement

5-17
5-19

5.2.9

ACCEPT Statement

5-20

5.3

Device Control Statements

5-20

5.4

Encode and Decode Statements

5-21

CHAPTER 6 SPECIFICATION STATEMENTS

6.1

Storage Specifi cation Statements

6-2

6. 1. 1

DIMENSION Statement

6-2

6.1.2

COMMO N Statement

6-4

6.1.3

EQUIVALENCE Statement

6-5

6.1.4

EQUIVALENCE and COMMON

6-6

6.2
6.2.1

Data Specification Statements

6-6

DATA Statement

6-6

iv

CONTENTS (Cont)
Page

6.2.2

BLOCK DATA Statement

6-8

6.3

Type Declaration Statements

6-8

6.3.1

IMPLI CIT Statement

6-9

CHAPTER 7

SUBPROGRAM STATEMENTS

7.1

Dummy Identifiers

7-1

7.2

Library Subprograms

7-1

7.3

Arithmetic Function Definition Statement

7-1

7.4

FUNCTION Subprograms

7-2

7.4.1

FUNCTION Statement

7-2

7.5

SUBROUTI NE Subprograms

7-4

7.5.1

SUBROUTINE Statement

7-4

7.5.2

CALL Statement

7-5

7.5.3

RETURN Statement

7-5

7.6

BLOCK DATA Subprograms

7-6

7.6.1

BLOCK DATA Statement

7-6

7.7

EXTERNAL Statement

7-6

7.8

Summary of PDP-10 FORTRAN IV Statements

7-7

SECTION II

THE RUNTIME SYSTEM

CHAPTER 8 THE FORTRAN IV LIBRARY - LIMO
8. 1

The FORTRAN Operating System

8-1

8. 1 . 1

FORSE.

8-1

8.1.2

I/O Conversion Routines

8-2

8.1.3

FORTRAN UUOs

8-3

8.2

Science Library and FORTRAN Utility Subprograms

8-4

8.2. 1

FORTRAN I V Library Functions

8-4

8.2.2

FORTRAN IV Library Subroutines

8-8

CHAPTER 9

SUBPROGRAM CALLING SEQUENCES

9. 1

Macro Subprograms Called by FORTRAN Main Programs

9-1

9.1.1

Calling Sequences

9-1

9.1.2

Returning of Answers

9-2
v

CONTENTS (Cont)
Page
9.1.3

Use of Accumu lators

9-2

9.1.4

Examples of Subprogram Linkage

9-2

9.2

Macro Main Programs Which Reference FORTRAN Subprograms

9-9

9.2.1

Calling Sequences

9-9

9.2.2

Returning of Answers

9-9

9.2.3

Example of Subprogram Linkage

9-10

CHAPTER 10

ACCUMULATOR CONVENTIONS FOR MAIN PROGRAMS AND SUBPROGRAMS

10.1

Locations

10-1

10.2

Accumulators

10-1

10.2.1

Accumulators 0 and 1

10-1

10.2.2

Accumulators 2 through 15

10-2

10.2.3

Accumulators 16 and 17

10-2

10.3

UUOs

10-2

10.4

Subprograms Called by JSA 16, Address

10-2

10.5

Subprograms Ca II ed by PUS HJ 17, Address

10-2

10.6

Subprograms Called by UUOs

10-3

CHAPTER 11

SWITCHES AND DIAGNOSTICS

11. 1

11-1

FORTRAN Switches and Diagnostics

CHAPTER 12

FORTRAN USER PROGRAMMING

12.1

ASCII Character Set

12-1

12.2

PDP-l0 Word Formats

12-2

12.3

FORTRAN Input/Output

12-3

12.3.1

Logical and Physical Peripheral Device Assignments

12-4

12.3.2

DECtape and Disk Usage

12-4

12.3.3

Magneti c Tape Usage

12-6

12.4

Random Access Programming

12-7

12.4.1

How to Use Random Access

12-8

12.4.2

Restri ctions

12-8

12.4.3

Examples

12-9

12.5

PDP-l0 Instruction Set

12-13

APPENDIX A

THE SMALL FORTRAN IV COMPILER

vi

ILLUSTRATIONS
Page
1-1

Typical FORTRAN Coding Form

1-2

2-1

Array Storage

2-5

4-1

Nested DO Loops

4-5
TABLES

2-1

Types of Resultant Subexpressions

2-7

3-1

Allowed Assignment Statements

3-2

5-1

Magnitude of Internal Data

5-3

5-2

Numeric Field Codes

5-4

5-3

Device Control Statements

5-20

8-1

I/o Conversion

8-2

8-2

FORTRAN UUOs

8-3

8-3

FORTRAN IV Library Functions

8-5

8-4

FORTRAN IV Library Subroutines

8-8

Routine

10-1

Accumulator Conventions for PDP-lO FORTRAN IV Compiler and Subprograms

10-3

11-1

FORTRAN Compiler Switch Options

11-1

11-2

FORTRAN Compiler Diagnostics (Command Errors)

11-2

11-3

FORTRAN Compiler Diagnostics (Compilation Errors)

11-3

11-4

FORTRAN Operating System Diagnostics (Execution Errors)

11-8

12-1

ASCII Character Set

12-1

12-2

PDP-10 FORTRAN IV Standard Peripheral Devices

12-3

12-3

Device Table for FORTRAN IV

12-5

vii

PREFACE
This is a reference manual describing the specific statements and features of the
FORTRAN IV language for the PDP-10. It is written for the experienced
FORTRAN programmer who is interested in writing and running FORTRAN IV programs alone or in conjunction with MACRO-10 programs in the single-user or
time-sharing environment. Fami Iiarity with the basic concepts of FORTRAN programming on the part of the user is assumed. PDP-10 FORTRAN IV conforms to
the requirements of the USA Standard FORTRAN.

ix

INTRODUCTION TO THE FORTRAN IV SYSTEM

The FORTRAN compi ler translates source programs written in the FORTRAN IV language into the machine
language of the PDP-lO. This translated version of the FORTRAN program exists as a retrievable, relocatable
binary file on some storage device. All relocatable binary filenames have the extension .REL if they reside on
a directory-oriented device (disk or DECtape).

Binary files may also be created by the MACRO-lO assembler

1

(see Chapter 9) .
In order for the FORTRAN program to be processed, the Linking Loader must load the relocatable binary file
into core memory. Also loaded are any relocatable binary files found in the FORTRAN library (LIMO) which
are necessary for the program's execution. Within the FORTRAN source program, the library files may be called
explicitly, such as SIN, in the statement

x = SIN(Y)
or implicitly, such as FLOUT., the floating-point to ASCII conversion routine, which is implied in the following statements.

3

PRINT
3,X
FORMAT(lX, F4. 2)

A FORTRAN main program and its FORTRAN and/or MACRO-10 subprograms may be compiled or assembled separately and then linked together by the Linking Loader at load time. The core image may then be saved on a
storage device. When saved on a directory storage device, these files have the extension .SAV in a multiprogramming Monitor system and. SVE in a single-user Monitor system.
The Time-Sharing Monitors act as the interface between the user and the computer so that all users are protected
from one another and appear to have system resources available to themselves. Several user programs are loaded
into core at once and the Time-Sharing Monitors schedule each program to run for a certain length of time. All
Monitors direct data flow between I/O devices and user programs, making the programs device independent, and
overlap I/O operations concurrently with computations.
In a multiprogramming system, all jobs reside in core and the scheduler decides which of these jobs should run.
In a swapping system, jobs can exist on an external storage device (usually disk) as well as in core. The scheduler

I

lFor further information on the MACRO-10 assembler, see the MACRO-10 ASSEMBLER manual, DEC-10-AMZC-D.
Revision 1 FORTRAN

ix

October 1970

decides not only which job is to run but also when a job is to be swapped out onto the disk or brought back into
core.
The number of users that can be handled by a given size time-sharing configuration is further increased by using
the reentrant user-programming capability. This means that a sequence of instructions may be entered by more
than one user job at a time. Therefore, a single copy of a reentrant program may be shared by a number of users
at the same time to increase system economy. The FORTRAN compiler and operating system are both reentrant.

x

SECTION I
The PDP-10 FORTRAN IV Language
The seven chapters of this section deal with the PDP-10 FORTRAN IV language.
Included in these chapters are the language elements of FORTRAN IV and the
five categories of FORTRAN IV statements (arithmetic, control, input/output,
specification, and subprogram).

CHAPTER 1
INTRODUCTION TO THE FORTRAN LANGUAGE

The term FORTRAN IV (FORmula TRANslation) is used interchangeably to designate both the FORTRAN IV
language and the FORTRAN IV translator or compiler. The FORTRAN IV language is composed of mathematicalform statements constructed in accordance with precisely formulated rules.

FORTRAN IV programs consist of

meaningful sequences of FORTRAN statements intended to direct the computer to perform the specified operations
and computations.
The FORTRAN IV compiler is itself a computer program that examines FORTRAN IV statements and tells the computer how to translate the statements into machine language. The compiler runs in a minimum of 9K of core.
The program written in FORTRAN IV language is called the source program. The resultant machine language
program is called the object program.

Digital's small FORTRAN compiler, which runs in 5.5K of core, is vir-

tually identical to the larger compiler, except for differences explained in Appendix 2. Operating procedures
and diagnostic messages for both compi lers are explained in the PDP-10 System Users Guide (DEC-10-NGCC-D).

1. 1

LINE FORMAT

Each line of a FORTRAN program consists of three fields: statement number field, line continuation field, and
statement field.

1. 1. 1

A typical FORTRAN program is shown in Figure 1-1.

Statement Number Field

A statement number consists of from one to five digits in columns 1-5. Leading zeros and all blanks in this field
are ignored. Statement numbers may be in any order and must be unique. Any statement referenced by another
statement must have a statement number.

I

For source programs prepared on a teletypewriter, a horizontal tab may

be used to skip to the statement field with from

a through 5 characters in

the label field. This is the only place

a tab is not treated as a space.

1. 1.2

Line Continuation Field

If a FORTRAN statement is so large that it cannot conveniently fit into one statement field, the statement fields
of up to 19 additional lines may be used to specify the complete statement. Any line which is not continued, or
the first line of a sequence of continued lines, must have a blank or zero in column 6. Continuation lines must
Version 24 FORTRAN
Version 31 LIMO

1-1

October 1971

FORTRAN
~;r
.. ''''11M! .... '

(OIlINI.'dItM

--

---------------

;;R~:: S-T:::~--

-- --------- -

------------~:::=

~~

~2;. ~ ~€ ;-'O-,~ '~;l'4'~ ~~~§'-;m~51wrn~Jj-JiJS~i,~-J~!o;,~4~~~~8;;;o?-~~SJ;;-~-;6m;SU~~~-~-&~,~.~~~~n n]~~~
~-+-+- T-+-HL~-+~R.?+g~6M..f.tJfl!!-t\U~S+-!~,Il1t-~BIEIRIS,
r-+--+-+--.-+_-+"O,9..I J ,OI ,1,--,1"+'-1-1 5 1 '11 2 11 t II 1-+--+0++-""111111111

,°

,F,R,oM-..J+-l,. ,'L9.--.-~+++++__+_+_-~ :

: : :

H-+-+-+--+-+-+-+-+++++-++++++-+-+-+-

r:

1 1 1 1 1+

+-+-+-+--4---+-

t--+~_+-tJ,,-+-=+,I_+-+--+--+_~ I , I I ' ' I ' I I I I ' I I , I +-+-+-+-+-~-+-+--+-+--+-+-+--+--"+-+-+--+-+-+-+~+-T"""H--r-t--+-_"""--+--+--l
1"4,+-+--+-<---+--!,J+==+J,,-+~ +-+-+-+--+-+--+-+-+-+~,..,,--+-,-+-1-II-I>-+-I+-+-+-+ +-+---4-+-+-+-+-+-~+-."'_'--+-'~,,,,'H-I +--+--+- -+-+- +-+-+-+--+--+--+-+-~--+-+--+--+-1f-+-~--+-+-+-+-1
A=.J.

+t'-I+F+~I.I.(..
,B""I)'--+I.."",5",,'4-,-+,-,--1,."O"",-+-, ..,,,5...
, ~,..,,--+-,+1~I"'I--+-I-+-'--11--+-'+,~'--f'__
' +-1~'--+--"""--+-~--+-+-+-+-+-+--+--+-+--+--+-+--+-+-+-+-+-+-~--+-~--+-'"+~--+-+-+---+->--t
I F .( J .. L T.S.QRT .( FLOATU .l.ll .GO TO 4
-+-,

5

1 OS

TYPE

I

I

I

I

I

I

I

I

I

f'+LQ_"f~T'-+,114N4"u""e4-I--+I--fIH-1+1--+1-+1 +-+-+-+-+-+--t--t-t--+-+--+-+-+--'-+-++-+--+I~I"'IH-I+I~I--fl>-+-I+I-II---+-I+1...,-+-+--+-.....,__~--+-+--+----+-_~>-+-_++-T~---+-_---i
105

_114 'IS PRIME:'l

FORMAT

:NO

1 1'1 1'1'1'1

-+--+-t--+

-+-+-+-+-+-

I

I

"I

1

1 1-+-+-+-+-+-+1~'--f'--+-~--+-+I...,---+-+--.-+-+--+--+-+'-+--I~-+-,---+->-+-~--+-~--+-+-+~>-+----+--+-+--+-+-++-+--+--I--+--+-+--+-"""----+--i

f--++--+-+-t+-+-++-+++-+++-+-+-+-+--+-++++-+-+-+--'--+
I

I

I

,

1,

I

1 I

, 1-+-+-+-+--+-1

I 11

1 I I
1 1

1

I

1 I I I I "

1

I I

1

I

I

,

'I I I I I I I

I,

DIGITAL EQUIPMENT CORPORATION

PG - 3

Figure 1-1

I' I

•

1 ,

I

1

I

I I

I

I I

I I I ,

I +-++++++-H-+-t+-!----t--l---I--+-+----l+H

I I I I til'

I I

I

I I I t

MAYNARD. MASSACHUSETTS

I

I I

100 - 12/64

Typical FORTRAN Coding Form

have a character other thon blank or zero in column 6. If a continuation line is desired when a TAB is used in
the statement number field, a digit from 1 to 9 must immediately follow the TAB.

1. 1.3

Statement Field

Any FORTRAN statement, as described in later sections, may appear in the statement field (columns 7-72). Except for alphanumeric data within a FORMAT statement, DATA statement, or literal constant, blanks (spaces)
and TABS are ignored and may be used freely for appearance purposes. Thus the fo!lowing statements are equivalent.
END (tab) FILE (tab) 2
END (space) FILE (space) 2
ENDFILE2

Version 24 FORTRAN
Version 31 LIMO

1-2

October 1971

1. 1.4 Comment Line

I Any line that starts with one of the characters $ * / or the letter C in column 1 is interpreted as a line of comments. Comment lines are printed onto any listings requested but are otherwise ignored by the compiler. Columns 2-72 may be used in any format for comment purposes. A comment line must not immediately precede a
continuation line.

I

As an aid for program debugging, the letter 0 in column 1 causes the line to be interpreted as a comment unless
the /1 switch appears in the command string. (Refer to Table 11-1 for Compile Switch options.) If the /1 switch
is present, the letter 0 in column 1 is interpreted as a space and the line is compiled as a program statement.

1 .2

CHARACTER SET

The following characters are used in the FORTRAN IV language:
Blank

0

@

P

A

Q

II

2

B

R

#

3

C

S

$

4

0

T

%

5

E

U

&

6

F

V

7

G

W

8

H

X
y

9
J

*
+

/

Z

K

<

L

=

M

>

N

?

0

NOTE
ASCII characters greater than Z (132 8 ) are replaced by
the error character lit ". See Chapter 12 for the internal
representation of these characters.

Revision 2 FORTRAN

1-3

February 1971

CHAPTER 2
CONSTANTS, VARIABLES, AND EXPRESSIONS

The rules for defining constants and variables and for fonning expressions are described in this chapter.

2.1

CONSTANTS

Seven types of constants are permitted in a FORTRAN IV source program: integer or fixed point, real or singleprecision floating point, double-precision floating point, octal, complex, logical, and literal.

2. 1. 1 Integer Constants
An integer constant consists of from one to eleven decimal digits written without a decimal point. A negative
constant must be preceded by a minus sign. A positive constant may be preceded by a plus sign.
Examples:

3
+10
-528
8085

I

An integer constant must fall within the range _2 35+1 to 235 _1. When used for the value ofa subscript, the
value of the integer constant is taken as modulo 218.

2. 1.2

Rea I Constants

Real constants are written as a string of decimal digits including a decimal point. A real constant may consist
of any number of digits but only the leftmost 9 digits appear in the compiled program. Real constants may be
given a decimal scale factor by appending an E followed by a signed integer constant. The field following the
letter E must not be blank, but may be zero.
Examples:

15.
0.0

.579
-10.794
5. OE3{i.e., 5000.)
5. OE+3{i . e. , 5000)
5.0E-3{i.e., 0.005)
Revision 1 FORTRAN

2-1

October 1970

A real constant has precision to eight digits. The magnitude must lie approximately within the range
-38
38
O. 14 x 10
to 1.7 x 10 . Real constants occupy one word of PDP-lO storage.

2.1.3

Double Precision Constants

A double precision constant is specified by a string of decimal digits, including a decimal point, which are
followed by the letter D and a signed decimal scale factor. The field following the letter D must not be blank,
but may be zero.
Examples:

24.67132598213400
3.6D2 (i.e., 360.)
3.6D-2 (i.e., .036)
3.000

Double precision constants have precision to 16 digits. The magnitude of a double precision constant must lie
. t e Iy be tween 0 . 14 x 10-38 and 1.7 x 1038 . Do ubl e-preclslon
. . constants occupy two wor dsof PDP - 10
approxlma
storage.

2.1.4

Octal Constants

A number preceded by a double quote represents an octal constant. An octal constant may appear in an arithmetic or logical expression or a DATA statement. Only the digits 0-7 may be used and only the last twelve
digits are significant. A minus sign may precede the octal number, in which case the number is negated. A
maximum of 12 octal digits are stored in each 36-bit word.
Examples:

2.1.5

"7777
"-31563

Complex Constants

FORTRAN IV provides for direct operations on complex numbers. Complex constants are written as an.ordered
pair of real constants separated by a comma and enclosed in parentheses.
Examples:

(.70712, -.70712)
(8. 763E3,2 .297)

The first constant of the pair represents the real part of the complex number, and the second constant represents
the imaginary part. The real and imaginary parts may each be signed. The enclosing parentheses are part of
the constant and always appear, regardless of context. Each part is internally represented by one singleprecision floating point word. They occupy consecutive locations of PDP-I0 storage.

2-2

FORTRAN IV arithmetic operations on complex numbers, unlike normal arithmetic operations, must be of the
form:
A±B = a 1:±b 1+i(a2 :±b 2 )
A*B = (albl-a2b2)+i(a2bl+alb2)
(a Ib 1+a 2b 2 ) +i (a 2b l-a I b2)
A/B=
2
2
2
2
b 1 +b2
b 1 +b 2
where A = a 1 + ia 2 , B = b 1 + ib 2 , and i = F

2.1.6

Logical Constants

The two logical constants, . TRUE. and .FALSE. , have the internal values -1 and 0, respectively. The enclosing periods are part of the constant and always appear.
Logical constants may be entered in DATA or input statements as signed octal integers (-1 and 0). Logical
quantities may be operated on in either arithmetic or logical statements. Only the sign is tested to determine the
truth value of a logical variable.

2. 1. 7

li tera I Constants

A literal constant may be in either of two forms:
a. A string of alphanumeric and/or special characters enclosed in single quotes; two adjacent single
quotes within the constant are treated as one single quote.
b.

A string of characters in the form
nHx 1x 2 "· .x n

where x 1x 2 " •• x n is the literal constant, and n is the number of characters following the H.
literal constants may. be entered in DATA statements or input statements as a string of up to 5 7-bit ASCII characters per variable (10 characters if the variable is double-precision or complex). literal constants may be
operated on in either arithmetic or logical statements.
NOTE
literal constants used as subprogram arguments will have a
zero word as an end-of-string indicator.

2-3

txamples:

LALL ::>UIj

~

L1ltKAL LUI'\I::> 1A 1'\1 1 )

'DONT"T'
5HDON'T
A = 'FIVE' + 42
B = (5HABCDE .AND. "376)/2

2.2

VARIABLES

A variable is a quantity whose value may change during the execution of a program. Variables are specified
by name and type. The name of a variable consists of one or more alphanumeric characters, the first one of
which must be alphabetic. Only the first six characters are interpreted as defining the variable name. The
type of variable (integer, real, logical, double precision, or complex) may be specified explicitly by a type
declaration statement or implicitly by the IMPLICIT statement. If the variable is not specified in this manner,

I

then a first letter of I, J, K, L, M or N indicates a fixed point (integer) variable; any other first letter indicates a floating-point (real) variable. Variables of any type may be either scalar or array variables. When used
in a subscript or as an index to a DO Statement, the value of the integer variable is taken as modulo 2 18 .

2.2.1

Scalar Variables

A scalar variable represents a single quantity.
Examples:

A
G2
POPULATION

2.2.2

Array Variables

An array variable represents a single element of an n dimensional array of quantities. The variable is denoted
by the array name followed by a subscript list enclosed in parentheses. The subscript list is a sequence of integer expressions, separated by commas. The expressions may be of any form or type providing they are explicitly
changed to type integer when each is completely evaluated. Each expression represents a subscript, and the
values of the expressions determine the array element referred to. For example, the row vector A. would be
I

represented by the subscripted variable A(J), and the element, in the second column of the first row of the square
matrix A, would be represented by A(l ,2). Arrays may have any number of dimensions.
Examples:

V(l)
STATION (K)
A (3* K+2, I, J-1)

The three arrays above (V, STATION, and A) would have to be dimensioned by a DIMENSION, COMMON,
or type declaration statement prior to their first appearance in an executable statement or in a DATA or
NAMELIST statement. (Array dimensioning is discussed in Chapter 6).

Revision 1 FORTRAN

2-4

October 1970

l-Dimensional Array

A(lO)

I

A( I ) ,A( 2)

I I
A( 3)

A(4) , A(S)

I

A(6) ,A(7)

I

A(8), A(9) , AlIO) ,

CONSECUTIVE STORAGE LOCATIONS

2-Dimensional Array

B(5,5)
I

6( 1,1) 6

2

6(2,1 ) 7 6(2,2) 12 6(2,3) 17 6(2,4) 22 6(2,S)

3 6(3,1)

6(1,2 ) II

6(1,3) 16 6( 1,4) 21

6(I,S)

8

6(3,2 ) 13 6(3,3) 18 6(3,4) 23 6(3,S)

4

6(4,1 ) 9

6(4,2) 14 6(4,3) 19 6(4,4) 24 6(4,S)

S

6(S,I) 10 6(S,2) IS 6(S,3) 20 6(S,4) 21 6(S,S)
6(3,1) IS THE THIRD STORAGE WORD IN SEQUENCE
6( 3,4) IS THE EIGHTEENTH STORAGE WORD

3-Dimensional Array

C(5, 5, 5)

76 C(I,I,4) 81
77 C(2,I,4) 82
SI

CU,I, 3) S6 C(I,2,3) 61
S2 C(2,I,3) S7 C(2,2,3I 62
26
27
I
2
3
4
5

C(I I I )
C(2,I,I)
C(3,I,I)
C{4,1 I)
C(S,I,I)

IN SEQU ENCE

CU,I,2) 31
C(2J,2) 32
6 W,2 I) II
7 C(2,2,1l 12
8
C(3,2,1) 13
C{42 I) 14
9
10 C(S,2,1) 15

C!I,2,21 36
C{2 2 2) 37
C(I,3 I) 16
C(2,3,1) 17
C(3,3,1) 18
C(43 I) 19
C(S,3,1) 20

C{I,3,2 )
C{2.3.2 )
C(l4 I)
C(2,4,1)
C(34 I)
C(44 I)
C{S,4,1)

101 W,I,S) 106 C( 1,2,S) III C( 1,3,S) 116 W,4,S) 121 C(I,S,S)
102 C(2,I,S) 107 C(2,2,5) 112 C(23,S) 117 C(2,4,S) 122 C(2,S,S)
C(144) 96 ClI,5 4) 118 C(3,4,S) 123 C(3,S,S)
C(I,2,4) 86 C(i,3,4) 91
C(2,2,4 ) 87 C(2,3,41 92 C(2,4,41 97 C(2,5,4) 119 C(4,4,S) 124 C(4,S,S)
98 C(3,S,4 ) 120 C(S,4,S) 12S C(S,5,S)

C(I,3,3) 66 C(I,4,3) 71

C(I,5,3)

C(2,3,3) 67

C(2,5,31 99 C(4,S,4)

Cl2,4,31 72

41 C(I,4,2) 46 C(I,S,2)
42 C(242) 47 C(2,S,2)
21 C(I S I ) 48 C(3,S,2)
22 C(2,S,I) 49 C(4,S,2)
23 C(3 SI)
SO C(5,S,2)
24 C(451)
2S C{S,S,I)

73 C( 3,S,3) 100 C(5,S,4)
74

C(4,S,3)

7S

C(5,S,3 )

C(l ,3, 2) is the 36th storage word in sequence,
C(l, 1,5) is the lOlst storage word in sequence.

Figure 2-1

Array Storage

2-5

Arrays are stored in increasing storage locations with the first subscript varying most rapidly and the last subscript
varying least rapidly. For example, the 2-dimensional array B(I,J} is stored in the following order: B (1,1),
B (2,1}, ... , B (I, l},B (l,2},B (2,2), ... ,B (I,2}, ... ,B (I,J).

2.3

EXPRESSIONS

Expressions may be either numeric or logical. To evaluate an expression, the object program performs the
calculations specified by the quantities and operators within the expression.

2.3. 1

Numeric Expressions

A numeric expression is a sequence of constants, variables, and function references separated by numeric
operators and parentheses in accordance with mathematical convention and the rules given below.
The numeri c operators are +, -, *, /, **, denoting, respectively, additi on, subtraction, multipl i cati on,
division, and exponentiation.

In addition to the basic numeric operators, function references are also provided to facilitate the evaluation
of functions such as sine, cosine, and square root. A function is a subprogram which acts upon one or more
quantities, called arguments, to produce a single quantity called the function value. Function references are
denoted by the identifier, which names the function (such as SIN, COS, etc.), followed by an argument list
encl osed in parentheses:
identifier(argument, argument, ... , argument}
At least one argument must be present. An argument may be an expression, an array identifier, a subprogram
identifier, or an alphanumeric string.
Function type is given by the type of the identifier which names the function. The type of the function is independent of the types of its arguments. (See Chapter 7, Section 7.4.1. 1.)
A numeric expression may consist of a single element (constant, variable, or function reference):
2.71828
Z(N}
TAN(THETA}
Compound numeric expressions may be formed by using numeric operations to combine basic elements:
X+3.
TOTAL/A
TAN(PI*M}
(X+3.) -(TOTAL/A) * TAN (PI*M)

2-6

Compound numeric expressions must be constructed according to the following rules:
a. With respect to the numeric operators +, -, *, I, any type of quantity {logical, octal, integer,
real, double precision, complex or literal) may be combined with any other, with one exception:
a complex quantity cannot be combined with a double precision quantity.
The resultant type of the combination of any two types may be found in Table 2-1. The conversions
between data types will occur as follows:
(1) A literal constant will be combined with any integer constant as an integer and with a real
or double word as a real or double word quantity. (Double word refers to both double precision
and complex:)
(2) An integer quantity (constant, variable, or function reference) combined with a real or double
word quantity results in an expression of the type real or double word respectively; e.g., an integer
variable plus a complex variable will result in a complex subexpression. The integer is converted
to floating point and then added to the real part of the complex number. The imaginary part is
unchanged.
(3) A real quantity (constant, variable, or function reference) combined with a double word quantity results in an expression that is of the same type as the double word quantity.

A logical or octal quantity is combined with an integer, real, or double word quantity as if
it were an integer quantity in the integer case, or a real quantity in the real or double word case
(i .e., no conversion takes place).

(4)

b.

Any numeric expression may be enclosed in parentheses and considered to be a basic element.

(x+Y)/2
(ZETA)
(COS(SI N(PI* M)+X))
Table 2-1
Types of Resultant Subexpressions
Type of Quantity

+,-,*,/

Type of
Quantity

Real

Integer

Complex

Double
Precision

Logical,
Octal, or
Litera I

Real

Real

Real

Complex

Double
Precision

Real

Integer

Real

Integer

Complex

Double
Precision

Integer

Complex

Complex

Complex

Complex

Not
Allowed

Complex

Double
Precision

Double
Precision

Double
Precision

Not
Allowed

Double
Precision

Double
Precision

Logical,
Octal, or
Literal

Real

Integer

Complex

Double
Precision

Logical,
Octal, or
Literal

2-7

c.

Numeric expressions which are preceded by a + or - sign are also numeric expressions:

+x
-(ALPHA *BET A)
-SQRT( -GAMMA)
d. If the precedence of numeric operations is not given explicitly by parentheses, it is understood
to be the following (in order of decreasing precedence):
Operator

Explanation

**

numeric exponentiation

*and/

numeric multiplication and division

+and-

numeric addition and subtraction

In the case of operations of equal hierarchy, the calculation is performed from left to right.
e.

No two numeric operators may appear in sequence. For instance:

x*-y
is improper.

Use of parentheses yields the correct form:

x*(-y)
By use of the foregoing rules, all permissible numeric expressions may be formed. As an example of a typical
numeric expression using numeric operators and a function reference, the expression for one of the roots of the
general quadratic equation:
-b+ .Jb 2 - 4ac

20
would be coded as:
(-B+SQRT(B **2-4. *A *C))/(2. *A)

2.3.2

Logical Expressions

A logica I expression consi sts of constants, variab les, function references, and arithmeti c expressions, separated
by logical operators or relational operators. Logical expressions are provided in FORTRAN IV to permit the implementation of various forms of symbolic logic. Logical masks may be represented by using octal constants.
The result of a logical expression has the logical value TRUE (negative) or FALSE (positive or zero) and therefore,
only uses one word.

Version 24 FORTRAN
Version 31 LIB40

2-8

October 1971

2.3.2.1

I

Logical Operators - The logical operators, which include the enclosing periods and their definitions,

are as follows, where P and Q are expressions:
• NOT.P

Has the value. TRUE. only if P is .FALSE., and has the
value .FALSE. only if P is • TRUE.

P.AND.Q

Has the value. TRUE. only if P and Q are both. TRUE.,
and has the value .FALSE. if either P or Q is .FALSE.

P.OR.Q

(Inclusive OR) Has the value .TRUE. if either P or Q is .TRUE.,
and has the value .FALSE. only if both P and Q are .FALSE.

P.XOR.Q

(Exclusive OR) Has the value. TRUE. if either P or Q but not
both are .TRUE., and has the value .FALSE. otherwise.

P.EQV.Q

(Equivalence) Has the value. TRUE. if P and Q are both
• TRUE. or both .FALSE., and has the value .FALSE. otherwise.

I

Logical expressions are evaluated by combining the full word values of P and Q (only the high-order part if P

and Q are double precision, only the real part if P and Q are complex) using the appropriate logical operator.

The result is TRUE if it is arithmetically negative and FALSE if it is arithmetically positive or zero.
Logical operators may be used to form new variables, for example,
X'" Y .AND.Z
E '" E. XOR. "400000000000

2.3.2.2

Relational Operators - The relational operators are as follows:
Operator

Relation

.GT.

greater than

.GE.

greater than or equal to

. LT.

less than

. LE.

less than or equal to

.EQ.

equal to

.NE.

not equal to

The enclosing periods are part of the operator and must be present.
Mixed expressions involving integer, real, and double precision types may be combined with relationals.

I

The value of such an expression will be .TRUE. (-1) or .FALSE. (0).
The relational operators .EQ. and. NE. may also be used with COMPLEX expressions. (Double word quantities
are equa I if the correspondi ng parts are equa I. )

Version 24 FORTRAN
Version 31 L1B40

2-9

October 1971

A logical expression may consist of a single element (constant, variable, function reference, or re iation):
.TRUE.
X.GE.3.141S9
Single elements may be combined through use of logical operators to form compound logical expressions, such as:
TVAL.AND.INDEX
BOOl(M). OR. K.EQ.LIMIT
Any logical expression may be enclosed in parentheses and regarded as an element:
(T .XOR. S).AND.(R.EQV. Q)
CALL PARITY ((2.GT.Y .OR.X.GE. Y).AND. NEVER)
Any logical expression may be preceded by the unary operator. NOT. as in:
· NOT. T
· NOT.X+7.GT.Y+l
BOOL{K). AN D•. NOT. (TVAL. OR. R)
No two logical operators may appear in sequence, except in the case where. NOT. appears as the second of
two logical operators, as in the example above. Two decimal points may appear in sequence, as in the
example above, or when one belongs to an operator and the other to a constant.
When the precedence of operators is not given explicitly by parentheses, it is understood to be as follows (in
order of decreasing precedence):
**

*,/
+,· G T. , . GE. , . LT. , . LE. , • EQ. , . NE.
.NOT .
. AND •
. OR .
. EQV., .XOR.
For example, the logical expression
· NOT. lETA**2+Y*MASS.GT.K-2. OR. PARITY .AND.X.EQ.Y
is interpreted as
(. NOT. (((lET A**2)+(y*MASS». GT. (K-2))). OR. (PARITY .AND.(X .EQ. V»~

2-10

CHAPTER 3
THE ARITHMETIC STATEMENT

3.1

GENERAL DESCRIPTION

One of the key features of FORTRAN IV is the ease with which arithmetic computations can be coded. Computations to be performed by FORTRAN IV are indicated by arithmetic statements, which have the general form:
A=B
where A is a variable, B is an expression, and = is a replacement operator. The arithmetic statement causes the
FORTRAN IV object program to evaluate the expression B and assign the resultant value to the variable A.
Note that the = sign signifies replacement, not equality. Thus, expressions of the form:
A=A+B and
A=A*B
are quite meaningful and indicate that the value of the variable A is to be replaced by the result of the expression to the right of the = sign.
Examples:

Y=l*Y
P=. TRUE.
X (N}=N*ZETA(ALPHA*M/PI)+(l . ,-1.)

Table 3-1 indicates which type of expression may be equated to each type of variable in an arithmetic statement.
D indicates that the assignment is performed directly (no conversion of any sort is done); R indicates that only
the real part of the variable is set to the value of the expression (the imaginary part is set to zero); C means that
the expression is converted to the type of the variable; and H means that only the high-order portion of evaluated
expression is assigned to the variable.
The expression value is made to agree in type with the assignment variable before replacement occurs.

For ex-

ample, in the statement:
THET A=W*(ABET A+E}
if THETA is an integer and the expression is real, the expression value is truncated to an integer before assignment to THETA.

3-1

Table 3-1
Allowed Assignment Statements
Expression
Logical,
Octal, or
Literal
Constant

Real

Integer

Complex

Double
Precision

Real

D

C

R,D

H,D

D

Integer

C

D

R,C

H,C

D

Complex

D, R,I

C,R,I

D

H, D,R,I

D, R,I

Double
Precision

D,H,L

C,H,L

R,D,H,L

D

D,H,L

D

R,D

H,D

Variable

Logical

D

D - Direct Replacement
C - Conversion between integer and floating point
R - Real only
- Set imaginary part to 0
H - High order only
L - Set low order part to 0

3-2

D

CHAPTER 4
CONTROL STATEMENTS

FORTRAN compiled programs normally execute statements sequentially in the order in which they were presented
to the compiler. However, the following control statements are available to alter the normal sequence of statement execution: GO TO, IF, DO, PAUSE, STOP, END, CALL, RETURN. CALL and RETURN are used to enter and retum from subroutines.

4.1

GO TO STATEMENT

The GO TO statement has three forms: unconditional, computed, and assigned.

4.1.1

Unconditional GO TO Statements

Unconditional GO TO statements are of the form:
GO TO n
where n is the number of an executable statement. Control is transferred to the statement numbered n. An unconditional GO TO statement may appear anywhere in the source program, except as the terminal statement of
a DO loop.

4.1.2

Computed GO TO Statements

Computed GO TO statements have the form:

where n 1 ' n 2 , ... , nk are statement numbers, and i is an integer expressi on.
This statement transfers control to the statement numbered n 1 ,n 2 , ... ,n k if i has the value 1,2, ... ,k, respectively. If i exceeds the size of the list of statement numbers or is less than one, execution will proceed to the
next executable statement. Any number of statement numbers may appear in the list. There is no restriction on
other uses for the integer variable i in the program.

4-1

In the example
GO TO (20,10,5),K
the variable K acts as a switch, causing a transfer to statement 20 if K=l, to statement 10 if K=2, or to statement 5 if K=3.
A computed GO TO statement may appear anywhere in the source program, except as the terminal statement of
a DO loop.

4.1.3

Assigned GO TO Statement

Assigned GO TO statements have two equivalent forms:
GO TO k
and

I

where k is a variable or array element and n l' n 2 , ••. n k are statement numbers. Any number of statement numbers

I

may appear in the list.

Both forms of the assigned GO TO have the effect of transferring control to the statement

whose number is currently associated with the variable k. The second form of the assigned GO TO statement passe
control to the next executable statement if k is not associated with one of the statement numbers in the list. This

association is established through the use of the ASSIGN statement, the general form of which is:
ASSIGN iTO k

I

where i is a statement number and k is a variable or array element. If more than one ASSIGN statement refers to
the same integer variable name, the value assigned by the last executed statement is the current value.

Examples:

ASSIGN 21 TO INT

ASSIGN 1000 TO INT

GO TO INT

GO TO INT, (2,21,1000,310)

An assigned GO TO statement may appear anywhere in the source program, except as the terminal statement of
a DO loop.

4.2

IF STATEMENT

IF statements have two forms in FORTRAN IV: numerical and logical.

Version 24 FORTRAN
Version 31 LIB40

4-2

October 1971

4.2.1

Numerical IF Statements

Numerical IF statements are of the form:

where n 1,n 2 ,n 3 are statement numbers. This statement transfers control to the statement numbered n 1 ,n 2 ,n 3 if
the value of the numeric expression is less than, equal to, or greater than zero, respectively. All three statement numbers must be present. The expression may not be complex.
Examples:

4.2.2

IF (ETA) 4,7,12
IF (KAPPA-L (10)) 20,14,14

Logical IF Statements

Logical IF statements have the form:
IF (expression)S
where S is a complete statement. The expression must be logi cal. S may be any executable statement other than
a DO statement or another logical IF statement (see Chapter 2, Section 2.3.2). If the value of the expression is
.FALSE. (positive or zero), control passes to the next sequential statement. If value of the expression is .TRUE.
(negative), statement S is executed. After execution of 5, control passes to the next sequential statement unless

5 is a numerical IF statement or a GO TO statement; in these cases, control is transferred as indicated. If the
expression is • TRU E. (negative) and 5 is a CALL statement, control is transferred to the next sequential statement upon return from the subroutine.
Numbers are present in the log ica I expression:
IF (B)Y=X *SIN (Z)
W=Y**2

If the value of B is . TRUE., the statements Y=X*SIN(Z) and W=Y**2 are executed in that order. If the value of
B is .FALSE., the statement Y=X*SIN(Z) is not executed.
Examples:

IF (T. OR. S)X=Y+ 1
IF (Z.GT.X(K)) CALL SWITCH (S,Y)
IF (K .EQ.INDEX) GO TO 15
NOTE
Care should be taken in testing floating point numbers
for equality in IF statements as rounding may cause
unexpected resu I ts.

Version 24 FORTRAN
Version 31 LIB40

4-3

February 1971

4.3

DOSTATEMENT

The DO statement simplifies the coding of iterative procedures. DO statements are of the form:

where n is a statement number, i is a nonsubscripted integer variable, and m1,m 2 ,m 3 are any integer expressions.
If m3 is not specified, it is understood to be 1.
The DO statement causes the statements which follow, up to and including the statement numbered n, to be executed repeatedly. This group of statements is called the range of the DO statement. The integer variable i of
the DO statement is called the index. The values of m1,m 2 , and m3 are called, respectively, the initial, limit,
and increment values of the index.
A zero increment (m 3 ) is not allowed. The increment m3 may be negative if m1~m2. If m1~m2' the increment
m3 must be positive. The index variable can assume legal values only if (m2-mi)*m3~0 .. (m i is the current value
of the index variable m1 .)
Examples:

Form

Restri cti on

DO 101=1,5,2
DO 10 1=5, 1, - 1
DO 10 I=J, K, 5

JK

DO 10 L=I, J, -K

IJ,K>O

DO 10 L=I, J, K

IO or I>J,K>O

-

-

-

-

Initially, the statements of the range are executed with the initial value assigned to the index. This initial execution is always performed, regardless of the values of the limit and increment. After each execution of the
range, the increment value is added to the value of the index and the result is compared with the limit value.
If the value of the index is not greater than the limit value, the range is executed again using the new value

of the index. When the increment value is negative, another execution will be performed if the new value of
the index is not less than the limit value.
After the last execution of the range, control passes to the statement immediately following the range. This
exit from the range is called the normal exit. Exit may also be accomplished by a transfer from within the range.
The range of a DO statement may include other DO statements, provided that the range of each contained DO

I

statement is entirely within the range of the containing DO statement. When one DO loop is completely contained in another, it is said to be nested. DO loops can be nested to any depth. A transfer into the range of
a DO statement from outside the range is not allowed.

Version 24 FORTRAN
Version 31 LIB40

4-4

October 1971

More than one DO loop within a nest of DO loops can end on the same statement. This terminal statement is
considered to belong to the innermost DO loop that ends on the terminal statement. The statement label of
such a terminal statement cannot be used in any GO TO or arithmetic IF statements except those that occur
within the DO loop to which the terminal statement belongs.

Version 24 FORTRAN
Version 31 LIB40

4-40

October 1971

Va I id DO Loop Nest

Invalid DO Loop Nest

B I,---A_ __
B

C

A

C

Control must not pass from within loop A
or loop B into loop D, or from loop D into
loop A or loop B.
Figure 4-1

Loop C is not fully within the range of
loop B even though it is within the range
of loop A.
Nested DO Loops

Within the range of a DO statement, the index is available for use as an ordinary variable. After a transfer
from within the range, the index retains its current value and is available for use as a variable. The value of
the index variable becomes undefined when the DO loop it controls is satisfied. The values of the initial, limit,
and increment variables for the index and the index of the DO loop, may not be altered within the range of the
DO statement.
The range of a DO statement must not end with a GO TO type statement or a numeri cal IF statement. If an
assigned GO TO statement is in the range of a DO loop, all the statements to which it may transfer must be
either in the range of the DO loop or all must be outside the range. A logical IF statement is allowed as the
last statement of the range. In this case, control is transferred as follows. The range is considered ended when,
and if, control would normally pass to the statement following the entire logical IF statement.
As an example, consider the sequences:
DO 5 K = 1,4
5 IF(X(K).GT. Y(K))Y(K) = X(K)

6 ...
Statement 5 is executed four times whether the statement Y(K) = X(K) is executed or not.
ecuted unti I statement 5 has been executed four times.

4-5

Statement 6 is not ex-

DO 22 L -, 1,30
DO 45 K =- 2, LIMIT,-3
DO 7 X = T, MAX , L

Examples:

4.4 CONTINUE STATEMENT
The CONTINUE statement has the form:
CONTINUE
This statement is a dummy statement, used primarily as a target for transfers, particularly as the last statement in
the range of a DO statement. For example, in the sequence:
DO 7 K = START, END

IF (X (K))22, 13,7
7

CONTINUE

a positive value of X(K) begins another execution of the range. The CONTINUE provides a target address for
the IF statement and ends the range of the DO statement.

4.5

PAUSE STATEMENT

The PAUSE statement enables the program to incorporate operator activity into the sequence of automati c events.
The PAUSE statement assumes one of three forms:
PAUSE
PAUSE n
PAUSE 'xxxxx'
where n is an unsigned string of six or less octal digits, and 'xxxxx' is a literal message.
Execution of the PAUSE statement causes the message or the octal digits, if any, to be typed on the user's teletypewriter. Program execution may be resumed (at the next executable FORTRAN statement) from the console
by typing "G," followed by a carriage return. Program execution may be terminated by typing "X,
by carriage return.
Example:

PAUSE 167
PAUSE 'NOW IS THE TIME'

4-6

11

followed

4.6

STOP STATEMENT

The STOP statement has the forms:
STOP
STOP n

I

or

where n is an unsigned string of one to five octal digits.
The STOP statement terminates the program and returns control to the monitor system. (Termination of a program

I

may also be accomplished by a CAll to the EXIT or DUMP subroutines.) Use of the STOP statement implies a
call to the EXIT subroutine.

4.7

END STATEMENT

The END statement has the form:
END
The END statement informs the compiler to terminate compilation and must be the physically last statement of

I

the program. The END statement implies a STOP statement in a main program or a RETURN statement in a subroutine or a function. The END statement is implied by an end-of-file.

Revision 1 FORTRAN

4-7

October 1970

CHAPTER 5
DATA TRANSMISSION STATEMENTS

Data transmission statements are used to control the transfer of data between computer memory and either
peripheral devices or other locations in computer memory. These statements are also used to specify the format
of the output data.

Data transmission statements are divided into the following four categories.

a. Nonexecutable statements that enable conversions between internal form data within core memory
and external form data (F ORMAT), or specify lists of arrays and variables for input/output transfer
(NAME LIST).
.
b. Statements that specify transmission of data between computer memory and
WRITE, PRINT, PUNCH, TYPE, ACCEPT.

I/o devices:

READ,

c. Statements that control magnetic tape unit mechanisms: REWIND, BACKSPACE, END FILE,
UNLOAD, SKIP RECORD.
d. Statements that specify transmission of data between series of locations in memory: ENCODE,
DECODE.

5. 1

NONEXECUT ABLE ST ATEME NTS

The FORMAT statement enables the user to specify the form and arrangement of data on the selected external
medium. The NAME LIST statement provides for conversion and input/output transmission of data without
reference to a FORMAT statement.

5. 1. 1

FORMAT Statement

FORMAT statements may be used with any appropriate input/output medium or ENCODE/DECODE statement.
FORMAT statements are of the form:

where n is a statement number, and each S is a data fie Id specification.
FORMAT statements may be placed anywhere in the source program. Unless the FORMAT statement contains
only alphanumeric data for direct input/output transmission, it will be used in conjunction with the list of a
data transmission statement.

5-1

Slashes are used to specify unit records, which must be one of the following:
a.

A tape or disk record with a maximum length corresponding to a line buffer (135 ASCII characters).

b.

A punched card with a maximum of 80 characters.

c. A printed line with a maximum of 72 characters for a Teletype ®and either 120 or 132 characters
for the line pri nter .
During transmission of data, the object program scans the designated FORMAT statement.

If a specification

for a numeric field is present (see Section 5.2.1 of this chapter) and the data transmission statement contains
items remaining to be transmitted, transmission takes place according to the specifications.

This process ceases

and execution of the data transmission statement is terminated as soon as all specified items have been transmitted.
Thus, the FORMAT statement may contain specifications for more items than are specified by the data transmission statement. Conversely, the FORMAT statement may contain specifications for fewer items than are specified
by the data transmission statement.
The following types of field specifications may appear in a FORMAT statement: numeric, numeric with scale
factors, logical, alphanumeric. The FORMAT statement also provides for handling multiple record formats,
formats stored as data, carriage control, skipping characters, blank insertion, and repetition. If an input list
requires more characters than the input device supplies for a given unit record, blanks are supplied.

5.1.1.1

Numeric Fields - Numeric field specification codes designate the type of conversion to be performed.

These codes and the corresponding internal and external forms of the numbers are listed in Table 5-2.
The conversions are specified by the forms:

1.

2.
3.
4.
5.
6.

Dw.d
Ew.d
Fw.d
Iw
Ow
Gw.d
Gw
Gw.d,Gw.d

(for real or double precision)
(for integer or logical)
(for complex)

respectively. The letter D, E, F, I, 0, or G designates the conversion type; w is an integer specifying the
field width, which may be greater than required to provide for blank columns between numbers; d is an integer
specifying the number of decimal places to the right of the decimal point or, for G conversion, the number of
significant digits. (For D, E, F, and G input, the position of the decimal point in the external field takes
precedence over the value of d in the format.)

® Teletype is a registered trademark of Teletype Corporation.

5-2

For example,
FORMAT (I5,F 10. 2, D18. 10)
could be used to output the line,
bbb32bbbb-17.60bbb.5962547681D+03
on the output listing.
The G format is the general format code that is used to transmit real, double precision, integer, logical, or
complex data. The rules for input depend on the type specification of the corresponding variable in the data
list. The form of the output conversion also depends on the individual variable except in the case of real and
double-precision data. In these cases the form of the output conversion is a function of the magnitude of the
data being converted. The following table shows the magnitude of the external data, M, and the resulting
method of conversion.

Table 5-1
Magnitude of Internal Data
Magnitude of Data

Resulting Conversion

O.l~Mlk1/a ,b/blk2/c,d/ •••

6.1.2

COMPLEX a{n 1,n2 , ••• ),b("3,n4 , ••• ), •••

6.3

DATA t,u, ••• ;1<1,k 2 ,k 3 , •• '/

6.2.1

v ,w, ... ;1<4,k 5 ,k 6 , •• '/•••

Revision 2 FORTRAN

7-8

February 1

DIMENSIO N a(n 1 ,n2 , ••• ) ,b(n 1,n2 , ••• ), •••
DOUBLE PRECISION a(n 1 ,n2 , ••• ),b(n3 ,n4 , ••• ), •••

6.1.1

EQUIVALENCE (a(n 1 , ••• ),b(n2 , ••• ), ••• ), •••

6.1.3

6.3

(c(n3 ,···),d(n4 ,···),···),···

7.7

EXTERNAL y, z, •••
IMPLICIT type 1(11-1

i ,type2 (13-14)'···

6.3.1

INTEGER a(n 1 ,n 2 , ••• ) ,b(n3 ,n4 , ••• ), •••

6.3

LOGICAL a(n 1 ,n 2 ,· •• ) ,b(n3 , n4 ,· •• ), •••

6.3

NAMELIST /name /a,b, ••• /name/c,d, •••

5.1.2

REAL a(n 1,n2 , ••• )b(n3 ,n4 , ••• ), •••
SUBSCRIPT INTEGER a(n 1 ,n2 , ••• ),b(n3 , ••• ), •••

6.3
6.3

ARITHMETIC STATEMENT FUNCTION DEFINITION
General Form

Section Reference

7.3

name(a,b, ••• )=e
NOTE:

I

a 1,a 2 ,···
a,b,c,d

are expressions

blkl,blk2

are block names

c

is the statement number to which
control is transferred upon encountering an end-of-file

d

is the statement number to which
control is transferred upon encountering an error condition on
the input data.

e

is an expression

are variable names

is a noncomplex expression
is a logical expression
is a format number
g

is a format specification

Ihl

is an alphanumeric
are statement numbers
is an integer constant
are constants of the general form i*k
where k is any constant
are letters

Revision 2 FORTRAN

7-9

February 1971

Section Reference

General Form
list

is an input/output list

m

is an integer variable name

m1 ,m 2 ,m3

are integer expressions

n 1 ,n2 ,···

are dimension specifications

n

are the number of ASCII characters

name

is a subroutine or function name
are NAME LIST names
is a record number where

VO begins

s

is a statement (not DO or logical IF)

t,u,v,w

are variable names or input/output lists

type l' type 2 , •••

are type specifications

unit

is an integer variable or constant specifying
a logical device number

v

is the starting address of the ASCII record
referenced

y,z

are external subprogram names

7-10

SECTION II
THE RUN TIME SYSTEM
The five chapters of this section contain information on LIMO, SUBPROGRAM
calling sequences, accumulator usage, compiler switches and diagnostic messages,

I

and FORTRAN user programmi ng.

Revision 1 FORTRAN

October 1970

CHAPTER 8
L1B40

L1B40 is a single file which contains all of the programs in the FORTRAN library. It is composed of three groups
of programs:
(1)

The FORTRAN Operating System.

(2)

Science Library.

(3)

FORTRAN Uti Iity Subprograms.

I

There are two forms of LlB40, one for the KA-l0 and the other for the KI-l0. The KA-l0 library will run on the
KI-l0, but will not take advantage of the speed of the KI-l0. The KI-l0 library will not run on the KA-l0 be-

cause of the hardware differences. Also, the library used must match the compiler used, i.e., KA-l0 compiled
code must use the KA-l0 LlB40 and the KI-l0 compiled code must use the KI-10 LlB40.

8.1

THE FORTRAN OPERATING SYSTEM

The system programs in the FORTRAN Operating System act as the interface between the user's program and the
PDP-l0. All of these programs are invisible to the user's program. The FORTRAN Operating System is loaded
automatically from LIB40 and resides in the user's core area along with the user's main programs and any library
functions and subroutines that his programs reference.

8.1.1

FORSE.

FORSE. is the main program of the FORTRAN Operating System and is loaded whenever a FORTRAN main program is in core •. The primary functions of FORSE. are
a.

FORMAT statement processing,

b.

Dispatching of all UUOs, and

c.

Control of I/O devices at runtime.

8.1.1.1

FORMAT Processing - FORSE. assumes that all FORMAT statements are syntactically correct since the

syntax of each statement is checked by the compi ler. FORSE. scans the FORMAT statements and performs the
indicated I/O operations. FORSE. invokes the required conversion routine to actually do data conversion. The
conversion routine that is used is a function of the conversion indicated in the FORMAT statement and of the
data type of the element in the I/O list.
Version 26 FORTRAN
Version 32 LlB40

8-1

May 1972

8.1.1.2

UUO Dispatching - Some UUOs are handled minimally by FORSE. (NLIN, NLOUT, MTOP), but the

others are handled almost entirely within FORSE.

8. 1. 1 .3

I/O Devi ce Control - FO RSE. executes the requi red carriage control of output devi ces that are phys-

ical Iisting devices (LPT, TTY) and stores the carriage control character at the beginning of each line if the output is going to a retrievable medium for deferred listing. When listings are deferred, the appropriate switch in
PIP can be used to list the file and execute the required carriage control.

8. 1. 1.4

Additional Functions of FORSE. - FORSE. is responsible for the following:

a.

Control of REREAD and ENCO DE/DECODE features.

b.

Interaction with EOFTST and READ (unit,f,END=C)list to handle end-of-file testing.

c.

Control of the assignment of devices to software channels.

d.

Control of the handling of filenames for I/O associated with directory devices.

e.

Control of the opening and closing of data files.

f. Control the handling of the functions associated with the MAGDEN, BUFFER, IBUFF, OBUFF,
DEFINE FILE, TRAPS, and RELEASE subroutines.

8.1.2

I/O Conversion Routines

The I/O conversion routines convert data from internal PDP-10 format to external format or vice versa. The
calls to these routines are implied by FORMAT and data transfer statements in the FORTRAN source program.
The routines reside as relocatable binary files in LIMO. REL.

Table 8-1
I/O Conversion Routines
Routine

I

Description

ALPHI.

Alphanu:":lcric ,\SCII input conversion

ALPHO.

AI rhe: lur,lCi i c ASC II output conversion

FLIRT .*

Floating point ond double precision
input cOllversion

FLOUT. *

Floatir.SJ r--oint c,ld double precision
output conversion

INTI.

Integer input conversicn

INTO.

Integer output conversion

LINT.

Logicol input conversion

LOUT.

Logkal output

cc.I'I;)~siun

DI~T.

I

J

"FLIRT. conlo;n. Iwo enl,y po;n", FLIRT and
FLOUT. contains two entry points, FLOU~ and D

Z

Transfer of Sign:
Real
Integer
Double precision

SIGN
ISIGN
DSIGN

Positive Difference:
Real
Integer

{ Sgn(Arg 2)* Arg 1

2
2
2

Real
Integer
Double

Real
Integer
Double

DIM
IDIM

{ Arg 1-Min(Arg 1,Arg 2 ) }

2
2

Real
Integer

Real
Integer

EXP
DEXP
CEXP

{eAr9

}

1
1
1

Real
Double
Complex

Real
Double
Complex

ALOe;
ALOG10
DLOG
DlOG10
CLOG

loge (Arg)
1091O (Arg)
loge (Arg)
10910 (Arg)
10ge (Arg)

1
1
1
1
1

Real
Real
Double
Double
Complex

Real
Real
Double
Double
Complex

Square Root:
Real
Double
Complex

SORT
DSORT
CSQRT

1/2
(Arg) 1/2
(Arg)
1/2
c=(x + i y}

1
1
1

Real
Double
Complex

Real
Double
Complex

Sine:
Real (radians)
Real (degrees)
Double (radians)
Complex

SIN
SIND
DSIN
CSIN

}

1
1
1
1

Real
Real
Double
Complex

Real
Real
Double
Complex

Cosine:
Real (radians)
Real (degrees)
Double (radians)
Complex

COS
COSD
DCOS
CCOS

}

1
1
1
1

Real
Real
Double
Complex

Real
Real
Double
Complex

Exponential:
Real
Double
Complex

I

I fr

Logarithm:
R~al
ex>
I

0-

Double
Complex

s:
")

-<
..r;
"-

t-..

{ sin (Arg)

( cos (Arg)

ERROR.
EXP,SIN,COS,
ALOG,ERROR.
ERROR.
ERROR.

ALOG,ATAN2,
SORT ,ERROR.
ERROR.
SORT

SIN,SINH,COSH,
ALOG,EXP

SIN,SINH,COSH,
ALOG,EXP

«
....
... ...
o· o·
CD CD

::J ::J

W~

~o-

r- "T1
iijO

Table 8-3 (Cont)
FORTRAN IV Library Functions

.,..:::0
0-4
:::0

»
z

co

I
......

Mnemonic

Definition

Number of
Arguments

Hyperbol i c:
Sine
Cosine
Tangent

SINH
COSH
TANH

sinh (Arg)
cosh (Arg)
tanh (Arg)

1
1
1

Real
Real
Real

Real
Real
Real

EXP,ERROR.
EXP,ERROR.
EXP

Arc - sine

ASIN

asin (Arg)

1

Real

Real

ATAN,SQRT,
ERROR.

Arc - cosine

ACOS

acos (Arg)

1

Real

Real

ATAN,SQRT,
ERROR.

ATAN
DATAN

atan (Arg)
atan (Arg)

1
1

Real
Double

Real
Double

ATAN2

atan (Arg

l Arg 2)

2

Real

Real

DATAN2

atan (ArglArg2)

2

Double

Double

Complex Conjugate

CONJG

Arg=X + iY ,C=X-iY

1

Complex

Complex

Random Number

RAN

result is a random number
in the range of 0 to 1.0.

1

Integer,
Real,
Double,or
Complex

Real

Arc tangent
Real
Double
quotient of
two arguments

---------

f

"<
-0

......
~

Type of
Argument Function

Function

External Calls

ATAN,ERROR. ,
TRAPS
OAT AN, ERROR.

8.2.2

FORTRAN IV Library Subroutines

This section contains descriptions of all standard subroutine subprograms provided within the FORTRAN IV library
for the PDP-l0. These subproQrams are closed subroutines and are called with a CALL statement.

Table 8-4
FORTRAN IV Library Subroutines
Subroutine Name
BUFFER

Effect
Allows the programmer to specify buffering for a
device at one of fifteen levels.
CALL BUFFER (unit*, in/out, number)
where in/out is 1 for input buffering only, 2 for
output buffering only, or 3 for both, and number is
the level of buffering (1 < number < 15). If number
is not specified, 2 is assumed. In calls to two entries in BUFFER, IBUFF and OBUFF, the programmer
can specify a non-standard buffer size if the records
in his data files exceed standard buffer sizes set by
the Monitor. (See Tab Ie 12-1.) The programmer
cannot change buffer sizes for the disk; IBUFF
and OBUFF are designed primarily for Magtape.
CALL IBUFF (d,n,s)
where d is the devi ce number, n is the number of
buffers, and s is the size of buffer.

CHAIN

Reads a segment of coding (Chain file) into core
and links it to a program already residing in core.
CALL CHAIN (type,device,file)
where type is 0 (the next Chain file is read into core
immediately above the permanent resident area) or
type is 1 (the next Chain file is read into core immediately above the FORTRAN IV program which
marks the end of the removable resident). Device
is 0,1,2, •.. FORTRAN IV logical device number
(Chain files can be stored on DSK, MTA, or DTA
only) corresponding to the device where the Chain
file can be found. File is 0 for reading the next
fi Ie from the selected magnetic tope or 1,2, ... for
the number of the magnetic tape unit where the
Chain file is located.

DATE

Places today's date as left-justified ASCII characters
into a dimensioned 2-word array.
CALL DATE (array)
where array is the 2-word array. The date is in the
form
dd-mmm-yy

*For explanation, see page 7-10.

8-8

Table 8-4 (Cont)
FORTRAN IV Library Subroutines
Subroutine Name

Effect

DATE (cont)

where dd is a 2-digit day (if the first digit is 0, it
is converted toa blank), mmm is a 3-digit month
(e.g., MAR), and yy is a 2-digit year. The date
is stored in ASCII code, left-justified in the two
words.

DUMP

Causes particular portions of core to be dumped and
is referred to in the following form:
CALL DUMP (L1,U1,F1, .•. ,Ln,Un,Fn)
where L. and U. are the variable names which give
the limiJs of co~e memory to be dumped. Either
Li or Ui may be upper or lower limits. Fi is a
number indicating the format in which the dump is
to be performed: O=octal, l=real, 2=integer, and
3=ASCII.

If F is not 0,1,2,3, the dump is in octal. If Fn is
missing, the last section is dumped in octal. If
Un and Fn are missing, an octal dump is made from
L to the end of the job area. If Ln, Un' and Fn
are missing, the entire job area is dumped in octal.
The dump is terminated by a call to EXIT.
EOF1 (unit*)

Skips one end-of-fi Ie terminator when found and
returns the value TRUE if an end-of-file was found
and FALSE if it was not found. Subsequent terminators produce an error message.

EOFC(unit*)

Skips more th"an one end-of-file terminators when
found and returns the value TRUE if an end-of-file
was found or FALSE if it was not found.

ERRSET

Allows the user to control the typeout of executiontime arithmetic error messages, ERRSET is called
with one argument in integer mode.
CALL ERRSET(N)
Typeout of each type of error message is suppressed
after N occurances of that error message. IF ERRSET
is not called, the default value of N is 2.

EXIT

Returns control to the Monitor and, therefore, terminates the execution of the program.

IFILE

Performs LOOKUPs for files to be read from DECtape
and disk.
CALL IFILE(unit*,filnam)

I

where filnam is a filename consisting of five or fewer
ASCII characters enclosed in single quotes ('). e.g.,
~________________________~____C_A_L_L_I_FI_L_E~(1_2~,_IF_I_LE_1_')________________________~
*For explanation, see page 7-10.

Version 26 FORTRAN
Version 32 LlB40

8-9

May 1972

Table 8-4 (Cont)
FORTRAN IV Library Subroutines
Effect

Subroutine Name
ILL

Sets the ILLEG flag. If the flag is set and an illegal
character is encountered in floating-point/doubleprecision input, the corresponding word is set to zero.
CALL ILL

LEGAL

Clears the ILLEG flag. If the flag is set and an
illegal character is encountered in floating-point/
double-precision input, the corresponding word is
set to zero.
CALL LEGAL

MAGDEN

Allows specification of magnetic tape density and
parity.
CALL MAGDEN(unit* ,density, parity)
where density is the tape density desired (200 = 200
bpi,556=556 bpi, or 800=800 bpi) and parity is
the tape parity desired (O=odd, 1 =even). Even
parity is intended for use with BCD-coded tapes
only.

OFILE

Performs ENTERs for files to be written on DECtape
and disk.
CALL OFILE (unit*,filnam)
where filnam is a filename consisting of five ASCII
characters.

PDUMP

Is referred to in the following form:
CALL PDUMP(L1,U1,F1, ... ,Ln,Un,Fn)
where the arguments are the same as those for DUMP.
PDUMP is the same as DUMP except that control
returns to the calling program after the dump has
been executed.

RELEAS

Closes out I/O Gn a device initialized by the
FORTRAN Operating System and returns it to the
uninitialized state.
CALL RELEAS (unit*)

SAVRAN

SAVRAN is called with one argument in integer mode.
SAVRAN sets its argument to the last random number
(interpreted as an integer) that has been generated
by the function RAN.

SETRAN

SETRAN has one argument which must be a nonnegative integer"::: 231. The starting value of the
function RAN is set to the value of this argument,
unless the argument is zero. In this case, RAN uses
its normal starting value.

~~--~--~-----------------

_.___.... _ .... _____.__ -----.J

*For explanation, sec pase 7-10.

8-10

Table 8-4 (Cont)
FORTRAN IV Library Subroutines
Effect

Subroutine Name
SLlTE(i)

Turns sense lights on or off. i is an integer expression. For 1 < i < 36 sense light i will be turned on.
If i =0, all sense lights will be turned off.

SLlTE(i, j)

Checks the status of sense light i and sets the variable j accordingly and turns off sense light i. If
i is on, j is set to 1; and if i is off, j is set to 2.

SSwrCH (i , j)

Checks the status of data switch i (0< i < 35) and sets
the variable j accordingly. If i is set down, j is
set to 1; and, if i is up, j is set to 2.

TIME

Returns the current time in its argument(s) in leftjustified ASCII characters. If TIME is called with
one argument,
CALL TIME(X)
the time is in the form
hh : mm
where hh is the hours (24-hour time) and mm is the
mi nutes. If a second argument is requested,
CALL TIME (X, Y)
the first argument is returned as before and the second has the form
ss. t
where ss is the seconds and t is the tenths of a second.

I

8-11

CHAPTER 9
SUBPROGRAM CALLING SEQUENCES

This chapter describes the conventions used in writing MACRO subprograms which can be called by FORTRAN IV
programs, and FORTRAN subprograms which can be linked to MACRO main programs. The reader is assumed to
be familiar with the following texts:
MACRO-10 Assembler (DEC-10-AMZB-D)
Secti on 2.5.8 "Link ing Subroutines"
Figure 7-1, "Sample Program, CLOG"
Timesharing Monitors: (DEC-T9-MTZC-D)
Section 3.2.2 "Loading Relocatable Binary Files"
Science Library and FORTRAN Utility Subprograms
(DEC-lO-SFLE-D)
How to Use This Manual - FORTRAN calling sequences

9.1

9. 1 . 1

MACRO SUBPROGRAMS CALLED BY FORTRAN MAIN PROGRAMS

Ca II i ng Sequences

The FORTRAN calling sequence, in the main program, for a subroutine is
FORTRAN Code

MACRO Code (Generated by Compiler)

CALL subprog (adr l' adr 2' ... )

JSA 16, subprog
ARG code 1, adr 1
ARG code2, adr2

subprog

is the name of the subprogram

adr 1 , adr 2 ,· ..

are the addresses of the arguments

code l' code2

are the accumulator fields of the ARG instructions
which indicate the type of argument being passed
to the subprogram. These codes are as follows:

where

0
1
2

3

Integer argument
Unused
Real argument
Logical argument

4
5
6
7

Revision 1 FORTRAN

9-1

Octal argument
Hollerith argument
Double-precision
argument
Complex argument
October 1970

An example of a FORTRAN calling sequence for a subroutine and the MACRO-10 coding generated by the
compiler is given below.
FORTRAN Code

MACRO Code

CALL PROG 1 (REAL,INT)

JSA 16, PROG1
ARG 02, REAL
ARG 00, INT

The MACRO code generated by the compi ler is the same for subroutines and functions; hO\AJever, the FORTRAN
code is different.

9. 1.2

Returning of Answers

A subroutine returns to its answers in specified locations in the main program. These locations are often given
as argument names or as variab Ie names.
A function returns its answer in accumulator 0 (if a single word result) or in accumulators 0 and 1 (if a doubleprecision or complex result). A function may also return its answer in specified locations (given by argument
names in the CALL) or variable names; in any event, however, it must return an answer in accumulator 0 (or
accumulators 0 and 1).
A MACRO subprogram access COMMON by declaring as external common block names for labelled
COMMON and by declaring .COMM. as external for blank common. A common block name always refers
to the same core location as the first element following the block name in a COMMON statement. MACRO
subprograms may refer to the remainder of the variables in the common block through additive globals.

9. 1.3

Use of Accumulators

For accumulator usage, see Chapter 10, Accumulator Conventions for PDP-10 Main Programs and Subprograms.

9. 1. 4

Examples of Subprogram Linkage

Three examples of subprogram linkage, one of a subroutine, one of a function subprogram, and one of a
FORTRAN main program and MACRO subprogram both referencing COMMON, are given below.

9.1.4.1

Example of a Subroutine Linkage - The coding of the subroutine in this example is followed by the

calling sequence.

9-2

ENTRY

SUBA

SUBA:

0
MOVE
IMULI
MOVEM
JRA

l,@0(16)
1, 12
l,@0(16)
16, 1(16)

FORTRAN Calling Sequence
CALL

9. 1.4.2

iGET FIRST ARGUME NT
iMULTIPLY BY 10
iRETURN RESULT IN ARGUMENT
iRETURN TO MAIN PROGRAM

MACRO Code (Generated by Compiler)

SUB A (I NT)

JSA 16, SUBA
ARG ~O, INT

Example of a Function Subprogram Linkage - The coding of the function subprogram in this example

is followed by the calling sequence.

ENTRY

FNC

FNC:

o
MOVE
MOVE
IMUL

00 ,@0(16)
01,@1(16)
~O, 01

JRA

16, 2(16)

FORTRAN Calling Sequence

I

9.1.4.3

X =FNC

iPICK UP FIRST ARGUMENT
iPICK UP SECOND ARGUMENT
iMULTIPLY BOTH ARGUMENTS
iRESULT IN ACO
iRETURN WITH ANSWER IN ACO

MACRO Code (Generated by Compiler)

(I, 10)

JSA 16, F NC
ARG 00, I
ARG ~O, CONST.

Example of a FORTRAN Main Program and a MACRO Subprogram Both Referencing COMMON.

Revision 1 FORTRAN

9-3

October 1970

;:oc
(1)

T

F40

V013

1M

BLOCK

a

!:.
'"
0
:J

28-NOV-69

12:24
DIMENSION A(5), B(3 ,4) ,C(3)

-n

0;:oc

COMMON C

-I

;:oc

»
z

COMMON/A!A/B/B/D/D
A(2)=B(2,3)+C(3}+D
MOVE
FADR
FADR
MOVEM

02,D
02,B+7
02,C+2
02,A+1

JSA

16, SUB2

CALL SUB2
END

MAIN.%

JSA
RESET.
JRST

COMMON
C
A
B
D

/A!

-0

16,EXIT
00,0
1M

I

~

/.COMM./
/B/
/D/

SUBPROGRAMS
FORSE.
JOBFF
SUB2
EXIT
SCALARS

0

D

0

.....

0

0-

.,

(1)

-0
"'-I
0

ARRAYS

a

a
a
a

a

C

o
o
o

MAIN.

ERRORS DETECTED: 0

A

B

2K CORE USED

.MAIN

MACRO. V36

12:23

28-NOV-69
EXTERNAL .COMM.,A,B,D
ENTRY
SUB2

000000
000001
000002
000003
000004
000005

-0
I

U'1

000000
200000
202000
200000
202000
267716

000000
000002
000003
000000
000000
000000

SUB2:

o

MOVE
MOVEM
MOVE
MOVEM

JRA

O,A+2
O,B+3
O,.COMM.
O,D
16,(16)

END

iGET A(3)
;STORE IN B(l ,2)
;GET C
;STORE IN D
iRETURN TO FORTRAN PROGRAIV
iEND

NO ERRORS DETECTE D
PROGRAM BREAK IS 000006
SYMBOL TABLE
A
SUB2

000000 EXT
000000' INT

B
.COMM.

000000 EXT
000003' EXT

D

000004' EXT

003466 IS THE PROGRAM BREAK
STORAGE MAP

-0
I

0-

000035

MAIN.

000140

MAIN.
. COMM.
A
B
D

000146
000150
000153
000160
000174

. MAIN

000175

SUB2

000175

JOBDAT

000203

000000

FORSE.

000203

002374

BUFCA.
BUFHD.
CHINN.
CLOS.
CLOSI.
CLROU.
CLRSY.
DADDR.
DATA.
DEPOT.
DEVIC.
DEVNO.
DYNDV.
DYNND.
ENDLN.
EOFFL.
EOFTS.
EOL.
FI.
FIN.
FMTBG.
FMTEN.
FNCTN.

001624
002337
001121
/002002
002000
001763
001770
002276
000000
001004
002477
002172
002212
002356
001047
002205
001214
002275
001112
000000
002274
002273
001751

000006

IORTR.
LOOK.
MTOP.
MTPZ.
NLI.
NLO.
FORSE .
lIB.
IN.
INF.
INP.
INPDV .
NXTCR.
NXTLN.
ONLY 1.
OUT.
OUTF.
OUTT.
OVFLS.
PAKFL.
RERDV.
RERED.
RESET.
RIN.
RTB.
SESTA.
SETOU.
SLIST.
STAT.
TCNTl.
TCNT2.
TEMP.
TNAM1.
TANM2.
TPNTR.
TYPE.
UUOH.
WAIT.
WTB.
XIO.

000334
002034
000000
002030
000000
000000
000203
001141
000000
000000
002007
002203
001162
001172
002204
000000
000000
002013
002202
002176
002501
000000
000000
000245
000000
002020
001755
000000
001774
002506
002507
002232
002133
002132
002505
002504
001234
002024
000000
000424

ERROR.

002577

000431

-0
I

"..J

BPHSE.
DEVER.
DPRER.
DUMER.
ENDTP.
ERROR.
ILLCH.
ILLMG.
ILRE D.
ILUUO.
INiER.
USTB.
LOGEN.
MSNG.
NMLER.
NOROM.
PARER.
QTY1
REDER.
TBLER.
UUOM
WLKER.

002777
002667
002767
003041
002772
002577
002634
003007
003025
003051
002654
002737
002627
002707
003020
002720
003034
003170
002746
002700
003067
002731

EXIT

003230

EXIT
EXIT .

003230
003231

IOADR.

003232

IOADR.

003232

DALPHI

003246

ALPHI.

003246

DALPHO

003250

000002

000014

000002

000002

ALPHO.

003250

DDIRT

003252

DIRT.

003252

DDOUBT

003254

DOUBT.

003254

DFURT

003256

FURT.

003256

DFLOUT

003260

FLOUT.

003260

DINTI

003262

INTI.

003262

DOCTI

003264

OCTI.

003264

DINTO

003266

INTO.

003266

DOCTO

003270

OCTO.

003270

DUNT

003272

LINT.

003272

DLOUT

003274

LOUT.

003274

DNMLST

003276

000002

000002

000002

000002

000002

000002

000002

000002

000002

000002

000003

DELIM.
NMLST.

003300
003276

DTFMT

003301

TFMT.

003301

DBINWR

003303

BINDT.

003303

BINEN.
BINWR.
INPT.

003303
003303
003303

DTPFCN

003305

TR=CN.

003305

DEVTB.

003307

DATTB.
DEVLS.
DEVND.
DEVTB.
DVTOT.
MBFBG.
MTABF.
MTACL.
NEG1.
NEG2.
NEG3.
NEG5.
TABP1.
TABPT.

003363
003344
003352
003307
000035
003352
003353
003421
000005
000007
000003
000002
003363
003362

PDLST.

003432

PDLST.

003432

ILL

003457

ILL

003457

ILLEG.
LEGAL
000002

000002

000002

000123

-0
I

00

000025

000007

003465
003462

LOADER 3K CORE
3+3K MAX 1225 WORDS FREE

9.2

MACRO MAIN PROGRAMS WHICH REFERENCE FORTRAN SUBPROGRAMS

9.2. 1

Calling Sequences

The MACRO code which calls the FORTRAN subprogram should be the same as that produced by the
FORTRAN IV compiler when it calls a subroutine. That is:
MACRO Code
JSA 16, subprog
ARG code 1, adq
ARG code2' adr2

where
subprog

is the name of the subprogram

adr 1, adr2 ,···

are the addresses of the arguments

code l' code 2

are the accumulator fields of the ARG instruction
which indicate the type of argument being passed
to the subprogram. These codes are as follows:

o
1
2
3
4
5
6
7

Integer argument
Unused
Real argument
Logical argument
Octal argument
Hollerith argument
Double-precision argument
Complex argument

Both subroutines and functions are called in this manner.

9.2.2

Returning of Answers

A FORTRAN subroutine returns its answers in specified locations in the main program. These locations may be
given as variable names in COMMON or as argument names.
A FORTRAN function returns its answer in accumulator 0, if a single word result, or in accumulators 0 and 1,
if a double-precision or complex result. A function may also return its answer in specified locations given by
argument names in the CALL, or variable names in COMMON; in any event, however, it must return an answer
in accumulator 0 (or accumulators 0 and 1).

If it is desired to reference a common block of data in both the MACRO main program and the FORTRAN subprogram, it is necessary to set up the common area first by loading a FORTRAN BLOCK DATA program before
the MACRO main program and the FORTRAN subprogram.

9-9

9.2.3

Example of Subprogram Linkage

The following is an example of a FORTRAN subroutine being called by a MACRO main program.
reference common data.

Both programs

Read and write statements have been omitted for simplification. Because the FORTRAN

operating system, FORSE., sets up I/o channels at run time, the MACRO programmer must be sure not to initialize a devic~ on a channel that FORSE. will then try to use, unless he releases the device before FORSE. is
called.

FORSE. initializes the first device encountered in the user program on software channel I, the second

on channel 2, etc.

It is possible to release a device from its associated channel in a FORTRAN program by a call to the subroutine
RELEAS. Channels one through seventeen are available for I/O. If a FORTRAN user wishes to write MACRO
programs which do I/o, he may use either FORTRAN UUO's or the channel numbers less than or equal to seventeen but greater than the largest number used by FORSE.
The FORTRAN RESET. UUO should be the first instruction executed in any program which'accesses FORTRAN
subroutines. For this reason the FORTRAN operating system, which contains the FORTRAN UUO handler
routine, must be declared external in the MACRO main program. This causes FORSE. to be loaded.

In general,

any program in the FORTRAN library referenced in a MACRO program must be declared external. This results
in the searching of LIB40 by the Linking Loader and loading the referenced program.

9-10

BLKDTA.F4
1M

BLOCK

F40

V016

22-JAN-70

15:46
BLOCK DATA

0

C OMMO N/A/A/B/B/C/C
COMMON D
DIME NSION A(5) ,B(2,3)
END
DAT.

BLOCK

0

COMMON
A
0
/A/
B
0
/B/
0
C
/C/
D
/.COMM./
-.0

0

SUBPROGRAMS

I

~
~

JOBFF
SCALARS
C
D

0
0

ARRAYS
A
B

0
0

DAT.

ERRORS DETECTE D: 0

2K CORE USED

MACRO. V40 16:05 22-JAN-70
·MAIN
START .MAC

000000
000001
000002
000003
000004
000005
000006
000007

015000
200000
202000
200000
202000
200040
202040
266700

000000
000000
000000
000000
000000
000002
000005
000000

000010

266700

000000

START:

ENTRY
EXTERNAL
RESET.
MOVE
MOVEM
MOVE
MOVEM
MOVE
MOVEM
JSA
JSA

START
00,0
O,A
O,B
O,C
O,.COMM.
1,A+2
1,B+5
16,ARGS
16,EXIT .

END

START

• COMM. ,A, B,C,ARGS, FORSE., EXIT.
;DO FORTRAN UUO RESET, FOUND IN FORSE.
;GET A(I)
;STORE IN B(l, 1)
;GET C
;STORE IN D
;GET A(3)
; STORE IN B(2,3)
;GO TO FORTRAN SUBROUTINE ARGS
;EXIT. FORTRAN EXIT ROUTINE WHICH PR!NTS
;OUT SUMMARIES AND ALSO CALLS MONITOF;LEVEL EXIT UUO. USER HAS OPTION TO USE
;EITHER
;END

NO ERRORS DETECTED
-0
I

N

PROGRAM BREAK IS 000011
START
A
C
START

.MAC

SYMBOL TABLE
00000]' EXT
000003' EXT
000000' ENT

ARGS
EXIT .
.COMM.

000007' EXT
000010' EXT
000004' EXT

B
FORSE.

000002' EXT
000000 EXT

ARGS.F4 F40
1M

BLOCK

V016

22-JAN-70

15:46
SUBROUTINE ARGS

0

COMMON /A/A/B/B/C/C
COMMON D
DIMENSION A(5),B(2,3)
A(l)=B(1 ,1)+C+D
MOVE
FADR
FADR
MOVEM

02,C
02, D
02,B
02,A

JRST

2M

RETURN
END

-0

ARGS%

.....I

w

2M

JRST
ARG
MOVEM
MOVEM
JRST
MOVE
MOVE
JRA

2M
00,0
15, TEMP .
16, TEMP.+1
1M
15, TEMP.
16,TEMP.+1
16,0(16)

COMMON
A
0
/A/
0
B
/B/
C
0
/C/
D
/.COMM./
SCALARS
ARGS
C
D

17
0
0

0

ARRAYS
A
B

0
0

ARGS
ERRORS DETECTE D:
2K CORE USED

0

003471 IS THE LOW SEGMENT BREAK
.MAIN

STORAGE MAP

16:06

22-JAN-70

STARTING ADDRESS 000155 PROG .MAIN FILE START
DAT.

000140

000015

DAT.
.COMM.

000140
000154

000155

000011

START

000155

000166

000020

ARGS

000174

JOB DA T

000206

000000

FORSE.

000206

002374

BUFCA.
CLOSI.
DATA.
DYNDV.
EOFTS.
FMTBG.
lIB.
INPDV.
MTPZ.
NXTLN.

001627
002003
000000
002215
001217
002277
001144
002206
002033
001175
002016

-0
I

A

000140

B

000145

C

000153

002342
001766
001007
002361
002300
002276
000000
000337
000000
002207
002205

CHINN.
CLRSY.
DEVIC.
ENDLN.
FI.
FNCTN.
INF.
LOOK.
NLO.
OUT.
PAKF L.

001124
001773
002502
001052
001115
001754
000000
002037
000000
000000
002201

CLOS.
DADDR.
DEVNO.
EOFFL.
FIN.
FORSE.
INP.
MTOP.
NXTCR.
OUTF.
RERDV.

002005
002301
002175
002210
000000
000206
002012
000000
001165
000000
002504

~

.MAIN

ARGS

oun.

BUFHD.
CLROU.
DEPOT.
DYNND.
EOL.
FMTEN.
IN.
IORTR.
NLI.
ONLYl.
OVFLS.

ERROR.

EXIT

IOADR.

RERED.
SESTA.
TCNTl.
TNAM2.
WAIT.

000000
002023
002511
002135
002027

002602

000431

BPHSE.
ENDTP.
ILRED.
LOGEN.
PARER.
UUOM

003002
002775
003030
002532
003037
003072

003233

000002

EXIT

003233

003235

000014

IOADR.

003235

003251

000002

ALPHI.

003251

003253

000002

ALPHO.

003253

003255

000002

DIRT.

003255

003257

000002

DOUBT.

003257

003261

000002

FLIRT.

003261

003263

.000002

FLOUT.

003263

003265

000002

INTI.

003265

-0

I

U1

DALPHI

DALPHO

DDIRT

DDOUBT

DFLIRT

DFLOUT

DINTI

RESET.
SETOU.
TCNT2.
TPNTR.
WTB.

000000
001760
002512
002510
000000

RIN.
SLIST.
TEMP.
TYPE.
XIO.

000250
000000
002235
002507
000427

RTB.
STAT.
TNAMl.
UUOH.

000000
OOlm
002136
001237

DEVER.
ERROR.
ILUUO.
MSNG.
QTY1
WLKER.

002672
002602
003054
002712
003173
002734

DPRER.
ILLCH.
INIER.
NMLER.
REDER.

002772
002637
002657
003023
002751

DUMER.
ILLMG.
LISTB.
NOROM.
TBLER.

003044
003012
002742
002723
002703

EXIT.

003234

DOCTI
DINTO
DOCTO
DLINT
DLOUT
DNMLST
DTFMT
-0
I

DBINWR

0-

DTPFCN
DEVTB.

PDLST.
ILL

003267

000002

OCTI.

003267

003271

000002

INTO.

003271

003273

000002

OCTO.

003273

003275

000002

LINT.

003275

003277

000002

LOUT.

003277

003301

000003

DELIM.

003303

003304

000002

TFMT.

003304

003306

000002

BIN DT.

003306

003310

000002

T~CN.

003310

003312

000 123

DATTB.
DVTOT.
NEG1.
TABP1.

003366
000035
000005
003366

003435

000025

PDLST.

003435

003462

000007

ILL

003462

LOADER 3K CORE
3+3K MAX 1222 WORDS FREE

NMLST.

003301

BINEN.

003306

BINWR.

003306

INPT.

003306

DEVLS.
MBFBG.
NEG2.
TABPT .

003347
003355
000007
003365

DEVND.
MTABF.
NEG3.

003355
003356
000003

DEVTB.
MTACL.
NEG5.

003312
003424
000002

ILLEG.

003470

LEGAL

003465

CHAPTER 10
ACCUMULATOR CONVENTIONS FOR
MAIN PROGRAMS AND SUBPROGRAMS

10.1

LOCATIONS

Locations specified in the calling sequence for a FORTRAN subprogram may be either required locations or
defined locations. A required location is a memory location whose address is specified in the calling sequence
for a subprogram. For example, X is a required location in the calling sequence
JSA 16, SQRT
ARG
X
A defined location is a memory location whose address is specified in the definition of a calling sequence. The
location does not appear in the calling sequence. For example in the calling sequence
MOVEI 16, MEMORY
PUSHJ 17, DFAS.O
MEMORY is required, and ACO, AC1, and AC2 are defined by DFAS.O.

10.2

ACCUMULATORS

10.2. 1 Accumulators 0 and 1
When used for subprograms called by JSA, accumulators 0 and 1 may be used at any time without restoring their
original contents. These accumulators cannot be required locations. A FORTRAN function returns its answer in
accumulator 0 (if a single word result) or in accumulators 0 and 1 (if a double-precision or complex result). A
function may also return its answer in specified locations (given by argument names in the CALL) or variable
names; in any event, an answer must be returned either in accumulator 0 or in accumulators 0 and 1.
When used for subprograms called by PUSHJ 17, adr, accumulators 0 and 1 may have their contents destroyed.
Some subprograms by their definition return an argument in accumulator 0 or 1.

10-1

IU.L.L

Accumulators L Ihrough I,)

Accumulators 2 through 15 must not be destroyed by FORTRAN functions, but may be destroyed by FORTRAN
subroutines. (Presently subroutines must preserve the contents of accumulator 15.) The contents of these accumulators must not be destroyed by subprograms called by PUSHJ unless the definition of the subroutines requires
it.

10.2.3

Accumulators 16 and 17

Accumulator 16 should be used only for JSA-JRA subprogram calls unless the definition of the subprogram sequence requires otherwise. The contents of accumulator 16 may be destroyed by subprograms called by PUSHJ
17, adr.
Accumulator 17 must be used only for pushdown list operations.

10.3

UUOS

User UUO's are not considered subprograms and may not change any locations except those required for input
and the contents of accumulators 0 or 1.

10.4

SUBPROGRAMS CALLED BY JSA 16, ADDRESS

The calling sequence is
J SA 16, address
ARG
adrl
ARG
adr2
ARG

adrN

where each AR G adrN corresponds to one argument of the subprogram.
There mayor may not be arguments. If there are arguments, they must be inaccumulators 2 through 15. Subroutines called with the FORTRAN CALL statement may, by definition, return an argument in accumulator 0 or
1. Subprograms that are FORTRAN functions (such as SIN or SQRT) may destroy the contents of accumulators 0
and 1. Results are returned in accumulator 0 for single word results and accumulators 0 and 1 for double word
results.

10.5

SUBPROGRAMS CALLED BY PUSHJ 17, ADDRESS

See section 10.2. In addition, three consecutive accumulators are required for double-precision addition, subtraction, multiplication, and division operations. The contents of the third accumulator may be destroyed. The

10-2

"to memory" modes also leave the answer in the defined accumulators. The two arguments of the double-precision
operation cannot be in the same accumulators. Complex addition, subtraction, multiplication, and division operations do not destroy locations except those required for the answer and accumulator 16. The two arguments of
the complex operation must not be in the same accumulator.

10.6

SUBPROGRAMS CALLED BY UUOS

Subprograms called by UUO's may change the contents of accumulators 0 and 1 only.
Table 10-1
Accumulator Conventions for
PDP-10 FORTRAN IV Compiler and Subprograms
Subprogram
Called
By:
Accumulators

PUSHJ

JSA
Functions

UUO

Subroutines

0, 1

1) May be destroyed.
2) May not be used to
pass arguments.
3) A result must be
returned in 0 or
o and 1.

1) May be destroyed. 1) May be destroyed. 1) May be destroyed.
2) May be used to pass
2) May be used to
2) May not be used
arguments except as
to pass arguments.
pass arguments if
the subprogram is
defined.
3) Results must not
defined with an
3) Resu Its must not be
be returned.
argument in 0 or
returned.
o and 1.
3) Resu Its may be returned if the subprogram is so defined.

2-15

1) Must be preserved.
2) Arguments may be
passed.
3) Results may be returned if required
by call ing sequence.

1) May be destroyed. 1) Must be preserved 1) Must be preserved.
unless the defini- 2) Arguments may be
2) Arguments may be
passed.
tion of subprogram
passed.
3) Results must not be
forces resu Its to
3) Results must not
returned.
be returned.
be returned.
2) Arguments may be
passed.
3) Results may be returned if the subprogram is so defined.

1) Must be preserved.
16
2) May not be used
Reserved for
to pass arguments.
JSA-JRA
Operations
3) Results must not be
returned.
(except as noted for PUSHJ)

1) Must be preserved.
1) Must be preserved. 1) Is destroyed.
2)
May not be used to
2) Used for argument
2) May not be used
pass arguments.
address.
to pass arguments.
3) Resu Its must not be 3) Resu Its must not be
3) Results must not
returned.
returned.
be returned.

1) Must be preserved.
2) May not be used
to pass arguments.
3) Resu Its must not be
returned.

1) Must be preserved. 1) Must be preserved. 1) Must be preserved.
2) May not be used to
2) May not be used
2) May not be used
pass arguments.
to pass arguments.
to pass arguments.
3) Results must not be 3) Results must not be
3) Results must not
returned.
returned.
be returned.

17
Reserved for
Pushdown
List Operations

10-3

CHAPTER 11
SWITCHES AND DIAGNOSTICS

11.1

FORTRAN SWITCHES AND DIAGNOSTICS
Table 11-1
FORTRAN Compiler Switch Options

Switch

Meaning
Advance magnetic tape reel by one file.
Backspace magnetic tape reel by one file.
Generate a CREF-type cross-reference listing. (DSK:CREF. TMP assumed if no list-dev
specified)
Complement: Do not produce cross-reference information (standard procedure).

E

Print an octal listing of the binary program produced by the compiler in addition to the
symbolic listing output.
Complement: Do not produce octal I isting (standard procedure).
Translate the letter D in column 1 as a space and treat the line as a normal FORTRAN
statement.
Complement: Translate the letter D in column 1 as a comment character and treat the
line as a comment (standard procedure).

M

Include MACRO coding in the output listing.
Complement: Eliminate the MACRO coding from the output listing (standard procedure).

N

Suppress output of error messages on the Teletype.
Complement: Output error messages on TTY (standard procedure).

I

S

If the compiler is running on the KA-10, produce code for execution on the KI-10 and
vice-versa.
Skip to the logical end of the magnetic tape reel.
Rewind the magnetic tape reel.
Zero the DECtape directory.

\witches A through C and T, W, and Z must immediately follow the device name or filename.ext to which
the individual switch applies.
Version 26 FORTRAN
Version 32 LlB40

11-1

May 1972

Table 11-2
FORTRAN Compiler Diagnostics
(Command Errors)
Meaning

Message

I

I

?BINARY OUTPUT ERROR dev:filename.ext

An output error has occurred on the device specified for
the binary program output.

?CANNOT FIND dev:filename.ext

Filename.ext cannot be found on this device.

?DEVICE INPUT ERROR for command string

Device error occurred while attempting to read Monitor
command fil e.

IMPROPER 10 FOR DEVICE dev:

An input device is specified for output (or vice versa) or
an illegal data mode was specified (e.g., binary output
to TTY).

ILLEGAL MEMORY REFERENCE AT loc
COMPILATION TERMINATED

An illegal memory reference hos occurred and compi lation has stopped. The current output files will be closed
and the next source files read.

?INPUT DATA ERROR dev:filename.ext

A read error has occurred on the source device.

?x IS A BAD SWITCH

This specified switch is not recognizable.

?x IS AN ILLEGAL CHARACTER

A character in a command string typein is not recognizable (e.g., FORM-FEED).

?dev: IS NOT AVAILABLE

Either the device does not exist or it has been assigned
to another job.

LINKAGE ERROR

Input device error while doing Dump Mode I/O, or not
enough core was ava i lable to execute the newly loaded
program.

?LINKAGE ERROR FOR dev:filename

Specified dev:filename appears in a 1 Monitor command
string, but cannot be run for some reason.

?LISTING OUTPUT ERROR

An output error has occurred on the device specified for
the list i ng output.

?NO ROOM FOR filename.ext

The directory on dev: DTAn is full and cannot accept
filename.ext as a new file, or a protection failure occurred for a DSK output file.

?NO FILE NAMED filename. ext

An illegal filename has been used.

?NOT ENOUGH CORE FOR LINKAGE

Not enough core available to load (with dump mode I/O)
the program specified in a ! Monitor command string.

?SYNT AX ERROR IN COMMAND STRING

A syntax error has been detected in a command string
typcin (e.g., the --has been omiited).

?X SWITCH ILLEGAL AFTER LEFT ARROW

Cannot change marhine type wit~l a fil,~ or clear source
directory •

?X SWITCH ILLEGAL AFTER FIRST STANDARD
FILE

Cannot clear directolY after start of compi lation (Batch

?X SWITCH, NO LISTING FILE

;h~:~m~iislt~~:~:~~:~:;i:i~i::i~:b:~I:~ace to compile the I

?INSUFFICIENT CORE - COMPILATION
TERMINATED
~

Mode).

program.

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _-L.._ _ _ _ _ _ _ _ _ _ _ _ _ _ - - - - - - - - - -

Version 24 FORTRAN
Version 31 LIB40

11-2

I

Table 11-2 (Cont)
FORTRAN Compiler Diagnostics
(Command Errors)
Meaning

Message

I

The pushdown list used by the compiler for machine
language subroutine calls has overflowed. Compilation
has stopped. The current output files will be closed
and the next source file read.

WORK STACK OVERFLOW AT loc
COMPILATION TERMINATED

Table 11-3
FORTRAN Compiler Diagnostics
(Compilation Errors)
Meaning

Message
1-1

DUPLICATED DUMMY VARIABLE IN
ARGUMENT STRING

A dummy variable (identifier) may appear only once in
anyone argument set representing the arguments of a
subprogram. (See Secti on 7.3)

1-2

ARRAY NAME ALREADY IN USE

Any attempt to re-dimension a variable or redefine a
scalar as an array is illegal. (See Section 6.1.1)

1-3

ATTEMPT TO REDEFINE VARIABLE

Once a variable has been defined as either complex,
double precision, integer, logical, or real it may not
be defined again. (See Section 2.2, 6.3)

TYPE
1-4

NOT A VARIABLE FORMAT ARRAY

The variable which contains the FORMAT specification
read-in at object time must be a dimensioned variable,
i.e., an array (see Section 5.1.1) or a subprogram argument was used as a NAMELIST name with the subprogram (see Section 5.1.2).

1-5

NAME ALREADY USED AS NAMELIST
NAME

After a NAMELIST name has been defined, it may appear only in READ or WRITE statements and may not be
defined again. (See Section 5.1 .2)

1-6

DUPLICATED NAMELIST NAME

A NAMELIST name has already been used as a scalar
array or global dummy argument. (See Section 5.1 .2)

1-7

A NAME APPEARS lWICE IN AN
EXTERNAL STATEMENT

A subprogram name has been declared EXTERNAL more
than once. (See Section 7.7)

1-8

ARGUMENT TYPE DOESN'T AGREE
WITH FUNCTION SPEC

The actual arguments for a function do not agree in
type with the dummy arguments in the specification of
the function.

1-9

THIS FUNCTION REQUIRES MORE
ARGUMENTS

Not enough arguments were supplied for a function.

1-10

SUBPROGRAM NAME ALREADY IN
USE

A subprogram name has appeared in another statement
as a scalar or array variable, arithmetic function statement name, or COMMON block name. (See Section

7.5)
1-11

DUMMY ARGUMENT IN DATA
STATEMENT

Version 24 FORTRAN
Version 31 LIMO

Dummy arguments may not appear in DATA statements.
(See Section 6.2.1)

11-3

October 1971

Table 11-3 (Cont)
FORTRAN Compiler Diagnostic~
(Compilation Errors)
Meaning

Message
1-12

NOT A SCALAR OR ARRAY

The variable defining the starting address for an
ENCODE/DECODE statement must be a scalar or an
array. (See Section 504)
The I/O unit name of a READ/WRITE statement is not
a scalar or array. (See Sections 5.2.6, 5.2.7)
An attempt to ASSIGN a label number to a variable that
is not a scalar or array. (See Section 2.2)
An attempt to GO TO through a variable that is not a
scalar or array. (See Section 4.1)

I

1-13

ILLEGAL USE OF DUMMY ARGUMENT

Dummy arguments may be used with functions or subprograms only. (See Sections 7 04.1 , 7.5.1)

1-14

ILLEGAL DO LOOP PARAMETER

The DO index must be a non-subscripted integer variable
while the initial, limit, and increment values of the index must be an integer expression - the index may not
be zero. (See Section 4.3)

1-15

I/O VARIABLES MUST BE SCALARS OR
ARRAYS

Referencing data in an I/O statement other than scalars
or arrays is illegal. (See Section 5.2)

1-16

A CONFLICT EXISTS WITH A COMMON
DECLARATION

The function name used was previously declared a scalar
variable in a COMMON statement.

S-l

ILLEGAL NAME OR DELIMITER OR
KEY CHARACTER

A variable name doesn't start with an alphabetic character, or a delimiter such as the left parenthesis that begins a format is missing, or a key character such as the
letter D in BLOCK DATA is missing.

S-2

STATEMENT KEYWORD NOT
RECOGNIZED

A statement keyword such as ERASE was not recognized,
possibly due to misspell ing (e.g., ERASC 16).

S-3

ILLEGAL FIELD SPECIFICATION

The field width or decimal specification in a FORMAT
statement must be integer. The number of Hollerith
characters in an H specification must be equal to the
number specified. (See Sections 5.1.1.1, 5.1.1.6)

S-4

SCALAR VARIABLE - MAY NOT BE
SUBSCRIPTED

An undimensioned variable (a scalar variable) is being
illegally subscripted (see Section 2.2.1) or a scalar
variable is subscripted in an ENCODE/DECODE statement (see Section 5 A) .

S-5

ILLEGAL TYPE SPECIFICA nON

The type of constant specified is illegal or misspelled.
(See Section 2.1)

S-6

ARGUMENT IS NOT SINGLE LETTER

Arguments in parentheses must be single letters in
IMPLICIT statement. (See Section 6.3.1)

S-7

'NAMELIST' NOT FOLLOWED BY"/"

The first character following NAMELIST must be /.
(See Section 5.1 .2)

S-8

ILLEGAL CHARACTER IN LABEL

A non-numeric character was detected in the label field
of the statement, possibly because tabs or spaces are
missing.

Version 24 FORTRAN
Version 31 LIB40

11-4

October 1971

Table 11-3 (Cont)
FORTRAN Compiler Diagnostics
(Compilation Errors)
Message

Meaning

5-9

MISSING COMMA OR SLASH IN
SPECIFICATION 5 TATEMENT

A specification statement (see Section 7.8) requires a
comma or slash and it is missing.

S-10

ILLEGAL ARITHMETIC "IF" TOO MANY LABELS

An arithmetic "IF" statement must have no more or less
than three statement labels to transfer to. Special optimization will occur if two of the labels are the same,
or one or more labels refer to the next statement.

S-ll

A NUMBER WAS EXPECTED

Only arrays which are subprogram arguments can have
adjustable dimensions. (See Section 6.1.1.1)

S-12

IMPLICIT TYPE RANGE OVERLAPS
PREVIOUS SPECIFICA nON

An implicit type range encompasses a character that has
already been given an implicit type.

S-13

ATTEMPT TO USE AN ARRAY OR
FUNCTION NAME AS A SCALAR

Variables may be either scalar or array but not both.
Variables appearing in a DIMENSION statement must
be subscripted when used. (See Section 2.2) Function
names must be followed by at least one argument enclosed
in parentheses (See Section 7.4) .

S-14

ARRAY NOT SUBSCRIPTED

See 5-13

S-15

ILLEGAL USE OF AN ARITHMETIC
FUNCTION NAME

Arithmetic function definition statement name is being
used without arguments (i.e., as a scalar) in an arithmetic expression. (See Section 7.3)

S-16

MUL nPLE RETURN ILLEGAL
WITHOUT STATEMENT LABEL ARG

A dollar sign ($) or an asterisk (*) must have appeared in
the argument list of this subprogram to represent the position of a statement label argument in the call.

S-17

INCORRECT PAREN COUNT OR
MISSING IMPLIED DO INDEX

The number of left and right parentheses does not match,
or an undefined index variable was used in defining a
DO loop (see Section 5.2.1), or the number of implied
DO loops and the number of matching parentheses differ in a DATA statement. (See Section 6.2.1)

S-18

INVALID INDEX IN DO-LOOP OR
IMPLIED DO-LOOP

The index of a DO statement must be a non-subscripted
integer variable and must not be zero. (See Section
4.3) The index is not used as a subscript in a DATA list.
(See Section 6.2.1)

5-19

EQUIVALENCE REQUIRES TWO OR
MORE ELEMENTS

The EQUIVALENCE statement must have more than one
argument because it causes variables to share the same
location. (See Section 6.1.3)

S-20

ILLEGAL DEFINITION OF AN
ARITHMETIC STATEMENT FUNCTION

The statement function continues past its recognized end
point.

5-21

MISSING COMMA IN INPUT/OUTPUT
LIST

An input/output list continues past its recognized end
point.

S-22

STATEMENT CONTINUES PAST
RECOGNIZED END POINT

A statement other than those mentioned above continued
past its recognized end point.

S-23

ILLEGAL COMPLEX CONSTANT

The parentheses of the complex constant enclose a logical,
Hollerith, or complex constant.

Version 24 FORTRAN
Version 31 LIMO

11-5

October 1971

Table 11-3 (Cont)
FORTRAN Compiler Diagnostics
(Compilation Errors)
Meaning

Message

I

0-1

BLOCK DATA NOT SEPARATE PROGRAM

Block Data must exist as a separate program. (See
Sections 6.2.2,7.6)

0-2

SUBROUTINE IS NOT A SEPARATE
PROGRAM

A subroutine following a main program or another subroutine subprogram may have no statement between it
and the preceding programs END statement and must begin with a SUBROUTINE statement. The previous program must have been terminated properly. (See Section
7.5)

0-3

STATEMENT OUT OF PLACE

The IMPLICIT specification statement and any arithmetic
function definition statement must appear before any executable statement. (See Chapter 6)

0-4

EXECUTABLE STATEMENTS ILLEGAL
IN BLOCK DATA

Block DATA statements cannot contain executable
statements .

A-1

MINIMUM VALUE EXCEEDS MAXIMUM
VALUE

Minimum value of an array exceeds the maximum value
specified. (See Section 6.1 .1)

A-2

ATTEMPT TO ENTER A VARIABLE INTO
COMMON TWICE

A variable name may appear in COMMON statement
only once. (See Section 6.1 .2)

ATTEMPT TO EQUIVALENCE A SUBPROGRAM NAME OR DUMMY
ARGUMENT

An identifier defined as a subprogram name cannot appear in EQUIVALENCE statements in the defining program. Dummy argument identifiers of a subprogram may
not appear in EQUIVALENCE statements in that subprogram. (See Sections 6.1.3, 7.1)

NOT A CONSTANT OR DUMMY
ARGUMENT

Only constant and dummy arguments may be used as arguments in dimension statements. (See Section 7.4.1)

A-5

CAUTION ** COMMON VARIABLE
PASSED AS ARGUMENT

The variable may be mul tiply defined in the call ed subprogram. (See Sections 7.4.1, 7.5.1)

M-1

TOO MANY SUBSCRIPTS

An array variable appears with more subscripts than
specified. (SeeSections2.2.2,6.1.l)

M-2

WRONG NUMBER OF SUBSCRIPTS

An array variable appears with too few subscripts. (See
Sections 2.2.2,6.1.1)

M-3

CONSTANT OVERFLOW

Too many significant digits in the formation of a constant or the exponent is too large. (See Section 2.1)

M-4

ILLEGAL 'IF' ARGUMENT

Logical IF or DO statement adjacent to a logical IF
statement, or illegal expression within a logical IF
statement. (See Sections 4.2.2, 4.3)

M-5

ILLEGAL CONVERSION IMPLIED

Attempt'to mix double precision and complex data in
the same expression. (See Section 2.3.1)

M-6

LABEL OUT OF RANGE OR ARRAY
TOO LARGE

Illegal statement label (See Section 1.1.1) or array size
is greater than 2 18 _1.

M-7

UNTERMINATED HOLLERITH STRING

A missing single quote or fewer than n characters following an "nH" specification. (See Section 5.1.1.6)

A-4

I

Version 24 FORTRAN
Version 31 L1B40

11-6

Oc tob er 1971

Tabl e 11-3 (Cont)
FORTRAN Compiler Diagnostics
(Compilation Errors)
Message

I

Meaning

M-8

SYSTEM ERROR - NO MORE SPACE
FOR RECURSIVE STORAGE

The compiler's work roll is too small to hold the parts of
all the subexpressions this stat"ement implies. Break this
statement" or reassemble the compiler with a larger workroll parameter (WORLEN=1508 at present) •

M-9

TOO MUCH DATA - WRONG ARRAY
SIZE OR LITERAL TOO LONG

The list of DATA constants deFines more words than the
list of DATA variables specifies. This may be due to an
array of the wrong size in the list of DATA variables, or
definition of an integer, real, or logical DATA variabl e
with a Hollerith constant of more than five characters.

M-I0

ILLEGAL DO LOOP CLOSE

Illegal statement terminating a DO loop. (See Section
4.3)

M-ll

MORE DATA NEEDED - LITERAL TOO
SHORT OR TYPE CONVERSION EXPECTED

The list of DATA constants defines fewer words than the
list of DATA variables specifies. This may be due to a
double precision or complex DATA variable defined
with a Hollerith constant of less than six characters, or
a double precision DATA variable defined with a real
constant.

M-12

NON-INTEGER PARAMETER IN 'DO'
STATEMENT

DO statement parameters must" be integers. (See Section
4.3)

M-13

NON-INTEGER SUBSCRIPT

Array subscripts must be integer constants, variables, or
expressions. (See Section 4.3)

M-14

ILLEGAL COMPARISON OF COMPLEX
VARIABLES

The only comparison allowed of complex variables is
.NE. or .EQ. (See Secl"ions 2.2,2.3)

M-15

TOO MANY CONTINUATION CARDS

More than 19 continuation cards. (See Section 1 .1 .2)

M-16

NON-INTEGER I/O UNIT OR
CHARACTER COUNT

The I/o unit variable of a READ;WRITE statement, or
the character count variable of an ENCODE/DECODE
statement, is not an int"eger variable. (See Sections
5.2.6,5.2.7,5.4)

M-17

SYSTEM ERROR-ROLL OUT OF RANGE

Compiler error. Report this message and its circumstances
via a Software Trouble Report.

M-18

SYSTEM ERROR - NO MORE SPACE
FOR RECURSIVE CALLS

The compiler's exit roll is t"OO small to hold the return
addresses for all the recursive subroutine calls this statement requires to be compil ed. Break up the st"atement or
reassemble the compiler with a largel' exit roll parameter
(EXLEN1 :2018 at present).

M-19

ILLEGAL USE OF STATEMENT LABEL

A GO TO or IF statement" transfers to i tse If .

M-20

ILLEGAL RECURSIVE CALL

The statement function called itself. Recursive calls are
illegal in the FORTRAN language.

EXCESSIVE COUNT

The number specified is greater than the maximum possible number of characters in a statement".

OPEN DO LOOPS

The list of statements are specified in DO statements
but not defined.

UNDEFINED LABELS

The list of labels that do not appear in the label field.

Version 26 FORTRAN
Version 32 LlB40

11-7

May 1972

Tabl e 11-3 (Cont)
FORTRAN Compiler Diagnostics
(Compilation Errors)
Message

Meaning

MUL nPL Y DEFINED LABELS

The list of labels that appeared more than once in the
label field.

ALLOCA nON ERRORS

The list of EQUIVALENCEd COMMON variables which
have attempted to extend the beginning of a COMMON
block.

Table 11-4
FORTRAN Operating System Diagnostics
(Execution Errors)
Meaning

Message

I

?BLOCK TOO LARGE OR QUOTA
EXCEEDED ON dey

The user's program attempted to add blocks to a
random access file, which caused the block to be
too large or caused him to exceed his disk quota.

?CANNOT ACCESS FORTR.SHRGETSEG ERROR CODE xx

An error occurred when a GETSEG UUO was issued to
access FORTR.SHR. The codes are listed in Appendix E
of the TOPS-10 Monitor Calls manual.

?dev: NOT AVAILABLE

FORSE. tried to initialize a device which either does not
exist or has been assigned to another job.

?DEVICE NUMBER n IS ILLEGAL

A nonexistent device number was selected.

?DEVICE NUMBER n MUST BE DSK FOR
RAND OM ACCESS

The device for random access operations must be disk.

?DIRECT ACCESS DEVICE NUMBER n IS
ILLEGAL

Only devices 1 through 17 can be used for random
access.

ENCODE - DECODE ERROR

The character count in an ENCODE or DECODE statement was incorrect_

END OF FILE ON dey:

A premature end-of-file has occurred on an input device.

?END OF TAPE ON dey:

The end of tape marker has been sensed during input or
output

?FILE NAME filename.ext NOT ON
DEVICE dey:

Filename .ext cannot be found in the direc10ry of the
:.;peci fi ed davi c e.

?ILLEGAL CHARACTER, x, IN FORtv\AT

The illegal character x is not valid for a FORMAT
sta1ement.

?ILLEGAL CHARACTER, x, IN INPUT S,P.ING

T'le :1!cgal character x is not valid for this type of input.

?ILLEGAL MAGNETIC TAPE OPERA nON,
TAPE dey:

An attempt was made to s!dp a record after performing
output on a magnetic tap~.

?ILLEGAL PHYSICAL RECORD COUNT,
TAPE dey:

FORSE. has encountered an inconsistency in the physiccl
record count on a magnetic tape.

?ILLEGAL USER UUO uuu AT U_ 1.0 IN MAGNITUDE
> 1.0 IN MAGNITUDE

?ASIN OF ARG
?ATTEMPT TO TAKE LOG OF NEGATIVE ARG
?ATTEMPT TO TAKE SQRT OF NEGATIVE ARG
?FLOATING DIVIDE CHECK
?FLOATING OVERFLOW
?FLOATING UNDERFLOW
?INTEGER DIVIDE CHECK
?INTEGER OVERFLOW

Version 26 FORTRAN
Version 32 LlB40

11-9

May 1972

Table 11-4 (Cont)
FORTRAN Operating System Diagnostics
(Execution Erron)
Message

Meaning

The following messages are Issued when a LOOKUP, ENTER, or RENAME UUO error occurs. The number In
parentheses indicates the error code. Refer to Appendix E in the TOPS-10 Monitor Calls manual.
?(O) ILLEGAL FILENAME WAS NOT FOUND FILE xx ON DEVICE yy
?(1) NO DIRECTORY FOR PROJECT -PROGRAMMER NUMBER FILE xx ON DEVICE yy.
?(2) PROTECTION FAILURE FILE xx ON DEVICE yy
?(3) FILE WAS BEING MODIFIED FILE xx ON DEVICE yy
?(4) RENAME FILE NAME ALREADY EXISTS FILE xx ON DEVICE yy
?(5) ILLEGAL SEQUENCE OF UUOS Fn.E xx ON DEVICE yy
?(6) BAD UFO OR BAD RIB FILE xx ON DEVICE yy
?(7) NOT A SAV FILE FILE xx ON DEVICE yy
?(1O) NOT ENOUGH CORE FILE xx ON DEVICE yy
?(11) DEVICE NOT AVAILABLE FILE xx ON DEVICE yy
?(12) NO SUCH DEVICE FILE xx ON DEVICE yy
?(13) NOT TWO RELOC REG. CAPABn.ITY FILE xx ON DEVICE yy
?(14) NO ROOM OR QUOTA EXCEEDED Fn.E xx ON DEVICE yy
?(15) WRITE LOCK ERROR FILE xx ON DEVICE yy
?(16) NOT ENOUGH MONITOR SPACE FILE xx ON DEVICE yy
?(17) PARTIAL ALLOCATION ONLY FILE xx ON DEVICE yy
?(20) BLOCK NOT FREE ON ALLOCA nON FILE xx ON DEVICE yy
NOTE
With the exception of the messages ILLEGAL USER UUO
uuu AT USER loc and ENCODE/DECODE ERROR, all
messages are followed by a second message
LAST FORTRAN

I/o AT USER LOC adr

Several arithmetic error conditions can occur during execution time.
a. Overflow - An attempt was made to create either a positive number greater than the largest representable positive number or a negative number greater in magnitude than the most negative representable
number (in the appropriate mode).
Example: For I an integer,
377777777777

< I < 400000000000 (oc ta I)

b. Underflow - An attempt was made to create either a positive non-zero number smaller than the
smallest representable positive non-zero number or a negative number smaller in magnitude than l:'e
negative number whose magnitude is the small est represcnfabl e.
Version 24 FORTRAN
Version 31 LlB40

11-10

October 1971

Exampl e: For X a real non-zero number,

7n400000000 < X < 000400000000
c.

Divide Check - An attempt was made to divide by zero.

d. Improper Arguments for L1B4O math routines - For example, an attempt was made to find the arc
sine of an argument greater than 1.0.
When overflow, underflow, or divide check errors occur in the user's FORTRAN program, the Monitor calls the

LIMO routine OVTRAP. This routine replaces the resulting numbers, if the numbers are floating point, with
either zero in the case of underflow or ± the largest representable number in the cases of overflow and divide
check. OVTRAP does not affect numbers in integer mode.
Overflow, underflow, and divide check errors occurring in L1B4O math routines are handled differently from
when they occur in the user's program: only if the final answer from a routine is in error is an error condition
considered to exist. If the answer is floating point, it is set to the appropriate value as for user program errors.
Integer answers are handled in various ways. (See the Science Library and FORTRAN Utility Subprograms,
DEC-I0-SFLE-D .)
When an error condition occurs in a user program or in a final answer from a L1B4O math routine, an error message is typed. Presently there are eight distinct error messages.
Error Message

Error Message No.

INTEGER OVERFLOW PC=nnnnnn

I

2

INTEGER DIVIDE CHECK PC=nnnnnn

3

FLOATING OVERFLOW PC=nnnnnn

4

FLOATING UNDERFLOW PC=nnnnnn

5

FLOATING DIVIDE CHECK PC=nnnnnn

6

ATTEMPT TO TAKE SQRT OF NEGATIVE ARG

7

ACOS OF ARG

8

ASIN OF ARG

final

? FA TAL

> 1.0 IN MAGNITUDE
> 1 .0 IN MAGNITUDE

I/o ERROR

NOTE
nnnnnn = location at which the error occurred.
After two typeouts of a particular error message, further typeout of that error message is suppressed. At the end
of execution, a summary listing the octual number of times each error message occurred is typed out. If the user
wishes to permit more than two typeouts for each error message, he may do

50

by calling the routine ERRSET at

the beginning of the executable part of his main program. ERRSET accepts one argument in integer mode. This
argument is the number of typeouts that are permitted for each error message before suppression occurs. This
routine is used to obtain the PC information which would otherwise be lost. Altematively, because of the slowVersion 24 FORTRAN
Version 31 LIB40

11-11

October 1971

ness of the Teletype output, the user may wish to suppress typeout of the messages entirely. This can be done by
calling ERRSET with an argument of zero. Suppression. of typeout can also be accomplished during execution by
typing

to on

the Teletype.

Error messages and the summary are output to the Teletype (or the output device when running BATCH), regardless of the device assignments that have been made.
The treatment of overflow, underflow, and divide check errors in MACRO pragrams (those that are loaded with
OVTRAP) can, to a certain extent, be manipulated by the user. (See OVTRAP in the Science Library and
FORTRAN Utility Subprogram manual.)

Version 24 FORTRAN
Version 31 LlB40

11-12

C ctober 17'/1

CHAPTER 12
FORTRAN USER PROGRAMMING

12.1

ASCII CHARACTER SET
Table 12-1
ASCII Character Set
ASCII
7-Bitt

SIX BIT

Character

040
041
042
043
044
045
046
047

40
41
42
43
44
45
46
47

@

50
51
52
53
54
55
56
57

H
I

/

050
051
052
053
054
055
056
057

20
21
22
23
24
25
26
27

0
1
2
3
4
5
6
7

060
061
062
063
064
065
066
067

60
61
62
63
64
65
66
67

30
31
32
33
34
35
36
37

8
9

070
071
072
073
074
075
076
077

70
71
72
73
74
75
76
77

SIX BIT

Character

00
01
02
03
04
05
06
07

Space

10
11
12
13
14
15
16
17

(
)

!
II

/I

$
%

&
I

*
+

,
-

:

;

<
=

>
?

A
B
C
D
E
F
G

J
K
L
M
N

0
P
Q

R
S
T
U
V

W
X

Y
Z
[

\
]
t

-

ASCII
7-Bitt

Character

,

100
101
102
103
104
105
106
107

a·
b
c
d
e
f
g
h
i

110
111
112
113
114
115
116
117

i

k
I
m
n
0

120
121
122
123
124
125
126
127

p
q
r
s
t
u

v
w

130
131
132
133
134
135
136
137

x

Y
z
{

I
}

-

Delete

ASC,II
7-Bitt
140
141
142
143
144
145
146
147
150
151
152
153
154
155
156
157
160
161
162
163
164
165
166
167
170
171
172
173
174
175
176
177

t FORTRAN IV also accepts the following control codes in 7-bit ASCII:
Horizontal Tab
Line Feed
Revision 1 FORTRAN

011
012

Carriage Return
Form Feed
12-1

015
014
October 1970

12.2

PDP-10 WORD FORMATS

BASIC INSTRUCTIONS
INSTRUCTION CODE

Y

(INCLUDING MODEl

35

IN-OUT INSTRUCTIONS

1111 I 11
0

I'NS~~~~TlONI/I

DEVICE CODE

1 J

Y

X

11 13 14

9 10

I

17 18

35

PC WORD

1000
I I I 0 I 01

flAGS

PC
I

17 18

12: 13

35

BLT POINTER [XWD]
SOURCE ADDRESS

DESTINATION ADDRESS
17 18

35

BLK 1/ BLKO POINTER, PUSHDOWN POINTER, DATA CHANNEL CONTROL WORD [IOWD]

I

- WORD COUNT

ADDRESS-I
35

17 18

BYTE. PO INTER
POSITION P

I

y

SIZE S

5 6

"

12

13

,4

35

17 1e

BYTE STORAGE
f----s

I

BITS

P BITS

BYTE

35-P-S-l

NEXT BYTE
35-P 35-P"

35

FIXED POINT OPERANDS
SIGN

,-

BINARY NUMBER (TWOS COMPLEMENTJ

0+

o ,

35

FLOATI NG POI NT OPERANDS
S6~N

EXCESS 128 EXPONENT

,-

(ONES COMPLEMENT I

o ,

FRACTION (TWOS COMPLEMENTJ
8 9

35

LOW ORDER WORD IN DOUBLE LENGTH FLOATING POINT OPERANDS

o
o ,

EXCESS 128 EX PONENT - 27
IN POSITIVE FORM

LOW ORDER HALF OF FRACTION (TWOS COMPLEMENT I
35

8 9

12-2

In addition to the arithmetic functions, the PDP-10 FORTRAN IV library (LIMO) contains several subprograms
which control FORTRAN IV I/O operations at runtime. The I/O subprograms are compatible with the PDP-10
Monitors.
In general FORTRAN IV I/O is done with double buffering unless the user has either specified otherwise through
calls to IBUFF and OBUFF or is doing random access I/O to the disk. In these cases, single buffers are used.
The standard buffer sizes for the devices normally available to the user are given in Table 12-2.

Note that the

devices and buffer sizes are determined by the Monitor and may be changed by a particular installation. Also a
user may specify buffer sizes for magtape operations through the use of IBUFF and OBUFF.
The logically first device in a FORTRAN program is initialized on software I/O channel one, the second on
software I/O channel two, and so forth.

Software I/O channel 0 is reserved for error message and summary

output. The SIXBIT name of the device that is initialized on channel N can be found in !l dynamic device table
at location DYNDV. + N. A device may be initialized for input and output on the same I/O channel.

Devices

are initialized only once and are released through either the CALL [SIXBIT/EXIT!J executed at the end of every
FORTRAN program or the LIMO subroutine RELEAS.

Table 12-2
PDP-10 FORTRAN IV Standard Peripheral Devices
Name

Mnemonic

Input/Output
Formatted
Unformatted

Buffer Size
In Words

Operation

Card Punch

CDP

Yes

Yes

26

WRITE

Card Reader

CDR

Yes

Yes

28

READ

Disk
(includes disk
packs and drums)

DSK

Yes

Yes

128

READ,lWRITE

DECtapes

DTA

Yes

Yes

127

READ,lWRITE

Line Printer

LPT

Yes

No

26

WRITE

Magtape

MTA

Yes

Yes

128

READ,lWRITE

Plotter

PLT

Yes

Yes

36

WRITE

Paper Tape Punch

PTP

Yes

Yes

33

WRITE

Paper Tape Reader

PTR

Yes

Yes

33

READ

Pseudo Teletype

PTY

Yes

No

17

READ,lWRITE

Teletype - User

TTY

Yes

No

17

READ,lWRITE

Teletype - Console

CTY

Yes

No

17

READ,lWRITE

12-3

12.3.1

Logical and Physical Peripheral Device Assignments

Logical and physical device assignments are controlled by either the user at runtime or a table called DEVTB.
The first entry in DEVTB. is the length of the table. Each entry after the first is a sixbit ASCII device name.
The position in the table of the device name corresponds to the FORTRAN logical number for that device. For
example, in Table 12-3, magnetic tape 0 is the 16th entry in DEVTB. Therefore, the statement
WRITE (16, 13)A
refers to magnetic tape O. The last five entries in DEVTB. correspond to the special FORTRAN statements READ,
ACCEPT, PRINT, PUNCH, and TYPE. Any device assignments may be changed by reassembling DEVTB.

If the user gives the Monitor command
ASSIGN DSK 16
prior to the running of his program, a file named FOR16.DAT would be written on the disk. Similarly, the
Monitor command
ASSIGN LPT 16
causes output to go to the line printer.

12.3.2

12.3.2.1

DECtape and Disk Usage

Binary Mode - In binary mode, each block contains 127 data words, the first of which is a record

control word of the form:

where w is the word count specifying the number of FORTRAN data words in the block (126 for a full block) and
n is 0 in all but the last block of a logical record, in which case n is the number of blocks in the logical record.

I

A logical record contains all the data corresponding to one READ or WRITE statement, that is, the maximum number of logical records per disk/DECtape block is one.

12.3.2.2

ASCII Mode - In ASCII mode, blocks are packed with as many full lines (a line is a unit record as

specified by a format statement) as possible. Lines always begin with a new word. If a line terminates in the
middle ofa word, the word is filled out with null characters and the next line begins with the next word. Lines

I

are not split across blocks. Such a file is created by FORTRAN during output or by PIP with the A switch.
FORTRAN input files must be in this format.

Revision 1 FORTRAN

12-4

October 1970

Table 12-3
Device Table for FORTRAN IV
TITLE
SUBTIL

DEVTB V.017
1-APR-69

ENTRY
ENTRY
ENTRY
P=17

DEVTB., DEVND. ,DEVLS. ,DVTOT.
MTABF., MBFBG., TABPT ., TABP1.
MTACL. ,DATIB., NEG1.,NEG2. ,NEG3. ,NEG5.

DEVTB.:

EXP

DEVND.-.

SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT

.DSK.
.CDR.
.LPT.
.CTY.
.TTY.
.PTR.
.PTP.
· DIS.
· DTAl.
.DTA2.
.DTA3.
.DTA4.
.DTAS.
.DTA6.
.DTA7.
.MTAO.
.MTAl.
.MTA2.
.FORTR.

SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT
SIX BIT

.DSKO.
· DSK l.
.DSK2.
.DSK3.
.DSK4.
· DEVl.
.DEV2.
.DEV3.
.DEV4.
.DEVS.
.REREAD.
.CDR.
.TTY.
.lPT.
· PTP.
.TTY.

CDRPOS:
LPTPOS:
TTYPOS:
PTPPOS:

DEVLS. :

DEVND.:

OF ENTRIES
iLOGICAL# ,/FILENAME/DEVICE
i 1 FOROL OAT
DISC
CARD READER
i 2 FOR02. OAT
i 3 FOR03. DAT
LINE PRINTER
i 4 FOR04. DAT
CONSOLE TELETYPE
i S FOROS. DAT
USER TELETYPE
PAPER TAPE READER
i 6 FOR06. DAT
; 7 FOR07.DAT
PAPER TAPE PUNCH
; 8 FOR08. DAT
DISPLAY
; 9 FOR09. DAT
DECTAPE
; 10 FOR10.DAT
ill FOR11.DAT
; 12 FOR12.DAT
; 13 FOR13.DAT
; 14 FOR14.DAT
i lS FOR1S.DAT
MAGNETIC TAPE
; 16 FOR16. DAT
; 17 FOR17.DAT
; 18 FOR18.DAT
ASSIGNABLE DEVICE, FORTR
; 19 FORTR. DAT

iNO.

; 20
i 21
; 22
; 23
; 24
; 2S
; 26
i 27
i 28
; 29

FOR20.DAT
FOR21. DAT
FOR22.DAT
FOR23.DAT
FOR24. DAT
FOR2S. DAT
FOR26. DAT
FOR27. DAT
FOR28. DAT
FOR29. DAT
-6
-S
-4
-3
-2
-1

DISK

ASSIGNABLE DEVICES

V.OO6
REREAD
READ
ACCEPT
PRINT
PUNCH
TYPE

12.3.2.3 File Names - File names may be declared for DECtapes or the disk through the use of the library subprograms IFIlE and ~ALE. In order to make an entry of the file name FILE1 on unit u, the following statement
could be used:

12-S

I

CALL OALE (u,'FILE1')
Similarly, the following statements might be used to open the file, RALPH, for reading:
RALPH=5HRALPH
CALL IFILE(u, RALPH)
After writing a file, the END FILE u statement must be given in order to close the current file and allow for
reading or writing another file or for reading or rewriting the same file. If no call to IFILE or OFILE has been
given before the execution of a READ or WRITE referencing DECtape or the disk the file name FORnn.DAT is
assumed where nn is the FORTRAN logical number used in the I/O statement that references device nn.
The FORTRAN programmer can make logical assignments such that each device has its own unique file as intended, but each can be on the DSK. In order to use the devices available, the programmer can make assignments
at run time and assign the DSK to those not available.
For example, the FORTRAN logical device numbers, e.g., 1 = DSK, 2 = CDR, 3 = LPT, are used in the file
name. The written file names are FOR01.DAT, FOR02.DAT, etc. The same is true for READ. For example, a
WRITE (3, 1) A, B, C, in the FORTRAN program generates the file name FOR03.DAT on the DSK if the DSK has
been assigned LPT or 3 prior to running the program. (Note: REREAD rereads from the file belonging to the device last referenced in a READ statement, not FOR-6.DAT, as usual.) The progrommer must, of course, realize
his own mistake in assigning the DSK as the TTY in the case that FORSE tries to type out error messages or
PAUSE messages.
More than one DSK File may be accessed, without making logical assignments at runtime, by using loyical device numbers 1, and 20 through 24 in the FORTRAN program. Logical device number 19 refers to logical device
FORTR which must be assigned at runtime and accesses file name FORTR. DAT to maintain compatibility with the
past system of default file name FORTR. DAT. In all cases when the operating system fails to find a file specified,
an attempt wi II be made to read from fi Ie FORTR. DAT a~ before.
The magnetic tape operation REWIND is simulated on DECtape or the disk; a REWIND closes the file and clears
the filename. A call to IFILE or OFILE should be made after

0

REWIND to open the file and preserve the file-

name, if desired. A program which uses READ, WRITE, END FILE, and REWIND for magnetic tape need only
have the logical device number changed or assigned to a DECtape or disk at runtime in order to perform the
proper input/output sequences on DECtape or the disk.

12.3.3

Magnetic Tape Usage

Magnetic tape and disk/DECtape I/O are different in the following ways. When a READ is issued, a record is
read in for both magnetic tape and disk. If a WRITE is then issued, the next sequential record is written on

Version 26 FORTRAN
Version 32 LIB40

12-6

I

magnetic tape but not on disk. When one or more READs have been executed on a disk file and a WRITE is
issued, the next record is written. Unless records are written past the existing end-of-file, ,that end-of-file is
not changed, i.e., the file is not truncated.

12.3.3.1

Binary Mode - The format of binary data on magnetic tape is similar to that for DECtape except that

the physical record size depends on the magnetic tape buffer size assigned in the Time-Sharing Monitor or by
IBUFF/OBUFF (see Section 8.2.2). Normally, the buffer size is set at either 129 or 257 words so that either
128 or 256 word records are written (containing a control word and 127 or 255 FORTRAN data words).
The first word, control word, of each block in a binary record contains information used by the operating system. The left half of the first word contains the word count for that block. The right half of the first word contains a null character except for the last block in a logical record. In this case, the right half of the first word
contains the number of blocks in the logical record.

12.3.3.2

ASCII Mode - The format for ASCII data is the same as that used Qn DECtape.

12.3.3.3

Backspacing and Skipping Records - Both the BACKSPACE u and SKIP RECORD u statements are ex-

ecuted on a logical basis for binary records and on a line basis for ASCII records.
a. Binary Mode - Both BACKSPACE and SKIP RECORD space magnetic tape physically over one (1)
logical record; i.e., the result of one WRITE (u) statement.
b. ASCII Mode - ASCII records are packed, that is WRITE (u, f) statements do not cause physi cal writing on the tape until the output buffers are full or a BACKSPACE, END FILE, or REWIN D command is
executed by the program. BACKSPACE and SKIP RECORD on ASCII record space over one (1) line.
c"

12.4

BACKSPACE and SKIP RECORD following WRITE ASCII commands.

(1)

BACKSPACE closes the tape, writes 2 EOF's (tapemark) and backspaces over the last line.

(2)

SKIP RECORD cannot be used during a WRITE operation. This is an input function only.

RANDOM ACCESS PROGRAMMING

In random access programming, data is obtained from (or placed into) storage, where the time required for this
access is independent of the location of the data most recently obtained from (or placed into) storage. Random
access programming allows a programmer to access any record within a file with a single READ or WRITE statement independent of the location of the previously accessed record within that file. For example, a programmer may read or write only the 10th record in

C1

file if he wishes. Random I/O is desirable when only a few

records in a large fi Ie are to be accessed, or when a file is to be read or wirtten in a non-sequential manner, as
in a sort.

Revision 2 FORTRAN

12-7

February 1971

Random access applies only to data tiles on

lhe

disk

with

tlx€:d-le"9th

record sizes.

/..:.,ny !;;.'RITE (J#K,I) D,E,F
FORI",AT (3AS)

A new file is not created; the old file remains with the Kth record changed.

Example 3:
The following code creates a new file for random output by first writing K blank records and then updating the file in non-sequential output:

r

40 SPACES PER RECORD USERS
NEED NO ~ORR~ AROUT CARRIAGE
RETURNS AND LINE FEEDS·

I Vl

DIMENSION A(B), P(8)
DO IVl I=I,K
\>.' RITE (I, I) A

?Vl
I
?

CALL DEFINE FILE (?,4Vl,N, 'FOR01 .DAT',0,0)
N=3
DO ?Vl I =: I , S
WRITF (?#N*B,2) 8
FORMAT (BAS)
FORI"AT (415,?AS,FIVl,3)

C

c

Example 4:
Read a 1000 record file, the records of which are 27 characters long, backwards. The file is named
FOR01.DAT and resides on the user's disk area. The following program creates a disk file and then reads
it backwards. (Note that the same unit number may not be used for both sequential and random I/O in the
i

: same program):

12-10

I Vl

?0
?

[)IMFNSION A(f,)
CALL [)FFINF FILl' (?,?7,NV,'FOR01.DAT',Vl,VI)
DO IV'I 1=1, 1000
"','R I TF (I, I) I
Rf'1..'INn (I)
FORMAT ('THIS IS R~CORD NUI"JRER', 15)
NV=IV'lVl?
DO 20 1=1,1000
R~AD
(2#NV-2,2) A
FORMAT(5A5,A2)
END

Example 5:
Use random WRITES to change every 7th record, beginning with record 10, in the file named DATA on
the user's disk area. The file contains 100 records, each of which is 35 characters long.

10
5

DIMFNSION lIST(7)
CALL DEFINE fllE(5,35,NV, 'DATA',0,0)
DO 10 1=\0,100,7
WRITF (5#1,5) lIST
fORMAT (2A5,515)
E'ND

Example 6:
Read one-word binary records, starting with record 26 and ending with record 7, from file FOR07.DAT.
The following program creates a 50-record file of the numbers from 1 to SO, reads the file backwards,
and types the contents of the record it read, NP, along with the contents of the associated variable,
NV. Note that FORTRAN binary output creates files with a maximum of one record per disk block •
• TY FliNTST
C
FlINARY RANDOM ACCESS TEST
C

7

2
5

DOUFll~ PRECISION I'll
DATA I'll I'FOR07.DAT'1
CALL DEFINE FILE (2,\,NV,FIL,0,0)
DO 7 1=1,50
WRITE(7)!
CONTINUE
END 1'1 lE (7)
NV=28
DO 2 I = I ,20
READ(2#NV-2)NP
WRlTE(5,5)NP,NV
CONTINUE
FORMAT(' NP= ',13,' NV= ',13)
END

12-11

RllN DSK RINTST
NP=
NP=
NP=
NP=
NP=
NP=
NP=
NP=
NP=
NP=
NP=
NP=
NP=
NP=
NP=
NP=
NP=
NP=
NP=
NP=

Revision 2 FORTRAN

,?f,

'?5
'?L!
23

??
21

20
19
1B
17
1 f,
15
14
I 3
12
I 1
10

9
8
7

NV=
NV=
NV=
NV=
NV=
NV=
NV=
NV=
NV=
NV=
NV=
NV=
NV=
NV=
NV=
NV=
NV=
NV=
NV=
NV=

?7
,?f,

25
2L!
23
22
21

20
19
18
I 7
1 (,
15
14
13
12
11
10

9
8

12-12

February 1971

I

12.5 PDP-10 INSTRUCTION SET

I
I I

Movl~Negative l--~
e Magnitude
e Swapped

l

f-

Half word {Right to {Right}
Left
Left

f

~n:~fect
Zeros

t

I:~~diate to AC

ADD
SUBtract
MULtiply
Integer MULtiply
DIVide
Integer DIVide

~~ ~~~ory

F10atmg AdD

Extend sign
EXCHange

AC

and memory

Immediate
to Memory

rand Round

Floating SuBtract
Floating MultiPly
F10atmg DiVide

BLock Transfer

-=.JII I:

Both

Long
to Memory
to Both

use present pOinter} d I loaD Byte into AC
Increment pointer an \ DePosit Byte in memory

Floating SCale

Increment Byte Pointer

Unnormalized Floating Add

PUSH down} { POP up
and Jump

Arithmetic SHift
Logical SHift
ROTate

Double Floating Negate

I{

C- b' d
om me

Zeros
Ones
SET to Ac
Memory
Complement of Ac
Complement of Memory

to SubRoutine
and Save Pc
and Save Ac
and Restore Ac
if Find First One
on Flag and Clear it
on OVerflow (JFCL 10,)
Jump
on CaRrY 0 (JFCL 4,)
on CaRrY 1 (JFCL 2,)
on CaRrY (JFCL 6,)
on Floating OVerflow (JFCL I,)
and ReSTore
and ReSTore Flags (JRST 2,)
and ENable PI channel (JRST 12,)

Il

I

AC

to

AND
} :ith Complement of Ac
inclusive OR
with Complement of Memory ,Complements of Both

I

AC Immediate
Memory
Both

Inclusive OR
eXclusive OR - - - - - - - - - - - - EQuiValence
never
Less
Equal
Less or Equal
\ r memory and SkiP} 'f
Add One to
Subtract One from
AC and Jump
II-I-. Always
Greater
Immediate }
"
Compare Ac \ , h M
and skip If ACGreater or Equal
Wit
emory
Not equal

SKIP if memory}
JUMP if AC
-----------.

HALT

eXeCuTe

I\

, {POSitive
Add One to Both halves of AC and Jump If N
'
egatlve

T
est

AC

I

with Direct mask
with Swapped mask
Right with E
Left with E

Revision 1 FORTRAN

II

(JRST 4,)

DATA}
BlocK : { { I n

Out

CONditions

II

No modification
set masked bits to Zeros
d k'
set masked bits to Ones
an s Ip
Complement masked bits

12-13

,
,
d Sk' 'f all masked bits Zero
m an
Ip I \ some masked bit One

I

never
if all masked bits Equal 0
if Not all masked bits equal 0
Always

October 1970

APPENDIX A
THE SMALL FORTRAN IV COMPILER

This compiler runs in 5.5K of core, and to the user, is identical to the large compiler, with the exception of the
following language differences. Operating procedures are given in the Systems User's Guide (DEC-10-NGCC-D).

Language Differences
The IMPLICIT, DATA, and NAMELIST statements are not recognized; constant strings are not collapsed (for example, A=5*3 will not be treated as A=15).

A-l

INDEX
ACCEPT Statement, 5-1, 5-20, 7-7

Buffer, 12-3

Accumulator, 10-1
Accumulator conventions, 10-1

sizes, 12-3
BUFFER subroutine, 8-8

Adjustable dimensions, 6-3
A format, 5-6

CALL statement, 7-5, 7-7

Alphanumeric fields, 5-6

Carriage control, 5-7, 5-10

ALPHI., 8-2

Chain files, 8-8

ALPHO., 8-2

CHAIN subroutine, 8-8

Argument, def., 2-6

Character set, 1-3, 12-1

Arithmetic error conditions, 11-10

Closed subroutines, 7-1

Arithmetic function definition statement, 7-1, 7-9

Coding form, 1-2

Arithmetic operations on complex numbers, 2-3

Comment line, 1-3

Arithmetic statement, 3-1

Common block, 6-4

Array dimensioning, 2-4, 6-2

COMMON statement, 6-4, 6-6, 7-8

Array variables, 2-4

Common storage, 6-4

ASCII character set, 12-1

Compiler diagnostics
command errors, 11-2
compilation errors, 11-3

ASCII mode
DECtape, 12-4
disk, 12-4
magnetic tape, 12-7
Assigned GO TO statement, 4-2, 7-7
ASSIGN Statement, 4-2, 7-7

Compiler switches, 11-1
COMPLEX (type declaration statement), 6-8, 7-8
Complex constants, 2-2
Complex fields, 5-8
Complex subexpression, 2-7

BACKSPACE statement, 5-1, 5-20, 7-7

Compound expressions

Binary mode
DECtape, 12-4
disk, 12-4
magnetic tape, 12-7
BINWR., 8-3

logical, 2-10
numeric, 2-7
Computed GO TO statement, 4-1, 7-7
Constants
integer, 2-1
real, 2-1
double precision, 2-2
octal, 2-2
complex, 2-2
logical, 2..,3
literal, 2-3

Blank common, 6-4
Blank fields, 5-11
Blank records, 5-9
BLOCK DATA statement, 6-8, 7-6, 7-8
BLOCK DATA subprogram, 7-6
Block identifier, 6-4

CONTINUE statement, 4-6, 7-7

Block name, 6-4

1-1

INDEX (Cont)
Control statements, 4-1, 7-7
CALL, 7-5
GO TO, 4-1
IF, 4-2
DO, 4-4
RETURN, 7-5
CONTINUE, 4-6
PAUSE, 4-6
STOP, 4-7
END, 4-7

DEVTB., 12-4
D format, 5-2 - 5-6
Diagnostic messages
command, 11-2
compilation, 11-3
execution, 11-8
DIMENSION statement, 6-2, 7-8
adjustable dimension, 6-3
DIRT., 8-2

Data record, 5-15

Disk usage, 12-4

DAT A statement, 6-6, 7-8

DO loops, 4-4

Data specification statements, 6-1

DO statement, 4-4, 7-7

DATA, 6-6, 7-8
BLOCK DATA, 6-8, 7-6, 7-8

DOUBLE PRECISION (type declaration
statement), 6-8, 7-9

Data specification subprogram, 6-8

Double precision constants, 2-2

Data transmission statements, 5-1, 7-7

Double word, 2-7, 2-9

ACCEPT, 5-20
DECODE, 5-21
ENCODE, 5-21
PRINT, 5-15
PUNCH, 5-16
READ, 5-18
REREAD, 5- 19
TYPE, 5-16
WRITE, 5-16

DOUBT., 8-2
Dummy arguments, 7-2, 7-3
Dummy identifiers, 7-1, 7-2
DUMP, 8-9

E format, 5-2 - 5-6

DATA. UUO, 8-3

ENCODE statement, 5-21, 7-8

DATE subroutine, 8-8

ENC. UUO, 8-4

DECODE statement, 5-21, 7-7

END FILE statement, 5-20

DECtape

us~ge,

12-4

END statement, 4-7

DEC. UUO, 8-4

EOF1 subroutine, 8-9

Defined locations, 10-1

EOFC subroutine, 8-9

DEFINE FILE, 5-17, 12-8

EQUIVALENCE statement, 6-5

Device assignments, 12-4

ERRSET subroutine, 8-9

Device control statements, 5-20, 7-7, 7-8

EXIT subroutine, 8-9

BACKSPACE, 5-20
END FILE, 5-20
REWIND, 5-20
SKIP RECORD, 5-20
UNLOAD, 5-20
Device table, 12-5

Expressions, 2-6
numeric, 2-6
logical, 2-8
EXTERNAL statement, 7-6,7-9
Externa I subprograms, 7-1

1-2

INDEX (Cont)
F format, 5-2 - 5-6

GO TO statement
assigned, 4-2, 7-7
computed, 4-1, 7-7
unconditional, 4-1, 7-7

Field delimiters, 5-6
Field specifications, 5-2
Field width, 5-2 - 5-6
FIN. UUO, 8-3
FLIRT., 8-2

H-conversion, 5-6, 5-7
Hierarchy

FLOUT., 8-2

of numeric operators, 2-8, 2-10
of logical operators, 2-9
of relational operators, 2-9

Formats stored as data ,5-9
FORMAT statement, 5-1
numeric fields, 5-2
logical fields, 5-5
variable field width, 5-5
alphanumeric fields, 5-6
mixed fields, 5-7
complex fields, 5-8
multiple records, 5-8
blank fields, 5-11
FORSE., 8-1
format processi ng, 8- 1
I/o device control, 8-2
UUO dispatching, 8-2
FORTRAN operating system, 8-1
FORSE., 8-1
I/O conversion routines, 8-2
FORTRAN UUO's, 8-3
FORTRAN program and MACRO subprogram
linkage, example of, 9-3
FORTRAN UUOs, 8-3
Function, def., 2-6
Function identifier, 2-6, 7-2
FUNCTION statement, 7-2

IBUFF, 8-8
IFILE subrouti ne, 8-9
I format, 5-2 - 5-6
IF statement
logical, 4-3, 7-7
numerical, 4-3, 7-7
ILL subroutine, 8-10
IMPLICIT statement, 6-9, 7-9
INF. UUO, 8-3
Instruction set, 12-13
INTEGER (type declaration statement), 6-8, 7-9
Integer constants, 2-1, 6-6
Internal subprograms, 7-1
INTI., 8-2
INTO., 8-2
IN. UUO, 8-3

I/o conversion routines,
I/o list, 5-14

8-2

I/O records, 5-15

FUNCTION subprograms, 7-2
FUNCTION statement, 7-2
Function subprogram linkage, example of, 9-3
Function type, 2-6, 7-3
Function value, 2-6

LEGAL subroutine, 8-10
L format, 5-5

LIMO, 8-1
Library functions, 8-4
Library subprograms, 7-1, 8-4

G Format, 5-2 - 5-6

Library subroutines, 8-8
Line continuation field, 1-1

1-3

INDEX (Gmt)
Line format, 1-1

Non-executable statements

Line spacing, 5-10

FORMAT statement, 5-1
NAME LIST statement, 5-11

LINT., 8-2

Normal exit of a DO statement, 4-4

Literal constants, 2-3

Numeric expressions, 2-6

Locations

Numeric fields, 5-2

defined, 10-1
required, 10-1

repetition of, 5-8
repetition of groups, 5-8

LOGICAL (type declaration statement), 6-8, 7-9

Numeric IF statement, 4-3, 7-7

Logical constants, 2-3

Numeric operations, 2-8

Logical expressions, 2-8

Numeri c operators, 2-6

Logical fields, 5-5
Logical IF statement, 4-3, 7-7

OBUFF, 8-8

Log ica I operators, 2-9, 2-10

Octal constants, 2-2

LOOPS, DO, 4-4

OCTI., 8-3

LOUT., 8-2

OCT 0, 8-3
OFILE subroutine, 8-10

MACRO main programs, 9-10

o format, 5-2 - 5-6

MACRO subprograms, 9-1

Open subroutines, 7-1

MAGDEN subroutine, 8-10

Operating system diagnostics, 11-8

Magneti c tape usage, 12-6

Operators

Magnitude

logical, 2-9
numeric, 2-6
relational, 2-9
priorities of, 2-10

of integer constants, 2-1
of real constants, 2-1
of double-precision constants, 2-2
Mixed Fields, 5-7

OUT UUO, 8-3
0

MTOP UUO, 8-3
0

OUTF UUO, 8-3
0

Multiple record formats, 5-8
termination of, 5-9

PAUSE statement, 4-6, 7-7
PDUMP subroutine, 8-10

NAMELIST statement, 5-1 , 5-11 7-9
.

'

Precision

input data, 5-12
output data, 5-13
Nested DO Loops, 4-4, 4-5
NLI. UUO, 8-3
NLO. UUO, 8-4

of double-precision constants, 2-2
of real constants, 2-1
PRI NT statement, 5-15, 7-8
Priorities of operators, 2-8, 2-10
PU NC H statement, 5-16, 7-8

NMLST.,8-3

1-4

INDEX (Cont)
Range of a DO statement, 4-5

Statement field, 1-2

Random access of records, 12-7

STOP statement, 4-7, 7-7

WRITE, 5-17, 7-8
READ, 5-18, 7-8

Storage specification statements, 6-2
COMMON,6-4
DIMENSION, 6-2
EQUIVALENCE, 6-5

READ statement, 5-17, 7-8
REAL (type declaration statement), 6-8, 7-9
Rea I constants, 2-1
Relational operators, 2-9
RELEAS subroutine, 8-10
Repetition
of field specifications, 5-8
of groups, 5-8
Replacement operator, 3-1
Required locations, 10-1

Stored formats, 5-9
SUBSCRIPT INTEGER (type declaration
statement), 6-8, 7-9
Subprogram calling sequences, 9-1
Subprogram linkage, example of, 9-2
Subroutine linkage, example of, 9-2
SUBROUTINE statement, 7-4
Subroutine subprograms, 7-4
SUBROUTINE statement, 7-4
CALL statement, 7-5
RETURN statement, 7-5

REREAD statement, 5-19, 7-8
RERED. UUO, 8-3
RESET. UUO, 8-3

Symbolic logic, 2-8

RETURN statement, 7-5, 7-7
REWIND statement, 5-20,7-8
RTB. UUO, 8-3

Tab, horizontal, 1-1
Termination of a program, 4-7
T format, 5-10a

SAVRAN subroutine, 8-10

TIME subroutine, 8-11

Scalar variables, 2-4

Type declaration statements, 6-8, 7-8

Scale factor, 2-1, 2-2, 5-4

TYPE statement, 5-16, 7-8

SETRAN subroutine, 8-10
SKIP RECORD statement, 5-20, 7-8
SLIST. UUO, 8-3
SLITE subrouti ne, 8-11
SLITET subroutine, 8-11
Spacing, 5-10a

Unconditional GO TO statement, 4-1, 7-7
Unit records, 5-2
UNLOAD statement, 5-20, 7-8
Variable field width, 5-5
Variables

Specification statements, 6-1, 7-8
data specification, 6-6
storage specification, 6-2
type declaration, 6-8
SSWTCH subroutine, 8-11
Statement number field, 1-1

Scalar, 2-4
Array, 2-4
Word format, 12-2
WRITE statement, 5-16, 7-8
WTB. UUO, 8-3

Statement numbers, 1-1
X format, 5-11

1-5



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.6
Linearized                      : Yes
XMP Toolkit                     : Adobe XMP Core 4.2.1-c041 52.342996, 2008/05/07-21:37:19
Modify Date                     : 2017:08:04 02:03:17-07:00
Create Date                     : 2007:07:15 20:21:15+10:00
Metadata Date                   : 2017:08:04 02:03:17-07:00
Creator Tool                    : Adobe Acrobat 7.08
Format                          : application/pdf
Document ID                     : uuid:64f9d0c6-742b-4e2e-a6af-465e100f7e6d
Instance ID                     : uuid:ec2eec8c-59f3-d94e-8f02-cb267853a71a
Producer                        : Adobe Acrobat 9.0 Paper Capture Plug-in
Page Layout                     : SinglePage
Page Count                      : 158
Creator                         : Adobe Acrobat 7.08
EXIF Metadata provided by EXIF.tools

Navigation menu