Sigma XDS 5 User manual

Scientific
Data
Systems
A XEROX
COMPANY
X1ClS
SIGMA
5/7
FLAG
Reference Manual

FLAG
REFERENCE
MANUAL
for
XDS
SIGMA
5/7
COMPUTERS
PRELIMINARY
EDITION
90
16
54A
September 1969
Pri
ce:
$4.
00
Xerox
Data
Systems/701 South
Aviation
Boulevard/EI Segundo,
California
90245
© 1969, Xerox Data Systems, Inc. Printed in U.S.A.

ACKNOWLEDGMENT
The FLAG (Fortran Load And
Go)
Compiler
was
developed
by
Norman
Wheeler,
Robert
Horton,
Phillip
Sherrod,
and
Douglass Henry
under
the
direction
of
Dr.
George
Haynam
of
the
Vanderbi
It
University
Computer
Center,
Nashvi
lie,
Tennessee.
In
cooperation
with VanderbiIt
University,
Xerox
Data
Systems is making
the
FLAG
Com-
piler
available
to
those customers who
require
the
characteristics
of
a fast
load-and-go
FORTRAN.
The
reference
material
in this manual was
largely
taken
from
the
XDS Sigma
5/7
FORTRAN
IV-H
Reference
Manual (XDS
90
0966)
though several
important
sections
have
been
ex-
cerpted
from
the
XDS Sigma
5/7
FORTRAN IV
Reference
Manual (XDS
900956),
notably
all
the
material
in
Chapter
6
dealing
with FORMAT
statements
and
specifications
and
with
extended
input/output
capabilities.
Furthermore, FLAG provides most
of
the
function
sub-
programs
that
are
available
to FORTRAN
IV
users. These subprograms
are
listed in
"Table
9
Intrinsic
and
Basic External
Functions",
taken
from
the
previously
mentioned
FORTRAN IV
Reference
Manua
I.
RELATED
PUBLICATIONS
Title
XDS Sigma 5
Computer
Reference
Manual
XDS Sigma 7 Computer Reference
Manual
XDS Sigma
5/7
Batch Processing
Monitor
Reference
Manual
XDS Sigma
5/7
Batch Processing Monitor
Operations
Manual
XDS Sigma
5/7
FORTRAN IV-H
Reference
Manual
XDS Sigma
5/7
FORTRAN IV Reference
Manual
XDS Sigma
5/7
FORTRAN IV
Operations
Manual
XDS Sigma
5/7
FORTRAN IV Library
Technical
Manual
NOTICE
Publication
No.
900959
90
0950
900954
901198
900966
900956
90
11
43
90
15 24
The
specifications
of
the
software system
described
in this
publication
are
subject
to
change
without
notice.
The
availability
or performance
of
some
features
may
depend
on a
specific
configuration
of
equipment
such as
additional
tape
units or
larger
memory. Customers should
consult
their
XDS sales
representative
for
details.
ii

CONTENTS
l.
INTRODUCTION
Input/Output
Statements
28
How This
Manual
Is
Organized
The FLAG
Compiler
1
FLAG Programs 1
Conditional
Compilation
- X
Cards
3
Formatted
Input/Output
Statements
29
Acceptable
FORTRAN
II
Statements
30
Intermediate
Input/Output
Statements
31
END
and
ERR
Forms
of
the
READ
Statements
32
NAME
LIS
T
Statement
32
Simplified
Input/Output
32
2. DATA 5 OUTPUT
Statement
33
Limits
on
Values
of
Quantities
5
Constants
5
Integer
Constants
5
Real
Constants
6
Double
Precision
Constants
6
Complex
Constants
6
Double
Complex
Constants
7
Logical
Constants
7
Literal
Constants
7
Identifiers
8
Variables
8
Sca
lars 8
Arrays
8
Functions
9
INPUT
Statement
Using NAME
LIST
34
FORMAT
Statement
37
F
Format
(Fixed
Decimal
Point) 38
- E Format
(Normalized,
with
E Exponent) 39
D
Format
(Normalized,
with
D
Exponent)---
40
G Format
(General)
--
40
I
Format
(Integer)
42
L Format
(Logical)
42
A
Format
(Alphanumeric)
43
R Format
(Alphanumeric,
Right-Justified)
___
44
Z Format
(Hexadecimal)
45
M Format
(Machine
Dependent)
46
H
Format
(Hollerith)
47
'Format
(Hollerith)
47
X
Specification
(Skip;
Space
or
Backspace)
__
48
T
Specification
(Tab) 49
3. EXPRESSIONS
10
P
Specification
(Scale
Factoror
Power
of
10) 49
Arithmetic
Expressions
10
Evaluation
Hierarchy
10
Mixed
Expressions
12
Relational
Expressions
13
Logical
Expressions
14
Logical
Operators
14
Evaluation
Hierarchy
15
/
Specification
(Record
Separator)
51
Parenthesized
FORMAT
Specifications
52
Adjustable
FORMAT
Specifications
53
Numeric
Input
Strings
54
Widthless
Numeric
Input
55
Numeric
Input
with
Width
Specified
56
Comma
Field-Termination
56
FORMAT
and
List
Interfac
ing 57
4.
ASSIGNMENT
STATEMENT
16
FORMATs
Stored
in
Arrays
58
Extended
Input/Output
Capabilities
59
5.
CONTROL
STATEMENTS
18
Memory-to-Memory
Data
Conversion
59
ENCODE
Statement
60
Labels
18
DECODE
Statement
60
GOT
0
Statem
ents
18
Direct
Input/Output
61
Unconditional
GO
TO
Statement
18
BUFFER
IN
62
Assigned
GO
TO
Statement
18
BUFFER
OUT
62
Computed
GO
TO
Statement
19
Random
Access
Input/Output
Statements
63
ASSIGN
Statement
19
Auxi
I
iary
Input/Output
Statements
63
IF
Statements
20 REWIND
Statement
64
Arithmetic
IF
Statement
20 BACKSPACE
Statement
64
Logical
IF
Statement
20 END
FILE
Statement
64
CALL
Statement
21
Carriage
Control
for
Printed
Output
64
RETURN
Statement
22
DO
Statement
22
CONTINUE
Statement
25
7.
DECLARATION STATEMENTS
65
PAUSE
Statement
25
Classification
of
Identifiers
65
STOP
Statement
25
Implicit
Declarations
65
END
Statement
26
Explicit
Declarations
65
Confl
icting
and
Redundant
Declarations
65
6.
INPUT/OUTPUT
27
Array
Declarations
66
Array
Storage
66
Input/Output
Lists 27
References
to
Array
Elements
66
List Items 27
DIMENSION
Statement
67
Special
List
Considerations
28 IMPLICIT
Statement
67
iii

Explicit
Type
Statements
68
APPENDIXES
Optional
Size
Specifications
69
Storage
Allocation
Statements
70
A. FLAG STATEMENTS
98
COMMON
Statement
70
B.
DIAGNOSTIC
MESSAGES
100
Labeled
COMMON
71
Blank
COMMON
71
Arrangement
of
COMMON
72
Referencing
of
Data
in
COMMON
73
EQUIVALENCE
Statement
73
Interactions
of
Storage
Allocation
Statements
_
75
ILLUSTRATIONS
EXTERNAL
Statement
76
BLOCK DATA Subprograms
76
1.
Sample
XDS FLAG Program 2
DA
TA
Statement
77
DATA
Variable
List
77
2.
Array
Storage
66
DA
TA
Constant
Li
st
78
3.
FLAG
Job
Setup
-
Single
Program
96
Placement
and
Order
of
Declaration
Statements
79
4.
FLAG
Job
Setup
-
Multiple
Programs in Batch
8. PROGRAMS
AND
SUBPROGRAMS
80
Processing
Mode
97
Main
Programs
80
Subprograms
80
Statement
Functions
80
FUNCTION
Subprograms
81
SUBROUTINE Subprograms
82
TABLES
Arguments
and
Dummies
83
Dummy
Scalars
84
l.
Sample
Program 3
Dummy
Arrays
84
2.
Mode
of
Mixed
Expressions Using
Adjustable
Dimensions
85
Operators
+ - * /
12
Dummy Subprograms
86
Library Subprograms
86
3.
Valid
Type
Combinations
for
Exponentiations
12
Basic
External
Functions
86
4.
Evaluation
of
Logical
Expressions
14
Additional
Library Subprograms
86
r:::.
f\,~ixed
VOiiob!e
Types
and Expression
"-Aodes
__
16
-'.
9.
OPERATIONS
93
6.
Standard
Unit
Assignments
28
Running a FLAG
Job
93
7.
FORTRAN II/FORTRAN IV
Equivalent
Statements_
30
The FLAG
Control
Card
93
8.
Permissible
Correspondences
Between
Arguments
Job
Setup
Examples
95
F
LA
G
Debug
Mode
96
and
Dummies
83
9.
Intrinsic
and
Basic External
Functions
87
INDEX
104
10.
FLAG
Option
Codes
94
iv

l
1.
INTRODUCTION
How
This
Manual
is
Organized
Most
of
the
material
in this manual was
taken
from
the
Sigma
5/7
FORTRAN IV-H
Reference
Manual
(XDS 90
09
66B),
though
several
important
sections
are
from
the
Sigma
5/7
FORTRAN IV
Reference
Manual (XDS 90
09
56C).
For
the
convenience
of
those
who may
already
be
familiar
with XDS FORTRAN
IV-H,
material
in this manual
that
differs
from
the
FORTRAN IV-H Manual
is
indicated
by a
bracket
in
the
left
hand margin
of
the
page.
The
remainder
of
this
Chapter
summarizes
the
most
important
features
of
FLAG
and
then
briefly
presents
information
of
general
interest
to
the
new user.
Chapters
2 through 8
are
a
detailed
description
of
the
FLAG
language.
Chapter
9
contains
the
essential
operations
information for
compiling
and
running FLAG programs.
Users
already
familiar
with
XDS
FORTRAN
IV-H
will
probably
perfer
to
scan
Chapters
1
through
8
noting
the
changed
areas
marked by
brackets,
and
then
read
Chapter
9 for
an
explanation
of
FLAG
operations.
Such users wi
II
thus
be
able
to
start
running FLAG programs
with
minimum
delay.
The
FLAG
Compiler
The FLAG (FORTRAN Load And Go) system for XDS Sigma
5/7
computers is
essentially
a FORTRAN IV-H
compiler
designed
to
be
compatible
with
other
compilers
of
this
class.
However, FLAG
provides
to
the
user a
unique
set
of
operating
characteristics:
•
Comprehensive
diagnostic
messages
at
compile
and
execute
time.
• Fast compi
lation.
•
Significant
reduction
in
total
processing
time
for
small-to-medium
sized
programs.
•
Special
accounting
and
processing
features
to
minimize
Monitor
system
overhead.
FLAG may
be
used in
preference
to
standard
FORTRAN
compilers
when
the
user
is
in
the
debugging
phase
of
devel-
oping his program. Further,
it
should
be
the
primary FORTRAN
compiler
system in
the
typical
university
environ-
ment
where
the
job stream
contains
numerous small programs, many
of
which
are
written
by
novice
programmers.
FLAG
Programs
FLAG programs
are
comprised
of
an
ordered
set
of
statements
that
describe
the
procedure
to
be
followed during
exe-
cution
of
the
program and
the
data
to
be
processed by
the
program. Some
data
values
to
be
processed may
be
exter-
nal
to
the
program and
read
into
the
computer
during
program
execution.
Similarly,
data
values
generated
by
the
program
can
be
written
out
while
processing
continues.
Statements
belong
to
one
of
two
general
classes:
1.
Executable
statement/,
that
perform
computation,
input/output
operations,
and program flow
control.
2.
Nonexecutable
statement/,
that
provide
information
to
the
compi
ler
about
storage
assignments,
data
types
and
program form, as well as
providing
information
to
the
program
during
execution
about
input/output
formats and
data
initial
ization.
Statements
defining
a FLAG program follow a
prescribed
format.
Figure
1
is
a
sample
FORTRAN
Coding
Form. Each
I
ine
on
the
form consists
of
80
spaces
or
columns;
however,
the
last
eight
columns
are
used
only
for
identification
or
sequence
numbers
and
have
no
effect
on
the
program. Columns 1 through
72
are
used for
the
statements.
The first
field,
columns 1 through 5,
is
used for
statement
labels.
Statement
labels
allow
statements
to
be
referenced
by
other
portions
of
the
program. Labels
are
written
as
decimal
integers,
with
all
blanks
(leading,
embedded,
or
trailing)
ignored.
Chapter
5, IIControl
Statements
II,
contains
a more
extensive
discussion
of
statement
labels.
tSee
Appendix
A.
Introduction

The
body
of
each
statement
is
written
in columns 7
through
72,
but
if
additional
space
is
required,
a
statement
may
be
continued.
FLAG
accepts
an
unl
imited
number
of
continuation
Iines. Each
continuation
I
ine
must
contain
a
char-
acter
other
than
blank
or
zero
in column 6. The
initial
line
of
each
statement
contains
only
the
characters
blank
or
zero
in column 6. If a
statement
is
labeled,
the
label
must
appear
on
the
initial
I
ine
of
the
statement;
labels
appear-
ing
on
continuation
Iines
are
ignored.
Column
1 may
contain
the
character
C
to
indicate
that
the
line
is
to
be
treated
as a
comment
only,
with
no
effect
upon
the
program.
Comment
lines may
appear
anywhere
in
the
program,
except
within
a
statement
(i.e.,
inter-
spersed
with
continuation
lines).
Statements
may
have
blanks
inserted
as
desired
to improve
readabil
ity,
except
within
literal
fields
(e.
g.,
in
Hollerith
constants
and
in FORMAT
statements).
The
set
of
characters
acceptable
to
FLAG
is
Letterst:
ABC
D E F G H I J K L M N 0 P Q R
STU
V W X Y Z
Digits:
0123456789
Speci
al
characters:
(useful)
t + - * / =
()
• , $ I &
blank
Special
characters:
II
(other)
This
character
set
conforms
to
the
Extended
Binary-Coded
Decimal
Interchange
Code
(EBCDIC)
standard.
Figure
1
illustrates
a
sample
FLAG program. An
explanation
is
given
in Table
1.
PROBLEM
Sa
mpi e
S!:I:»ls
~
'---
SCIENT:FIC
DATA
SYSTEMS
FORTRAN
CODING
FORM
PROGRAMMER
____________________
_
Identification
FORTRAN STATEMENT
II
NT EGE R
FACTOR,
K
I-r--.-.,--r---t"""""+-"',
T I • , •
ii'
Ii'
• • , i
.·-,.--r··--~"T"-.,._r_r_l--y--r--rj-,--,--.,..--,r--r--.--.--...--.---.--,--
......
·
iK
=
iii
, • • • • !
~.
.,.
,'--'
,---r--r--r---r-...---r--.---r--r
..-,-,..---r-.
-,-,........,-,
-r,---.----.--r--.---.--..
--r""'-'--T-"-r-~
~-.--,.--r-+-!
.....,lR.;;E=;A,D,
,(
,1,
•
,5,
),
,
'f~-,.~TR-,-T-·,--y---r--,.__,__.-,---r---.--r-......,........-r--T"'"
",-,---'---r--~..---r-,--r-r-I
hI.O~J,F,
,(
,F,A,C,T,~R,)
,l-1r,J-r3.,J
.1,
lr-~T-r--T-r-.--,---rl---r-.,...--,.
y-1-.----.-.-
T-,"'·"-
~-;-'-""---'
1 1 I
lK
= K • FAC T
(j
R
lJFACT6R
= '
....
,
...
.,--
......
,
'·~·-T--~--
,---1'
12
13 WRI TE
(1
O'S
,
6)
'K~'-'
.
-'~·TT-'~-,.-
..
-T----r-r---.--'
-r·-r-r-.-·
...
I-..--
T ....
'-'-'---'-"--,---"
Iii
'
iii
i 1
iii
I i * ---,---"'"
·--TM-"...-----r--
"'l"'--,.
, i , i
T~.--.--r-r-r--T
•
Iii
¥
,.-.~
STC:SP
5 F
eRMA
T
(t'6)
t--.-·-,-.--r-=6~f-'-+1~_.~R,M:
~
T .
(::~
:",~-,_T"~
-.,
:-1""':
~-r_~-Q:
f:=:-~=~·~..,...-y-~,---,--.--r.
-r........-.,.--.,...-r.
~-r:---,---r-...,.....,r-T--r--,--,
'~';jEND
t--r-T-,-----r-+-+I,!=-r--"'-
-.=....-,-,
--.--.----r-.......-r,--r-,
.--.--.----.,
ir---r-",
~"-r""""-'"
"r
··Y·
....
,...........,.--....,.._·......--.-,
~,
.
..,--.--......--,-._
.
....,.......,.,
--.--.-.-
•
..,.....-rj
-.-...,..---,.-~
-..
------'
--_
....
_-----------
Figure
1.
Sample
XDS FLAG Program
tThe
dollar
sign
($)
character
is
accepted,
though
not
recommended,
as a
letter
of
the
alphabet.
It
may
therefore
be
used in FORTRAN
identifiers,
such as
$,
FIVES,
or
$300. For
the
purposes
of
the
IMPLICIT
statement
(see
Chapter
7), $ follows Z in
the
set
of
letters.
2 FLAG Programs

Line
1,2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Table
1.
Sample
Program
Meaning
The
character
C in
column
1
defines
these
I
ines
as
comments.
A
nonexecutabl
e
statement
that
defines
to
the
compiler
the
variabl
es FACTOR
and
K as
integers.
An
assignment
statement
that
sets
K
equal
to
1.
An
input
command
that
causes
the
value
of
FACTOR
to
be
read
into
storage.
The
value
is
read
from
unit
1.
The form in
which
the
value
of
FACTOR
appears
external
to
the
computer
is
speci-
fied by FORMAT 5
(line
14).
Statement
10 tests
the
value
of
FACTOR
and
transfers
control
to
statement
11, 12,
or
13 as follows:
If FACTOR <
0,
control
is
transferred
to
statement
12.
If FACTOR =
0,
control
is
transferred
to
statement
13.
If FACTOR >
0,
control
is
transferred
to
statement
11.
Statement
11
is
another
assignment
statement
that
assigns
to
K
the
value
of
the
expression
K times
factor.
In
other
words,
the
current
valueofK
is
replaced
by
the
currentvalue
of
K
multiplied
by
the
value
of
FACTOR.
The
statement
appearing
on
lines
8
and
9 is
an
assignment
statement,
written
as
an
initial
line
and
one
continuation
line.
The C in
column6causesline9
to
bea
continuation
of
line
8.
This
statement
assigns
to
FACTOR
the
value
of
the
current
value
of
FACTOR minus
1.
When
the
GO
TO
statement
is
executed,
an
unconditional
transfer
of
control
to
statement
10
(I
ine
6)
occurs;
Statement
12,
an
assignment
statement,
assigns
the
value
zero
to
the
variable
K.
The
WRITE
output
statement,
13,
causes
the
name
of
the
variable
K
and
its
value
to
be
written
out
on
unit
108,
which
is
normally
assigned
to
the
Printer
(see
statement
6,
line
15
for
designated
FORMAT
statement).
The
control
statement
STOP
causes
execution
of
the
program
to
be
terminated.
FORMAT
statement
corresponding
to
READ
statement
on
line
5.
FORMAT
statement
correspond
ing to
WRITE
statement
on
line
12.
The END
line
informs
the
processor
during
compilation
that
it
has
reached
the
physical
end
of
the
source
program.
In
this program,
if
the
value
of
FACTOR is
initially
3 as
read
.by
line
5,
statement
10 will
be
executed
four times,
the
statements
on
line
7
through
10 wi
II
be
executed
three
times,
and
the
statements
on
lines
4,
5, 12,
and
13 will
be
executed
once
each.
Conditional
Compilation
- X
Cards
FLAG
provides
a means for
conditional
compilation
of
statements.
Any
line
that
contains
an
X
in
column
1
is
processed as a
statement
only
when
the
CX
option
is
specified
on
the
FLAG
control
card
(see
Chapter
9).
Otherwise,
the
card
is
treated
as a
comment.
Conditional
Compilation
- X
Cards
3

This
feature
enables
the
programmer to
include
in his program
additional
statements
for
checkout
purposes, such as
intermediate
output
and
special
error
checking.
When
checkout
has
been
completed,
these
statements
do
not
have
to
be
removed from
the
program. Instead,
the
program is
compiled
without
the
CX
option
and
the
statements
are
treated
as comments
only.
These
statements
remain in
the
listing,
however,
and
may serve as
documentation
or
checkout
procedures.
Also,
they
may
easily
be
reinstated
at
any
time.
Continuation
lines
for X cards should
also
be
X
cards;
furthermore, a normal
line
may
have
a
continuation
line
that
is
also
an
X
card.
For
example:
~
C
FOR
COMMENT
-lsTATEMENT
J FORTRAN STATEMENT
NUMBER
1 5 6 7
10 15
20
25
30
35
40
45
X·
'l!r
••
_,
A.
B
.J
...•
. . .
:c~PRINT
3 •
C.
I I
X
D.
E • F
3 FeRMAT (
X.
6F
.
7')
.
. I
PR
I
NT
3 • U.
V.
W
. I
x , X, YI
~
I I
-.~
....
~--
..
--
4
Conditional
Compi
lotion
- X Cards

2.
DATA
Numerical
quantities
-
constants
and
variables
-as
distinguished
in FLAG
are
a means
of
identifying
the
nature
of
the
numerical
values
encountered
in a program. A
constant
is a
quantity
whose
value
is expl
icitly
stated.
For
ex-
ample,
the
integer
5 is
represented
as
115
11
;
the
number
IT,
to
three
decimal
places,
as
113.
14211.
A
variable
is
a
numerical
quantity
that
is
referenced
by
name
rather
than
by its
explicit
appearance
in a program
statement.
During
the
execution
of
the
program, a
variable
may
take
on many
values
rather
than
being
restricted
to
one.
A
variable
is
identified
and
referenced
by
an
identifier.
All
data
processed by a FLAG program
can
be
classed
as
one
of
seven
types:
Integer
Reai
Double
precision
Complex
Double Compl
ex
Logical
Literal
lim
its
on
Values
of
Quantities
Integer
data
are
precise
representations
of
the
range
of
integers
from
-2,
147,483,648
to +2,
147,483,647;
that
is,
-2
31
to
+2
31
-1.
Integer
data
may
only
be
assigned
integral
values
within
this
range.
Real
data
(sometimes known as
floating-point
data)
can
be
assigned
approximations
of
real
numbers,
the
magnitudes
of
which
are
within
the
range
5.398
x
10-
79 to
7.237
x 10
75
(i.e.,
16-
65 to
16
63). A real
datum
may
acquire
positive
or
negative
values
within
this
range
or
the
value
zero.
Real
data
have
an
associated
precision
of
6+
sig-
nificant
digits.
That is,
the
sixth
most
significant
digit
will
be
accurate,
while
the
seventh
will sometimes
beaccu-
rate,
depending
on
the
value
assigned to the
datum.
Double
precision
data
may
approximate
the
identical
set
of
values
as real
data.
However;
double
precision
data
have
an
associated
precision
of
15+
significant
digits.
Complex
data
are
approximations
of
complex
numbers. These
approximations
take
the
form
of
an
ordered
pair
of
real
data.
The first
of
the
two real
data
approximates
the
real
part,
and
the
second
real
datum
approximates
the
imaginary
part
of
the
complex
number. The
values
that
may
be
assigned
to
each
part
are
identical
to
the
set
of
values for real
data.
Double
complex
data
have
the
same form
as
complex
data
except
that
both
the
real
and
imaginary
parts
are
double
precision
values.
Logical
data
can
acquire
only
the
values
IItrue
'l
or IIfalse
ll
•
Literal
Data
are
character
strings of up to 255
characters.
Like
logical
data,
literal
data
do
not
have
numeric
val-
ues. Any
of
the
characters
discussed in
Section
1 may
appear
in
literal
data.
Constants
Constants
are
data
that
do
not
vary
in
value
and
are
referenced
by naming
their
values.
There
are
constants
for
each
type
of
data.
AI
though
numeric
constants
are
considered
as
being
unsigned,
they
may
be
preceded
by
the
pi
us
or minus
operators.
The
operator
is
not
considered
part
of
the
constant,
however.
(See
Chapter
3.)
Integer
Constants
Integer
constants
are
represented
by strings of
digits.
The
magnitude
of
an
integer
constant
must not
exceed
2,
147,483,647.
Examples:
382
13
997263
1961
1000000000
323344224
000546
382437
8
o
Data
5

ReaI Constants
Real
constants
are
represented
by strings
of
digits
with a
decimal
point
and/or
an
exponent.
The
exponent
follows
the
numeric
value
and
consists of
the
letter
E,
followed by a signed or unsigned
1-
or
2-digit
integer
that
represents
the
power
of
ten
by
which
the
numeric
value
is
to
be
multiplied.
Thus,
the
following forms
are
permissible:
n.m
n.
.m
n. mE±e n.
E±e
nE±e
where
n,
m,
and
e
are
strings
of
digits.
The plus sign
preceding
e
is
optional.
For
example,
. 567E5 has
the
meaning.
567
x 105
and
can
also
be
represented
by
any
of
the
following
equivalent
forms:
0.567E+05
567000.
E-1
5. 67E4
567E02
56700.
56700.000E-00
The val
ue
of
a real
constant
may not
exceed
the
Iimits for real
data.
Any number of
digits
may
be
written
in a real
constant,
but
onl y
the
7 most
significant
digits
are
retained.
Since
any
real
constant
may
be
written
in a
variety
of
ways,
the
user has freedom
of
choice
regarding
form.
Examples:
5.0
0.01
7.6E+5
6.62E-37
3.141592265358979323846
.58785504
Double Precision Constants
Double
precision
constants
are
formed
exactly
like
real
constants,
except
that
the
letter
D is used
instead
of
E in
the
exponent.
To
denote
a
constant
specifically
as
double
precision,
the
exponent
must be
present.
Thus, a
double
precision
constant
may
be
written
in
any
of
the
following forms:
n. mD±e n. D±e nD±e
where
n,
m,
and
e
are
strings
of
digits
D
signifies
a
double
precision
constant
The plus sign
preceding
e is
optional.
The
value
of
a
double
precision
constant
may
not
exceed
the
limits for
double
precision
data.
Any
number of
digits
may
be
written
in a
double
precision
constant,
but
only
the
15 most
significant
digits
are
retained.
Examples:
1. 2345678765432D1
.9963D+3
Complex Constants
576.3D+01
.1254D-02
312.
D-4
885.
D+3
Compl
ex
constants
are
expressed as
an
ordered
pair
of
constants
in
the
form
6
Constants

where
c 1
and
c2
are
signed
or
unsigned,
real
constants.
The
complex
constant
(c 1
,c
2) is
interpreted
as
meaning
c1 + c2
i,
where
i =
/=1.
Thus,
the
following
complex
constants
have
values
as
indicated:
(1.
34,52.01)
(98. 344E
11,34452E-3)
(- 1. , - 1
000.
)
1.
34
+
52.0li
983.
44
+
34.
452i
-
1.
0 1
000.
Oi
Neither
part
of
a
complex
constant
may
exceed
the
value
limits
established
for
real
data.
Double Complex
Constants
Double
complex
constants
are
formed
in
exactly
the
same
way
as
complex
constants.
If
either
the
real
or
imaginary
part
is a
double
precision
constant,
the
complex
constant
becomes
a
double
complex
constant.
Examples:
(.757D6,3D-4)
(7. ,ODO)
(-4.
286DO,
1.
3)
757000.0DO
7.0DO
+
.0003DOi
+
O.ODOi
-4.286DO
+ 1.
3DOi
Neither
part
of
a
double
complex
constant
may
exceed
the
value
limits
established
for
double
precision
data.
Logical
Constants
Logical
constants
may assume
either
of
the
two forms
.
TRUE.
.
FALSE
.
where
these
forms
have
the
logical
values
"true"
and
"false",
respectively.
Literal
Constants
A
literal
constant
has
the
form
where
is a string of up to
255
alphanumeric
and/or
special
characters.
Note
that
blanks
are
significant
in such
character
strings.
Within
a
literal
constant,
two
consecutive
quotation
marks may be used
to
represent
a
single
quotation
mark (or
apostrophe).
For
example,
'AB"CD'
represents
the
five
characters
AB'CD.
However,
quotation
(') marks
separated
by
blanks
are
not
considered
to
be
consecutive.
Examples:
'ALPHANUMERIC
INFORMATION
'
'IIDON"T!'"
Literal
constants
can
appear
in
three
contexts:
1. An
argument
to a
function
or
subroutine
2.
A
constant
item in a
DATA
statement
3.
A PAUSE
statement
('Sl
form only)
A I
iteral
constant
cannot
appear
as
an
element
of
an
expression.
Constants
7

Identifiers
[
Identifiers
are
strings
of
letters
and
decimal
digits,
the
first
of
which
must be a
letter,
used to name
variables
as well
as subprograms
and
COMMON
blocks.
(See
Chapters
7
and
8 for discussions
of
COMMON
and
subprograms.)
[
8
Identifiers
in FLAG may consist
of
up
to
six
alphanumeric
characters.
Blank
characters
embedded
in
identifiers
are
ignored;
therefore,
ON
TIME
and
ONTIME
are
identical.
There
are
no
restricted
identifiers
in FLAG;
however,
for
clarity,
it
is
advisable
not
to
use
identifiers
that
correspond
to
FLAG
statement
types.
Examples:
X
A345Q
ELEVAT
Variables
STRESS
L9876
J3
DIFFER
MELVIN
SETUP
QUANTY
Variables
are
data
whose
values
may
vary
during
program
execution
and
are
referenced
with
an
identifier.
Vari-
ables
may
be
any
of
the
data
types.
(There
is
no such
entity
as a
literal
variable;
any
type
of
variable
may
contain
a I
iteral
string.
Normally,
integer
variables
are
used.)
If
a
variable
has
not
been
assigned
to
a
particular
data
type
(see "C
lassification
of
Identifiers",
Chapter
7), the
following
implicit
typing
conventions
are
assumed:
1.
Variables
whose
identifiers
begin
with
the
letters
I,
J,
K,
L,
M, or N
are
classified
as
integer
variables.
2.
Variables
whose
identifiers
begin
with
any
other
letter
are
classified
as real
variables.
These
classifications
are
referred
to as
the
IIUKLMN
rule".
Consequently,
double
precision,
complex,
double
complex,
and
logical
variables
must be
explicitly
declared
as
such (see
"Explicit
Type
Statements"
in
Chapter
7). The
values
assigned
to
variables
may
not
exceed
the
limits
established
for
the
applicable
data
types.
Scalars
A
scalar
variable
is a
single
datum
entity
accessed
via
an
identifier
of
the
appropriate
type.
Examples:
Jl
NAME SCALAR EQUATE E
NEW
DHO
XXX8
Arrays
An
array
is
data
in
which
the
data
form
an
ordered
set.
Associated
with
an
array
is
the
property of dimension.
FLAG
arrays
may
have
up
to
seven
dimensions
and
are
referenced
by
an
identifier.
For a
complete
discussion
on
arrays
see
"Array
Declarations"
in
Chapter
7.
Array
EI
ements
An
array
el
ement
is a member
of
the
set
of
data
comprising
an
array.
Array
el ements
are
referenced
by
the
array
identifier,
followed by a
list
of
subscripts
enclosed
in
parentheses
where:
v is
the
array
name
si
is a subscript (see below)
n is
the
number
of
subscripts,
which
must
be
equal
to
the
number
of
dimensions
of
the
array
(0 < n
~
7)
Subscripts
A subscript may
be
any
expression
that
has a
resultant
mode
of
integer,
real,
or
double
precision;
if
the
result
is
not
integer
it
is
converted
to
integer
mode (by
truncation).
Identifiers/Variables

The
evaluated
result
for a
subscript
must
always
be
greater
than
zero.
For
example,
if
an
array
element
is
desig-
nated
as ALPHA(K-4),
the
value
of
K must
be
greater
than
4.
Examples:
MATRIX
CUBE
DATA
J35Z
BOB
Functions
Subscripts
(3,9,5,7,6,1,2)
(5*
J,
P,
3)
(I, J, K,
L,
M,
N)
(1+4,
6*KRAN-2,
ITEMP)
(3,IDINT(DSQRT(D)))
Array
Elements
MATRIX(3,
9,5,7,6,
1,2)
CUBE(5*
J,
P, 3)
DATA(I,
J,
K, L,
M,
N)
J35Z(I+4,
6*KRAN-2,
ITEMP)
BOB(3,IDINT(DSQRT(D)))
Functions
are
subprograms
that
are
referenced
as
basic
elements
in expressions. A
function
acts
upon
one
or
more
quantities,
called
arguments,
and
produces
a
single
quantity,
called
the
function
value.
The
appearance
of
a
func-
tion
reference
constitutes
a
reference
to
the
value
produced
by
the
function,
when
operating
on
the
given
argument.
A
function
reference
is
denoted
by
the
identifier
that
names
the
function,
followed
by a list
of
arguments
enclosed
in
parentheses
where
a.
I
is
the
name
of
the
function
is
an
argument.
Arguments may
be
constants,
variables,
expressions,
or
array
or subprogram names (see
IIArguments
and
Dummies
ll
,
Chapter
8).
Functions
are
classified
in
the
same
way
as
variables;
that
is, unless
the
type
is
specifically
declared
otherwise,
the
[
IJKLMN
rule
applies.
The
type
of
a
function
is
not
affected
by
the
type
of
its
arguments.
Examples
of
function
references
are:
SIN(A+B) CH ECK(7.
3,
J,
ABS(Y)) KOST(ITEM)
Many
library
functions
are
provided
in FLAG. In
addition,
the
user may
define
his own
functions
(see
Chapter
8).
[
Functions
9

3.
EXPRESSIONS
Expressions
are
strings
of
operands
separated
by
operators.
Operands
may
be
constants,
variables,
or
function
refer-
ences.
An
expression
may
contain
subexpressions; subexpressions
are
expressions
enclosed
in
parentheses.
Operators
may
be
unary
-
that
is,
they
may
operate
on a
single
operand.
They may
also
be
binary,
operating
on
pairs
of
operands.
Expressions may
be
classed
as
arithmetic,
logical,
or
relational.
All expressions
are
single
valued,
and
the
evaluation
of
any
expression
has a
unique
result.
Arithmetic
Expressions
An
arithmetic
expression
is a
sequence
of
integer,
real,
double
preCISion,
complex,
and/or
double
complex
con-
stant,
variabl
e,
or
function
references
connected
by
arithmetic
operators.
The
arithmetic
operators
are:
Operator
+
*
/
**
Operation
Addition
{binary}
or
Positive
(unary)
Subtraction
(binary)
or
Negative
(unary)
Multiplication
Division
Exponentiation
Arithmetic
expressions
may
be
of a
relatively
simple
form
A
-TERM
1.
2607
ACE -
DEUCE
W90ML
*
DE
+ W9CMI / XKA9RU
F(5.8E2) = A /
B9J
(L)
or
the
more compl
icated
form
x+ (112 *
(G)
**
L(3)
+ N / SDS) -
(H)
-B
+ SQRT(B ** 2 - 4 * A * C) + T *
(S
+ B/ I * (K(J) /
(V1
-
VO)
+
(Z
1 -
ZO»)
(X
+
Y)
** 3 +
O.
7352986E-7
-((M + N) * (Z -
Q(J»)
Evaluation Hierarchy
The expression
A +
B/C
might
be
eval
uated
as
(A
+
B)
/ C
or
as
A +
(B
/
C)
10 Expressions

I
L
Actually,
the
latter
form is
the
way
the
expression
is
interpreted
without
explicit
grouping.
This
exampleillustrates
that
it
is
necessary
to
formulate
rules
for
expression
evaluation
so
that
such
ambiguities
do
not
occur.
Subexpressions
have
been
defined
as
expressions
enclosed
in
parentheses.
It is
also
possible
to
have
nested
subexpres-
sions
as
in
x *
(Z
+ Y *
(H
- G / (I +
L)
-
W)
+
M(8))
where
(I +
L)
may
be
called
the
innermost
subexpression,
and
(H
- G /
(I
+
L)
-
W)
is
the
next
innermost
subexpres-
sion. The
evaluation
hierachy
is,
therefore,
as
follows:
1.
The innermost subexpressi
on,
followed
by
the
next
innermost
subexpressi
on,
untiI
all
subexpressions
have
been
eval
uated.
2.
The
arithmetic
operations,
in
the
following
order
of
precedence:
Operation
Operator
Order
Exponentiation
** 1 (highest)
Multiplication
*
and
Division / 2
Additi
on
and
+
Subtracti
on 3
Some
additional
conventions
are
necessary.
1.
At
anyone
level
of
evaluation,
operations
of
the
same
order
of
precedence
(except
for
exponentiation)
are
evaluated
from
left
to
right.
Consequently,
1/
J / K / L is
equivalent
to
((I /
J)
/
K)
/
L.
2.
Consecutive
exponentiations
are
performed
left
to
right.
Thus
A ** B** C
is
interpreted
as (A **
B)
** C
The use
of
parentheses
is
recommended,
as
many FORTRAN systems
interpret
consecutive
exponentiation
differentl
y.
3.
The
sequence
"operator
operator"
is
not
permissible.
Therefore,
A * -B must
be
expressed
as
A * (-B).
4.
As
an
algebraic
notation,
parentheses
are
used
to
define
evaluation
sequences
explicitly.
written
as
(A
+
B)
/
c.
Example:
The expression
A *
(B
+ C *
(D
- E/
(F
+ G) -
H)
+
P(3))
is
evaluated
in
the
sequence
r =
1 F + G
D - r - H
2
r = C * r
4 3
r5 = B+ r4 +
P(3)
r = A * r
6 5
where
the
r
are
the
various
level
s
of
eval
uati
on.
i
A+B
Thus,
-C-
is
Arithmetic
Expressions
11

Mixed
Expressions
V/hen
an
arithmetic
expression
contains
elements
of
more
than
one
type,
IT
IS Known
as
a
mixed
expression.
Logicai
elements
may
not
appear
in
an
arithmetic
expression
except
as
function
arguments
(see
rule
2,
,below).
When
an
expression
contains
more
than
one
type
of
element,
the
mode
of
the
expression
is
determined
by
the
type
and
length
specifications
of
its
elements.
Table
2
illustrates
how
the
mode for
mixed
expressions
is
determined.
Table
2.
Mode
of
Mixed
Expressions Using
Operators
+ - * /
DOUBLE
+-*/
INTEGER
REAL
PRECISION COMPLEX
INTEGER
Integer
Real
Double
Complex
Precision
REAL
Real Real
Double
Complex
Precision
DOUBLE
Double
Double
Double Double
PRECISION
Precision Precision Precision
Complex
COMPLEX
Complex Complex
Double
Complex
Complex
DOUBLE
Double
Double Double
Double
COMPLEX
Complex
Complex
Complex Complex
It
can
be
seen
that
a
hierarchy
of
type
and
length
specifications
exists.
The
order
of
precedence
is:
Type
Doubie
Compiex
Complex
or
Double
Precision
Real
Integer
Precedence
1
(highest)
2
3
4
DOUBLE
COMPLEX
Double
Complex
Double
Complex
Double
Complex
Double
Complex
Double
Complex
I
During
evaluation
of
mixed
expressions
the
mode
of
an
operand
will
be
converted,
if
necessary,
so
that
the
L
resultant
mode
of
each
operation
will
be
as
shown in
Table
2.
The
foil owing rul es al so
appl
y
to
mi
xed
expressi
ons:
1.
Subscripts
and
arguments
are
independent
of
the
expression
in
which
they
appear.
These
expressions
are
evalu-
ated
in
their
own mode (i.
e.,
integer)
and
neither
affect
nor
are
affected
by
the
mode
of
the
outer
expression.
2.
Only
expression
elements
of
the
types
shown
in
Table
3
may
be
combined
with
an
exponentiation
operator.
Table
3.
Valid
Type
Combinations
for
Exponentiations
Base
Exponent
T
...
+o,..,or
" ,
T_,,~~~~
£
...
~~~.
} {
1I11"'~"'"
Real ** Real
Double
Precision
Doubl e
Preci
si
on
Complex
} **
Double Compl
ex
Integer
12
Mixed
Expressions

The mode
of
the
results
of
an
exponentiation
operation
can
be
determined
in
the
same manner as
that
for
other
arithmetic
operations
(see
Table
1).
4.
Complex
and
double
precision
elements
have
the
same
level
of
precedence.
If
an
expression
contains
both
of
these
types,
it
acquires
double
complex
type.
This is
the
only
case
in which
an
expression may
have
a
type
that
is
higher
than
(or
different
from)
all
its
constituents.
5.
Integer,
real,
and
double
precision
values
that
appear
in
complex
or
double
complex
expressions
are
assumed
to
have
imaginary
parts
of
zero.
6.
Values
of
expressions, subexpressions,
and
elements
may
not
exceed
the
value
limits
associated
with
the
mode
of
the
expression.
Relational
Expressions
The form
of
a
relational
expression is
where
e1
and
e2
are
arithmetic
expressions whose mode is
integer,
real,
or
double-precision
is a
relational
operator
(see below)
Evaluations
of
relational
expressions
result
in
either
of
the
two
values
IItrue
ll
or
"false
ll
,
i.e.,
relational
ex-
pressions
are
of
logical
type.
Relational
operators
cause
comparisons
between
arithmetic
expressions.
Operator
.IT.
.LE.
.EQ.
.NE.
.GE.
.GT.
Examples:
l.LT.6
O.GT.8
Meaning
less
than
«)
Less
than
or
equal
to
(~)
Equal
to
(=)
Not
equal
to
(I)
Greater
than
or
equal
to
(:;:::)
Greater
than
(»
is
true.
is
false.
O.
LT.
(2.
**
N)
O.
LT.
-(2. **
N)
is
always
true,
while
is
always
false.
When two
arithmetic
expressions
are
compared,
using a
relational
operator,
the
two expressions
are
first
evaluated,
each
in its own mode. The comparison is then made in
the
mode of
higher
precedence;
i.
e.,
the
value
of
the
lower
mode expression is
converted
to
the
mode of
higher
precedence.
A
test
for
equality
between
real or
double
precision
quantities
may
not
be
meaningful on a
binary
machine.
Since
these
quantities
are
only
approximations
to
most
values,
numbers
that
are
"essentially"
equal
may
differ
by a small
amount in
their
binary
representations.
It
can
only
be
said
that
computations
whose
operands
and
results
have
exact
binary
representations
will
produce
these results.
It
is
not permissible
to
nest
relational
expressions such as
(L.LT.
(X
.GT.
O.2345E6))
where
(X
.GT.
O.
2345E6) is a
relational
subexpression,
rather
than
an
arithmetic
expression,
as
the
definition
of
relational
expressions requires.
Relational
Expressions 13

logical
Expressions
Logica! expressions are expressions of the
form
where
e.
are
logical elements.
I
c.
are
the
binary
logical
operators
(see below).
I
Evaluations of logical expressions result in
either
of
the
two
values,
"true"
or
"false".
Logical elements
are
defined
as
one
of
the following
entities:
1. a ·Iogical
variable
or
logical
function
reference
2.
a
logical
constant
3.
a
relational
expression
4.
any
of
the
above
enclosed in
parentheses
5. a logical expression
enclosed
in
parentheses
6.
any
of
the
above,
preceded
by
the
unary
logical
operator
.NOT.
Logical Operators
There
are
three
logical operators:
Operator
Type
.NOT.
unary
.AND.
binary
.OR.
binary
Table 4
illustrates
the
meanings
of
the
logical operators.
1. .
NOT.
e
is
"true"
only when e is
"false".
2.
e1
.AND.
e2
is
"true"
only when both e1
and
e2
are
"true".
3. e1 .OR. e2
is
"true"
when
either
or both e1
and
e2
are
"true".
Table
4.
Evaluation
of
Logical Expressions
Expression Values Evaluation
.NOT.
e e1
.AND.
e2 e1 .OR. e2
e True
---
False
---
---
e False
---
True
---
e1 False e2 False
---
False False
e1 True e2 False
---
False True
e 1 False
E2
True
---
False True
e1 True e2 True
---
True True
14 Logical Expressions

Evaluation Hierarchy
Parentheses
are
used to
define
evaluation
sequences
explicitly,
ina
manner
similar
to
that
discussed
for
arithmetic
expressions.
Consequentl
y,
A
.AND.
B
.OR.
0(3)
.NE.
X
does
not
have
the
same
meaning
as
A
.AND.
(B
.OR.
0(3)
.NE.
X)
where
(B
.OR.
0(3)
.NE.
X)
may
be
called
a
logical
subexpression.
The
evaluation
hierarchy
for
logical
expressions
is
1.
arithmetic
expressions
2.
relational
expressions
(the
relational
operators
are
all
of
equal
precedence).
3.
the
innermost
logical
subexpression,
followed
by
the
next
innermost
logical
subexpression,
etc.
4.
the
logical
operations,
in
the
following
order
of
precedence:
Operator
Order
.NOT.
1
(highest)
.AND.
2
.OR.
3
For
example,
the
expression
L
.OR
•.
NOT.
M
.AND.
X
.GE.
Y
is
interpreted
as
L
.OR.
«.NOT.
M)
.AND.
(X
.GE.
Y))
Note:
It
is
permissible
to
have
two
contiguous
logical
operators
only
when
the
second
operator
is
.NOT.
i in
other
words
e1
.AND
..
OR. e2
is
not
valid,
while
e1
.AND
..
NOT.
e2
is
legal.
Two
consecutive
.NOT.
operators
are
not
permissible.
The
logical
expression
to
which
the
oper-
ator
.NOT.
applies
should
be
enclosed
in
parentheses
if
it
contains
two
or
more
quantities.
For
example,
if
X
and
Z
are
logical
variables
having
the
values
TRUE
and
FALSE,
respectively,
the
following
expressions
are
not
equival
ent:
.NOT.
X
.AND.
Z
.NOT.
(X
.AND.
Z)
In
the
first
expression
.NOT.
X is
evaluated
first
and
produces
the
value
FALSE. This,
when
ANDed
with
Z
(also,
FALSE), results in
the
value
FALSE for
the
expression.
In
the
second
expression
X
.AND.
Z is
evaluated
first
and
produces
the
value
FALSE. Then
the
value
FALSE
is
NOTed,
resulting
in
the
value
TRUE
for
the
expression.
Log
i
ca
I Expressions 15
This manual suits for next models
1
Table of contents