Standard_Fortran_Language_Specification_Aug83 Standard Fortran Language Specification Aug83
User Manual: Standard_Fortran_Language_Specification_Aug83
Open the PDF directly: View PDF
.
Page Count: 290
| Download | |
| Open PDF In Browser | View PDF |
1
Control Data Corporation Standard FORTRAN
83/06/30
CONTROL DATA CORPORATION STANDARD FORTRAN
LANGUAGG SPECIFICATION
S ubm J tt c':!d b"Y:
E.S.Nast
A.O.Tait
Approved bY:
R.
~1.Hudson
A • ~J • H art ley
DISCLA.I(~ER:
This document
is ail
int~~rn~J
Horklng pap-ar nn·]
do~?:.s
not
represent
any intent on the part of CONTROL DATA CORPORATION.
CONTROL
DATA
PRIVATE
2
Control Data Corporation Standard FORTRAN
83/06/30
+----------------------------------------------------------------+
REVISION RECORD
+-----------------------------------------------------------~--~-+
REVISION
:
DESCRIPTION
:
+------------+---------------------------------------------------+
A
] r i J ina I 'Ie r ion •
5
(;3-06-30
+------------+---------------------------------------------------+
:
n
Resolution of comments from division review
• H3-0G-30
+--.----------+-------------------------------.-------------------+
I
+------------+---------------------------------------------------+
CONTROL DATA PRIVATE
Control Data Corporation
Stand~rd
1-1
FORTRAN
83/06/30
-------------------------------------------------------------------1.0 INTRODUCTION
---~--------------------------------------~-------------------------
1 .0
II,! TRODUC TI on
e.l1B.!?'QS.~
1.1
sp~ci;-:les the forrH and n.stHbJ ishes thB
interpretation
of programs expresserl
in the Control Data Corporation Standard
FORTRAN lanJuage. The purpose of this standard
is to promote
portabi lity of FJRTRAN programs for
use on CDC data processing
This 3tan{!ar,j
syst2rils.
P-E.DG.£SSOB.
1.2
Tho combination of 1 data processing system and the ~echanism by
which programs arc transformed for
use on that data processing
system is cal led a eLQg~~SDL in this standard.
S.~fJ£f
1.3
This
st~ndardspecl~Jes:
(1) The form of a proDram written in
I ~n gu :lJ~~
(Z) Rules
datR
the
CDC
Standard
FORTRAN
for interpreting the meaninG of such a program and its
(3) The form of Hriting input data to b'" processBd
progr~m op~r8ting on data processln0 systems
by
such
n
form of the output data resultlng from the use of such a
program on data processing systems
(4) The
This standard does not specify:
( 1) T h ~
ln~1 Gh :-, n
data
ism by : 'J hie h pro n r £ mS
~rocessln~
Q
ret r n n $ for me d for
use on
a
system
(2)
The method of trRnscription of programs or their input or
output d~ta to or from a d~ta processing medium
(3)
Th~
or~r8tions required for setup and control of the
programs on data processing systems
(4) The results Hhen
an
use
of
the rules,of this stano6.ro ra;i,1 to establish
int~rpret3tion
CONTROL OATA PRIVATE
)
COli t r
1-2
0 J
0 :~d:;:~ Cor fJ 0 r
c:\
t 1 \. ) n S tan d:.1 r d FOR TRAI'·~
83/06/30
----------------------------------------------------------~--~------
1.0
IdTRDDUCTION
1.3.2 EXCLUSIONS.
------------------------------------~-----------~--------~----------
(5) The siz~ or comploxity of n proDram and its data that ~il'
exceed the C3P3C1ty of any specific data processing system or
the capability of a particular processor
( 6)
T h (). r :1 n ~J cor p r c! cis ion
of rounding of llu;'leric
(7)
The
physical
units
(8)
Th,~)
0
f
n u m,:~ ric
q lJ ant i
t i €; S n n .J
me i: hod
the
r~sults
properties of input/output records, flIes, and
;"lhysic1i prop!Jrties and
impli~ment:ation
of storeo£:
1.4 C.Ut!ED.E£:1Atl!:£
The requirements, prohibitions, and options sp~cified 1n this
standard J8nerdJly rarer to permisslhle forms and relationships for
standard-conforming programs rather than for processors,
The
obvious exceptions are the optional
output forms produced by a
processor .. "dhich arlO) not
under
the
control
of
d
propram.
The
r~:!ot ~;lnd is inCend·t;d to provide documdntation.
Each statement is classified 3S executable Or nonexecutable (Section
7).
executable
statements
spectf:y
actions.
Nonexecut~bJe
statements describe the characteristics!
arrangement, and initial
values of dqta; contain editing information; specify statement
runotions; classify progrAm units; 2nd specify entry points Hithtn
subproJrnlils.
A a£. !l~':ll:'.a t:J
ulll:!'.
comment lines.
subprouram.
consists of ~ sequence of statements and optional
A program unit is either a main program or a
A ~Eiu O£Q~L~~ is a program unit that does not have a FUNCTION,
SUUROUTINE, or BLOCK DATA statement as its first statement~
it maY
h:IV::! J PR! i t h ina n a r ray
section Is th(: samB ;lS the type of the array name.
At any given time during the
'']fraY section
2.7
is
!:ith~r
~x~cution
defln~d
of In executable program,
an
or und£!'fined.
~!1l1S.I<:l.G
A
character datum is a (possibly empty) sequence of characters. A
is a contiguous portion of a character datum. The form of
a
substrinD name used to ldentify~
define (2.12), or reference
( 2 • 13) a s 1J~),;s t r inn i 5"1;:;$ C r i bt! din 5.10. 1.
suhst~lDll
At any given time during the execution of an executable
substring is either defined or undefined (2.12).
2.0
program,
a
S~AlA&
•
•
I
constznt, v:lri~),b'~,
array t!lcment, sca1ar~valued
function reference, or substrlnJ. The vaJue of an expression is a
sC:llar if each primary in the expression is a scalar.
A
s.~.al.ar.
is
a
dummy
ar DUnJ(!nt
1n a p roce dur e Is either a symbo Ii c n arne or an
asterisk. A symbolic name dummy argument identifies a variable,
arrnYJ or lJ rO(.;edur:1 th'at b'·~comes ;:tssociatcd (2.15) \lith an actual
ar~ument of CJch raferance (2.13) to the
procedure (16.2, 16.4.2,
16.5.2J and 16.6.2). An asterisk dummy argument indicates that the
correspondin] actual
argument
is
an
alternate
return
specifier
( 16. 6. 2. 3, 16. H.3, an d 16. 9. 3.5) •
A
Each dummy argument name that is classified as a variable, array, or
dummy procedure may appear Hherever an actua I nam(~ of. th~3 S2me cl ass
(S'·)ction
19)
and
type
f'l~:!Y
apr'ear,
except Hhere explicitly
pr:)hiblted.
Cot~TROL
DATA PRIVATE
J
2-5
Control Data Corporation Standard FORTRAN
-
-
83/06/30
.................. - ... ..... .....-..- .... ....
2.0 FORTRAN TERMS AND CONCEPTS
~
2.10 SeD?E DF
----:--------~---------------------.-----~---~--------
SYt~!30LIC
;~Ar'~ES
AnD
STATEnr:NT LABELS
-----------------------~--------------------------------------------
scope
Th~
o~
a symbol Ie name (19.1)
is
an
executable
program,
a
F'rOJran unit, a st:~tement function statement" or animpl ied-DO Jist
in a DATA statement.
Th~
nam~
of the mqin program and the names of block
d8ta
subproJrans, external functions~ subr"outines, and common blocks have
a scope of an executable program.
\u";lriabJ~~s,
arrays,
constants,
stfiterr.ent
functions",
intrinsic functIons, dumny procedures, and NAMELIST group names have
~ scope of a program unit.
Th;;! nalrl:2S of
names o? yariables that app8~r as dummy ?rguments in a statement
function statement have n scope of that statement.
Th~
The names of variables that appear
as the DO-variable
impl jed-~O in a DATA statement have a scope of the i fOp J i ed-DO
statement
2.11
I~bels
of an
, is t.
have a scope of a program unit.
11SI
A
1151 is
by
commas.
J
nonempty sequence (2.1) of syntactic entities sePBr3ted
The entitles in the I ist are cal led lis1 l±~ms.
time during the execution of an executable program, the
of each variable,
array, array section, array
81~ment, or substring is either rlEIlnarl or uD~eflo£j
(Section 18).
A defined entity has a value. The value of a defined entity does
not c ha J'l £l U U n t i l t h (? B n t i t y be co m~ s un d 0 fln~; d 0 r i s r €'j (J"f i ned ~'i t h n
different vaJue,
Zero-sized errays, array sections and substrings
are taken always to be defined with R special value that depends on
their shape and type.
At2ny
giv~n
~eflDltlQD
stat~s
If
a v a r Jab , e J arraY.. a r ray sect Ion Jar ray e I erne n t ,
undefined, it does not have a predictable vaJue,
or sub s t r i n 9 i s
Apr e'" i 0 us Ij de r i n'3 -:) va ria b I ~" non - z e r 0 oS i zed a r ra~ y ~ non - Z e r 0 5 i zed
array sectlanl or array element may become undefined. Subsequent
definition of a defined variableJ array,
array section, or array
'! 1:".HIl c n tis p (~ r IT! itt ~~ d 'ox c e p t H h 0 r € 1 t
i!3 ex p I i cit I y pro h i b i ted.
A GhBracter entity is defIned if i t has size zero. or if every
substring of length one of the entity is defined. Note that
if a
s t r i n :J
i $ ;-:1 . ~~ r i ned .. e'·, ~! r :is IJ h s t r i n 0 of t h:o s t r i n Dis d 0 fin ed, and i f
any substrlnJof the string Is undefined, the string Is undefined.
Defining any substrinu does not CRuse any other string or substring
CONTROL DATA PRIVATE
..•
2-6
Control Data Co~poration Standard FORTRAN
....................
2.0
2.12
---........ .-.--- ..........
83/06/30
~-
... ----.-------------------------------- ----------------
FORTRAN TERMS AND CONCEPTS
DEFn~ITI[)N STATUS
to become
undefined~
An entity is inItiallY
d~!lDfd
if it has
size
zero
or
if
it
is
a v~'ue )n a DATA statement (Section 9). InitiallY defined
entities are in the defined state at the beginning of execution of
an executable program.
Atl
varlables and array elements not_
~sslgned
i nit i a 1 I y d iJf i
entJti~
nd
d,
nor
as soc i :a ted (2 • 1 5 )
Hit h an
I nit i a I I y
defined
are undefined at the beginning of execution of an executable
prouram.
2.13
A
E..EEESE.tlG.E.
section, array clement, or substring
vHrfabli;.1 array, array section,
or substring name, respectively, in a statement in a
context requiring the value of that anti ty to be used during the
JXJCU~I.on
or the e~ecutah,e progr~m. When a referencD to an entity
is eXl;-!cuted, it.s current value is avai lable. In this standard, the
act of defining an entity is not considered a reference to that
variabJe~
array,
r.:..ef..Jt~n~i:. is the
~rray
element,
,::!n t i
array
apPl;aranCf? of -n
t.Y.
A proc~dure r~ference is the appearance of a procedure name
in a
statement in a context that requires the actions specified by the
procedure to be ex~cuted durina the execution of the !xecutRble
I) r ~) Dr (3 m•
Hhan apr (I Ccd u r ere 'f i~ r en c ei S ia x e cut e d... t tH~ pro c e d u r (~ mus t
be available.
A s1Qcngg
is
15 a sequence of storage units.
A stQLBg~ yolt
a numerio storage unit, ~ character storage unit, or a bit
unit.
SQgllgn~g
~ithcr
st:)r8D\~
An integer, real, Boolean, or logical datum has one DYmftl~ ~tQ£~~~
llnit in a storaJe sequence. A double pr~cisJon or complex datum has
two numeric storage units in a storage sequence. A half precision
storage unit is half of a numeric storage unit. A character datum
hns one Cb3L3nt~L ~tQLe~a
unIt in a stor8Je sequence for each
character
in the datum. A bit datum has one hl~ ~lQLBg~ yol1 in a
stori1J~~ sequenc{~ for i~~lCh hit in th~. datum.
A stor8ge unit has a sequance of cnns~cutive bit positIons.
A hit
storaJ~ unit may hold a component of a datum having
t. ThIs component isa .bl.t._!!.EluE' or hit, of 0 or
1.
A numeric stor;"l.!je unit hfls 64 bit positions. A character
ztor~ga unit has 8 hit positions.
A bit storego unit has 1 bit
fH1S i t i ~)n •
nQ~ltlQD
of a
th~,t .storaD~~jJni
CONTROL DATA PRIVATE
2-7
Control Data Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------2•0
FDR T RA11 T ER1'1 SAN D CON CEPT S
2.14 STOFAGi'::
--------------------------------------~----------------------------I f () d~i'tum
r('!quires more ttH\!1 one storag~~
sequence, those storage units are consecutive.
unit
In
:?
storage
ThD concept of a storngc sequence is usad to describe relationships
that exist. ]mon~ variables, array elements, arrays, substrings,
and
common blocks.
This standard does
not speclfy a relationship
between the storage sequence concept and the physical properties or
implcmentntion of storago.
2.15
ASSac.lAIIOl:l
!s~gG13tian
of entities exists if the same datum may be identified
s Y In b 0 J i c n a::1 e s j nth e sa 11 €: pro 9 r ,3 m un It, 0 r by the sam e
nRme or
a different name in different program units of the same
executable program (10.1).
by d i ff ere n t
E:ntjti(~s
ma:' b€(;ome associated by thefo! IOHing:
(1) Common association (8.3.4)
(2) Equiv31ence association (8.2.2)
( 3)
A r J u· ~1 £) n t
~ s s ~) c
I a t ion (16 • 9 • 3 )
(4) Entry association (16.7.3)
2.16 SU£lE.ii
an array or array section is the number of dimensions,
of each dlmens1on,
8nd whether the array Is defIned as
r 0 ¥I His e 0 r col u mn His e •
The
tha
Sh3e~Or
siz~
The shape of ::1n B.rr 1Y is denot'1d hy Cd 1,
ntFllbcr of diiJ(~n5ions and di is the si"l'~
Two
array
arr8y-valu~d
r \~ S IJ 1
(i r 8
d2, ••• , dn) Hhere n is the
th!J Ith dimensic'In.
or
objects
(array, array section, array-valued expression,
function, elemental function ref3r£nce with &n array
t)
0
f
the
S d mE!
s h a r o o n I y 1 f t h 8 y h a vet h e s .~ men u mbe r
dimensions, the size of each dimension is the
both columnwise or both rowwise.
The
ih~2~
of
Q
senior is zero
snme,
and
they
of
are
diwEn~ions.
shape of a user array-valued function is determined by the
decllration ror thn function nerne as an arrey in the PROCEDURE
INT2RFACE I~lFORl-1ATIOH. BLOCK.
The Sh3P·~ of an elementat intrlnslc
fUnction is the shape of the argument with the greatest number of
dimensions.
The
CONTROL DATA PRIVATE
Control Data
Cc>rpor~tion
St~ndard
FORTRAN
2-8
83/06/30
-------------------------------------------------------------------2.0 FORTRAN TERMS AND CONCEPTS
2 • 1 7 CnNF :] Rit A13 I LIT Y
2.17
~n~EDRil8nlLlIY
Two array objects (arraY~ array section, array-valued expression,
array-valued function}
elemental function reference with an ar.ray
result) are nQu!aLmnbla If th~~ have thn same shape.
A scalar is
conformable with any array, arrqy section~ or arrAY expression. The
scalar is treated as if it had been extended to an
array
with the
semI) shape in l..Jhich all array (~I(jments havo the valuf' of the scalar.
2.18 Al.!...ac'AI.8,a.LE.
An allocatable arraY
is illl.ol:::J.t::l!i if i t h~)s heen spE:cified during
the
execution of an ALLOCATE stntement and not subsequently
released. An allocatable array is no longer allocated if i t has
been specified during the execution of a FREE statement, or if
tn.recution of the subproi]ram
in 'Ahich
it Nas deClared h3S
been
terminated b~ 9xecut:on of a RETURN or END statement and the array
name is not specified by a SAVE statemcnt~
COli T R0 L . DATAP RI VA TE
3-1
Control Data Corporation Standard FORTRAN
83/06/30
.... _--- ..... ,.........,....... ----.- .... ............ - ... --------------------------'------------------------
3.0
CHARACTERS, LINES, AND EXECUTION SEQUENCE
The FORTRAN character set
digits! and fifteen special
consists
of
twenty-six
letters,
ten
charact~rs.
3.1.1 .h£IIi:.P.,S
A
19t~g[
is one of the twenty-six characters:
ABC D
r·
F G H I J K Lt·, N 0 P
Q
R STU V H X Y Z
Each letter also has a lower case form.
Except in a character
constant (4.8.1), Hollerith constant
(4.9.1.1),
apostrophe edit
1~scriptor
(14.5.1), qwote edit descriptor (14.5.1), or H edit
des c r i iJ tor (14 • 5 • 2 ) JI the 1 ower cas ~:r 0 r m of ale t t e r Is
interpreted
~s
merely a variation in the graphic used for the letter. In a
charact~r constant, Hollr~rith const(',nt, Hpostrophc edit
descriptor,
'I u 0 t e e d i t d tA. s c rip t (') r, 0 r H cd' t des crt p tor .' the '0 we rca s e for m 0 f
a I etter is interpreted, as a di fferent character from. the upper case
form of the letter, except as explicitly noted elsewhere within this
IqnsUBae specification.
3~1.2 .Ql~IIS..
A
dluit is one of the ten characters:
o 1 2 345 6 7 8 9
A string of digits is interpreted in the decimal base number
wh9n a numeric interpretation is appropriate.
o
1 2 3 4 5 6 7
ThrJ diJits
h
~
.
in ;3n ootH1
bBKB~~~lmal_11g1l
o
system
const'?nt (4. Q .1.2) must at' be octal diJlts.
is one of the sixteen characters:
1 234 5 6 7 B 9 ABC D E F
The digits
in a hexadecimal
constant (4.q.1.3) must all
be
hexadecimal
diDits.
Except in an octal or hexadecimal constant, a
strinJ of diJits is interpret~~ in the rlecimal b&sa number system
H h c.~ ii
a n u j~1 LH! r s i's t e Pl b 3 S e l n t ,;! r pre t 8 t i on I 5 a p pro p r let e • In an
octal constant .• a string of octal digits is interpreted in the octal
base number system.
In 8 hex~dacimal constnnt, a string of
CONTROL DATA PRIVATE
)
3-2
Control
Ddt:~l
Corpor'~\tion
St·findard
FnRTRAj~
83/06/30
3.0
CI·1ARACTt:RS,
LINES,
AI~D
EXECUTION
SEQUE~~CE
3.1.2 DIGITS.
hexadecimal digits is interpreted in the hexadecimal number
312hBnllm~Ll~
. An
A
LhBL2CiBL is a letter,
£n~&lal cbBLacl~L
is one
system •
a digit, or the underscore.
of the fifteen characters:
+-------------+------------------------+
Character
Name of Ch,racter
+~~~~~--~---~-:---~--~---~--------~----+
[3lank
=
1
Equals
Plus
~, i nus
J.\s t e r i s 1<
Slash
(
)
Left Parenthesis
Right Parenthesis
J
Comma
1
Decimal Point
Currency Symbol
Apostroph c
I
+
::~:
",.."
..
..
~,
•
•
Colon
Quo t:e
IJnder.score
n
-
f- ..... ~ .... .."..-........ ,... .... "'.. - -.... -+~-- ... --... ------...... -----.... --.. +
Thu
of
s~t
ch~racters
capable of
represent~tjon
In
th~
processor
Is
given in Appendix A.
Note: Throu~hout this section, S denotes the size of the processor's
character set. See Appendix A for value of S.
r(!18+cion:::\1
Chdrac-:':;::r
collating sequence!
'."~i:Jht
tnbJo is
(~xpre;ssions
d~termjned
by
?r~7!
a
evaluated
gnl13tl~n
according
to
__ ~glgh! __ lBblg~
a
A
Each
int'3:,Jcr array of size S.
vnlue betHcen zero and S-l
inclusive.
The
i
of the weight table is the
nQl!atlQg_~glJbt for the character with the
QbaLa~le£ __ GQd~
of i.
Th9 charncter codes and graphic representations for all characters
supported by the processor are given in Appendix A.
If c(i)
and
c(j)
are characters and i ' sno j ' ar.;.). their respective collating
element
Er!i
or
]hts .•
~
on~-dimensionpi
table ht1S
0
v~'ue
of element
th;') HelJht
then
i'.
• 0 p. c ( j) has the val u e t r lJ e i·f and 0 n I y i f
0p•j ,
. has
the v a J u e
t rue J H he 'r e • 0 p • i s nn y 0 r t h ,:l rei a t Ion e lop era tor s •
c ( i)
CONTROL DATA PRIVATE
Con t r
0
J 0 ,J t
3-3
a Cor P 0 r ;j ti 0 n S tan dar d FOR T RA r,,}
83/06/30
3 • 0 Cif ARACT E RS... L I 1\ ES J Id,l 0 [; X[C LJ T I (} j\1 SEQ U::; t·,! C E
3.1.5 CJlLATIlIG SE')tJEHCc AND GRAPHICS.
------------~--------~~-
...
--------------------:---------.---~~----------
The value of a weight table,element
thH t:3bl.~j
i.e.,
s;av;.lral
collating w8iJht.
;"Jithin
Collation may be directed
does not have
characters mty
to
have
be
unique
the same
or by
Tho tables are
predefined with the values given in Appendix A. The fixed table may
not
be modified but the program may access and modify the
user-srecifl~d table.
A compiler-call statement option or the
collation control directive (3.7.3) determines which table specifies
collation S'~~'1ucnce 'for chnract(~r ,rel£tioneJexpressions.
the
ll£ft~=~Qan!!le~
by
the
fiXgd_gQ1IBtlQD_~~lgbl_t~blg
___ C211BtlDn ___ ~B!~b± __ iEbl~.
Tho colistin] sequence used by the lntr Ins1c functions LGE, LGT,
LL[J
and LLT (16.10)
is independent of both the fixed and
user-spccifi3d weiaht tables nn~ is th~refore unAffected by either
the
COa11ptJ<~r-calJ
statement
option
or the collation control
directive. The intrinsic ,function INDEX (16.10) does not use either
co I I at ion He 1 9 h t
ta b Ie.
The i n t r ins i c fun c t ion s CHAR £I n dIe HAR
(16.10) roturn V~IU;;;1S dependent upon the collation He'Dht tables.
program may access or modify the user-specified collation weight
table by using the procedures CQLSEQ~ CSOWN or WTSET (16.12.7,
A
16.12.9, 16,12.8).
With the exception of the uses specified (3.2.2, 3.2.3, 3.3, 4.8,
4.B.1, 4.9.1.1, 14.5.1, and 14.5.2),
a blank character wlth1n a
rragr~m unit
has no meaning and may be used to improve the
appearance of the program unit, subject to the restriction on the
nlJii1h~r of const?cutiv~~ continultion tiniJs (3.3).
3.2 LltlfS
A 110Q in a program unit is a sequence of 72 characters.
All
ch Jr acter S ' i l 1 j s t be from the FORTRAN char ncte r set, except as
described in 3.2.1, 4.3, 4.9.1.1, 13.2.2, and 14~2.1.
Th3 character positions in ~ line are called nQluIDos and ere
n u :'" b ,~ red con sec uti vel!' 1, 2, t h r 0 u !J h 72. T11 e n u mbe r i n d i cat est he
sequential position of a character in the line, beginning at the
left and proc(!edinJ to ti)l';! right. Lin..:Js are ordered by tha sequence
in which the~ ~re presented to tha processor. Thus a program unit
consi sts of a totally ordered set of characters.
A nQru~ant Ilna Is anj line that contains a C or an asterisk in
col ~J mn 1 ,or con t a ins 0 n I y b I a n 1< c h a rae t e r sin col u mns I t h r 0 ugh 7 2 •
A C 0 HI ill ~~ n t
I, i n ~ the t e o n t ::1 , n $
;1. Cor
nn 6 S t ~ r i ski nco 1u mn 1 may
c () n t a I n ·3 n y char a c t:~ r c ~ P (1 b I e of rep r a s i~ n tat I (In I n the pre c e s S 0 r
in
I
CONTROL DATA PRIVATE
3-4
Control
D~lt3
Corpor Jtton Stnndard FORTRAN
83/06/30
----------------------------------~---~-----------------------------
3.0 CHARACT~RS~ LIHES, AND EXr:CUTIOtl SEQUENCe
.3.2.1 COMMENT LINE
coJumns 2 throuuh 72.
A comment fine does not affect the executable program in any way and
may be used to provide documentation. Certain speciaJ forms of
oomment 'in~s control processor behavior. Thuse comment lines are
processor dl~ggtl~~s called t~=dltentiY~~ (3.7).
lines
may
appear ~nYHher~ in the prO!)ram uni t. Comment
I in85 may precede the initial line of the first statement of any
program unit. Comment I ines may appear between an initi al I tne and
its first continuation line or between two continuation lines.
Comment
An 1011131 110£ is :=tny I ine that is not a comment 1 ine and contains
thJ ch1ractar blank or the digit 0 in column 6. Columns 1 through 5
na~ contain ~~ state~f1ent Jabel
(3.4), or each of the columns 1
through 5 must contain the character blan'~.
A continuatloD 11na is any ltne that contains any character of the
FORTRAN character set other than the character blank or the digit 0
in column 6 and contains only blank char8ct.;!rS in colJmns 1 through
5. A statenent must not have more than nineteen continuation lines.
3.3
SIAIEtl£Ll.I,S
Th3 statemJnts of the FORTRAN langU~De are described In Sections 7
throuQh 17 and are used to form program units.
Each statement is
Hritten in columns 7 through 72 of an initial line and as many as
nineteen continuation I ines. An END statu~ent is written only in
(~olumns
7 through 72 of (in initial line. ·No other statement in a
program unit may have an initial line that appears to be an END
statement.
Note that a stqt~ment ~ust not contain more th2n 1320
(:h.)r;ici:i-~rs.
Cy.c~~pt as part ofa loglc81
IF statement (11.5) or a
IODical WHERE statement (11.15), no statement may begin on a line
that contains any part of the previous statement.
nl~nk characters preceding, within, or following a statement do
not
chJnne th.z interpretat ion of the statement, except when they appear
within the datum strings of character constants,
in Hollerith
constnnts, or the H or apostrophe Bdit descriptors in FORMAT
stat em'';! n t s • HONe Y :1 r, b I an k c h a rae t e r s doc 0 un t ns c h s rae t e r sin the
I imit of total charncters alloHed in anyone statement.
a means of referring to individual
1\:dJois
provide
S t at8m\~ nt
but only
labeled
Any statement may be I abeled,
statements.
:~~x0)cu'L~~b I f;.!
::; t B te In ':l n t san d FORMAT stataments may be referred to by
CONTROL DATA PRIVATE
3-5
Control Data Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------3.0
CHARACTr:RS." lII'IES, AND EXECUTIDf'i SEQUENCE
3.4 STATEMENT LABELS
---------------------------------------------------------------.-.-.the use of statement
statement label
is 9
be nonzero. The
statement
through 5 of the
initial line of the statement.
The same statement label must not be
JiY<3n t:o mor"~ than On(1 s~atemcnt in
a
program
unit.
Blanks
and
leadinJ
zeros
are not significant
In distinguishing between
statement IGbels.
or
l~beJs.
The form of a
one to fivd dioitSl on2 ON: Hhich must·
tabel may be placed anywhere in columns 1
se':;]UI.!J)ce
A PROGRAM statement may appear only as the first statement of a main
program.
The first statement of a subprogram must be either a
r-Ui,ICTIJN, SUBROlJTH,lE, or BlOC!( DATA stntement.
Hithln
~
prl)Jr:;,H unIt that permits the statements:
(1) FORMAT statements may appear anywhere;
(2)
1dl
specificp..tion
stBtements
must
s tat C ill e n t s ,
N A ~1 Ell ST
s tat em e n t s ,
precede
al I
DATA
statement
function
statements, and executable statements;
(3)
.nll
;S:£:dt(~ment
flJnct ion statemonts 11PJ.st
prf.~CfHte
all
execut8bJe
s t;2ltcnents;
(4)
DATA
statements
maY appear anywhere after the specification
st:3ti2~m{'!nts;
B t em c n t s C) a yap p e~ ran Y H h::: r c e x C 2 P t b H b"l e en
a
b I 0ck
statement and its corresponding END IF statement, between
a block WHERE st~temcnt
nnd its corresponding END WHERE
s tnt e ill c n t,
0r
b 8 tHe e n
a
DO s t ;) t e Iil e n t
.a n d the
t e r mIn 9 I
stntement of its DO-loop; and
( 5) ENT RY s t
IF
( 6)
A 1,\ An ELI ST s tat e men t (13. 1 4) may a p p ~ a ran YH h Br e
Q f t er
t h!~
spnciPicntion statements, but rnust procede any data transfer
Input/output statement that refers to the NAMELIST group name
( 13 • 14 J 1 9 • 2 • 1 2 ) t h a t i ssp e c i fie d by the ,.\ AHELI ST statement.
Within the sp~cificntlon statements of 3 program unit, IMPLICIT
stutements nust precede all other specification statements except
PARAMETER statements. Any specification statement that specifies
'j: h,:~ t .Y P c (\ f ] S Ymb 0 lie n fj me of a con s t an t must. pre c e d (: the PAR Af1 1:: T cR
statement th~Jt d~fines t;1Zt partlcu1ar symbolic name of a
constant;
the PARAMET:R statement must precede all other statements containing
the symbolic names of constents th~t are defined in the PARAMETER
s t,]tem~~nt.
The last
J in~
of a program unit must be an END statement.
conTROL DATA PRIVATE
3-6
ControJ Data Corporation Standard FORTRAN
83/06/30
3.0
CHARACTERS, LINES" AND EXECUTION SEQUENCE
3 • 5 0 RD f: R
I] F
S TAT Er12 N T S A I-I 0 LInE S
Fi gure 1
Required Order of Statements and Comment Lines
+-------------+---------..
----------------------------------+
PROGRAM,
SUBROUTINE, or
FUNCTION~
BLOCI( DATA statement
+--------------+--------------+--------------+
IMPLICIT
Statements
PARAi'\E TE R
S t e. t ern en t s
FORf1AT
Comment
and
ENTRY
lines
,:
Specification~
,,
st atf:Hnent 5
I
I
statements
+-------------- --------------+
Statement
•
DATA and
:. C(-directive:
NAt·1ELI ST
Statem~nts
I
,,
J
I
Lines
+--------------+
Other
••
Function
Statements
+--------------+
Executable
statements
I
I
+-------------+--------------+--------------+--------------+
:
END
St~!'tement
+-----------------~----------------------------------------+
FiJure 1 is a diagram of the required order of st~tements and
conment
lines for a program unit.
Vertical
lines delineate
varieties of statements that may be interspersed.
For example,
FORMAT statements may be interspersed with statement function
statements lnd DxecutnhJa statements.
Horizontal
lines
delineate
vBrJetics of st3tenonts that must not he 1nterspersed. For examp'~,
statement function statements must not be
interspersed
with
executable statements.
Note. that an EnD statement is also nn
qXlcut~hle statement and must appear only as the last statement of a
proJr::.lm unit.
lintOE!
a~a~lltlQo sugu~n~~ is the ex~cution of executable statements
in the order in which they appear in a program unit.
Execution of
~In
(~ ~ f~ cut :1 hI;)
pro .J r ':;' 111 b ~ 9 ins wit h the e x e c IJ t ion 0 ·f the fir s t
eX3cut3bl~
statem~nt
of th~ main program.
When an
external
procedure 5pecified in a subprogram is referenced, execution begins
with the first executable ststement that follows the FUNCTION,
SUBROUTINi.:,
or
enTRY
statement th~\t specifIes the referenced
procedure as the name of a procedure.
A
tr.ao~f.et.
$.s~qu(;nc:!.
Q! GQo.tr..Q.l is an 3ltcr~tion of the normsl
execution
stJtom·ents that mey ccusea trdnsfer Qf control ere:
(1) GO TO
CONTROL DATA PRIVATE
3-7
Control Data Corporation Standard FORTRAN
83/06/30
3.0
CHARACTERS, LINES, AND EXECUTION SEQUENCE
(~Hl SEQ UENe E AND TRAN SF E R 0 FeD NT Rn L
3 • 6 Nn RN ALE XECUT I
-~~---~-------------------------------------------------------------
(2) Arithmetic IF
{3} RETURH
(4) STOP
(5) An input/output statement containing an
error
specifier
or
end-of-file specifier
(6)
CALL Hith :an elternnte return
(7)
A
srocifier
IODical IF statement containing any of the above forms
(8) Block IF and ELSE IF
(9) Th'8 1 dst statement, If any, of an IF-b Jock or ELSE IF-b 1ock
( 10) DO
(11) The turminal statement of gOO-loop
(13)
The
d·~scr
END
effect
of these statements on
i bed inSect ions 11" 13, and 16.
the
execution
sequence
is
The normQI eX8cution sequence Is not affected by the appearance of
nonexecutable
statements
or comment
Jines between executable
statements. Execution of a function refarencc or a CALL statement
is not
consIdered ;21 trans·rer of control in the prODram unit that
contains the reference, except when control
is returned to a
statement identified by an alternate return specifier in a CALL
statement. ~xecution of a RETURN or END state~ent in 0 referenced
procedure} or execution of a transfer of control within a referenced
procedure] is not considered a transfer of control
in
the program
unit that contains th3 reference.
In the exec~tion or an executable Pfoyraml a procedure subprogram
must not be referenced a second time without the prior execution of
a RETURN or :':110 statement in thHt proc(!durc.
A CS=rllL~~tlye is a speciel
form of comment tine that affects
processor behavior.
This effect can be suppressed,
and
the
C~-rlirective
treated as a comment I ine, by selection of the
appropriate FORTRAn control s't::'1t!!ryH~nt option (see
host
operating
system
reference manual for detai Is).
A C?,-dircctive 1 s a ~.Qnj;.tQl
fi 1.e. g ~ .1 1.Y e • A con t r 0 I d ire c t i v·;) a f f (' G t S D n t\ S P €: ct. 0 f t h € pro c e S so r ' s
tntBrpr~tatlon
of those lines foJlcHlna the dlrectlve and preceding
CONTROL DATA PRIVATE
3-8
Control Data Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------3.0
CHARACTERS, LIlIES, AND EXECUTION SEQUENCE
3.7
C~-DIRECTIVES
-----------------------------------------------------~--------------
either ~ subsequent directive modifying the same aspect, if such n
directive appears, or the end of the program unit. The aspects of
interpret~tion that may be controlled are:
(1) listing of the
I nf or mat 1 on .."
program
and
associated
processor-produced
(2)
specification of program lines to be processed or ignored,
(3)
char1ct;.~r
datl1 compare collatIon tTble, and
(4) minimum. trip count for DO-loops.
Aspect
(1)
~Qm£113tlDDJ
is
11s..tlO!l ___ ~Qotr:.Ql,
a;;:;pect
aspect (3) is £Ql1311QD __ ~Qn1LQ1,
-CD.o.dltl!JOll!
(2)
is
and
as pee t
( 4)
is
nD=!~uJ.u._.G!2o.:tr.!2.1.
The general form of a control directive is
where:
~Q:itlQr.d
is on e 0 f
Th O;\f~ YH 0 r d
column 7 ..
lIS T..
IF, ELSE... END IF, CO II ATE 0 r DO.
beg i n J nan y col u mn
s tar tin 9
Hit h
1ft a y
is a p2r~meter.
D9pendinD upon the keyword that
appears; one or more parameters may be specified.
~
is an integer constant,
or symbolic name of an
inteuor constAnt, with e vAlue of zero or one.
Depending upon the parameter n, the constant either
maYor must not appear.
lab
is a rllL~~tl~! lebelDepending upon the keYword
that appears, a directive label may. be specified.
IF a directive lahel appears and no parameters are
pr/~si;ntJ
a comma must sepnrat~ the 1(E::Y!'lord and
the
directive lanel.
The
letter
C in co I urnn 1 together Hi th the character:;' in co I urnn 2
~s
a
C:;,-dir'3ctiveline.
Such a line ~JiIJ
be
fntorpreted )s a co~ment only If the approprIate FTN control
statement option is selected. The entire directive must appear on a
single line.
A CS-directive interrupts statement continuation,
identil":Y n line
un I
':! S s i t
ish ~: i n Q i n t e r pre ted as nco mm c n t
A I isting control
dirE~ctiv'~
has the
k'~YHor"J
•
LIST.
It must have
the
conTROL DATA PRIVATE
3-9
Control
St~ndard
Data Corporation
FORTRAN
83/06/30
3 .. 0 CH ARAe T SRS, lIn E S..ft
3.7.1 LISTInG CONTROL
A\'1 n EX ECUT I {}N S[; Q UEN CE
form:
Hhere:
r,
E.
is S-, OJ R, A....
or ALL
c.
is B COflstant or the sYmbolic name of a constant
The
constant
is
optional
for
a.11
parameters;
its
absence
is
equivalent
to the appearance of a constant with the value one.
R=O
disables switch 2; g=l enables switch 2.
directivD found by
results In a diagnostic ncssngc.
A I isting control
th~
processor to
be
in
error
The) ist option swi tches offer the folloHing control
S -
source
lines are listed when enabled.
o -
Jsnerated
object code is 1 Ist~d for statenents processed when
enabled.
R -
symbol references are accumulated for the cross reference list
HhE:n 1Jn·]bled.
Symbols Hith no ·nccumulated reJ=crences \-1111 not
appear in that list; no accumulation for
an
entire program
unit suppresses cross reference 1ist.
A -
tho
S ~'1Tl b 0 I
:l t t r I hut e l i s t
i5
9 en ~ r tl ted
i:;nab led Hhen the END statement is processed.
n-
the on loop and common/equivalence map I ists are generated
this s'r j t G his n n <\ b led ph e nth c EH0 s tat e IT! en t is processed.
if t his s Hit chi s
if
A condltion2t cOMpltation directive has a keyword which Is one of
IF, ELSE or ENOIF. Such ~ directive controls whether the lines
immediately
folloHing
the directive are to be processed or
ignored
by the processor.
CONTROL DATA PRIVATE
Con t r \) J D··;) t:1 Cor p
3-10
0 f:J
t ion St
?
n d rl r d FORTRAN
83/06/30
-------------------------------------------------------------------3.0
CJ1ARACTERS ... LINES ... AND EXECUTIOr·\ Sc(JU2NCE
3.7.2 CONDITIONAL COMPILATION
--------------------------------------------------------------------
is an extended loglc21 constant expression.
If a
symbolic name of a constant appears, it must have been
previously defined in a PARAMETER statement of the
proaram unit in which the IF-directive appears
lah is
an optional directive label. It must be a symbolic
name. Its use as a directIve I~bel
In
3
condItional
compilation directive does not affect, and is not
affected by, its use for
any otho;:!r purpose in the
program unit
An ELSE-directive has the form!
C ,. . .
,iJ
Hhere:
An
lah is as for an IF-directive
E~f21E=:l1r.~!:.tl:!.a
has the form:
c· . .
~j
wh3re:
13b is as for nn IF-directive
For each IF-directive there must appear exactly one .ENDIF-directive
later in tho same progrAm unit, and for each ENOIF-directive there
Must appear exactly one IF-directive earlier In tha same program
unit. Between an IF-directive and its corresponding ENDIF-directive
Hill
appear
zero
or more 1ines called a~.Qn.dlj;l!lD.ill_s.egY.eIl.c.e. A
conditional sequence may optionally contain one ELSE-directive
correspondino to the IF-directive and ENOIF-directive del imiting the
condition~t sequence.
An ELSE-directive may appear only within a
con .", it; 0 n a I
:;; [: que nee.
A con (t i t ion .] I seq LJ e no (~ m8 Y not con ta i n m0 r e
thJn one ELSE-directlv~ unless
it contains
another conditional
sequence.
IF an ELSE-directive is contained within more than one
condition.:!J $e(Jur~nce .• th.e ELS[-dirf~ctive corresponds
to
that
I F- EN0 I F
p :li r
H hie h
del i n 1 t 5
the
sma J I est,
j • e. . inn e r m0 s t ,
conditional sequence containing the ELSE-directive.
If corresponding IF And Et,!DIF, or IF .. ELSt:, Et10IF directivt~S have
n
diroctiv?
'qbel,
it must be the sam~ directive label. No other
restr iction appl ies to directive labels on condi tional
directives.
is no requirement that any conditional directive have a
d i r :1 c t i vel 3 tH': I •
T IH~ S BnH.! d ire c t i v € I a h elm 8 y b ·n u.s e don rn 0 r e t han
one sequanc8 of corresponding condftlonul directives In a single
program unit, includino the case of condItional
directives whose.
con c1 i t i 0 n~i I s u q u ~ nee con t::l ins other con d i t i 0 fie) rI i r' (: c t i v e s with the
Th~re
CONTROL DATA PRIVATE
..•
••
3-11
Control Data Corporation Standard FORTRAN
83/06/30
3.0 CHARACTERS, LINES} AND EXECUTION
3.7.2 CONDITIONAL CJMPILATION
S~QU(NCE
--------------------------~---~---------------~-~----- ----------.--
same directive label.
A conditional se1u~nce may contain any
number
of
properly
correspondJnJ
conditional
dlrect)ves,
.and
therefore
other
conditional sequences. If two conditional sequences contain the
SBm(~ I inf~" onq conditional sequ~:!nCF~ must lie: Hholly l"lfithin the other
conditional saquenCd.
1\
:::.1 r
conditional compi tation directive found by the processor to be
r 0 r r '9 sui t 5 ina d i a J nos t j c m0 S S B 9 n •
Processin~
of an IF-directive causes evaluation of the expression
in
~.
If an IF-directive is processed by the processor and the value of Q
i .s
t rue , f0 I I 0 Id n J lin e s a r t3! pro C € 5 sed as i f the I F- d ire c t i v e had
not appeared, unless a corresponding ELSE-directive is encountered.
In this case, I ines between the ELSE-directive and the corresponding
ENDIF-dir9ctiv@ arc ijnored by the processor. If an IF-directive is
processed by the processor and the valu9 of ~ 15 false, following
lines are ignored until the corresponding ~NDIF-directive as if they
hRd
not
dPpeared,
unl~ss
R
corresponding ELSE-directive is
encount:;~red.
In th I s case, lines b€'tw:een th{~ ELSE-d i reet Ive and the
corresponding ENDIF-directive are processed. Note that conditional
directives wi 11 be ignored j f they appear Hi thin ignored sequenceS
of 1 ines. A line i0nored by the processor must be a line acceptable
to thl:: proc)ssor J f the line were not ignored.
A
cot
lation control directive has the form
C,:::
where:
ClJLLAT[;(g)
e is FIXED or USER.
The collation control directive specifies whether collation of
ChJf3cter relatlonaJ
expresslonsJ and the values returned by the
CHAR and Ie'JAR intrinsic functions, are directed by the fixed or
1.,1 S d r - s pP. C i f i ':~;) \" i.~ i J h t tab J c (3. 1 • 5) •
A
col'atlun
contro1 directive directs the interpret~tion of
char acte r re I at jon;.1 J ex pr ess j ons and 0 f
CHAR
and ICHAR 1 ntr ins i c
COil TR0 L DATAP RI VATE
3-12
Control Data Corporation Standard FORTRAN
83/06/30
-- .......... ,... ........ .,..,.. ..... .,.. .................. -_._-----------_._----------------------------------3 • 0 CI-I ARAe T ~~ RS.1 l I tl ES" .~ N DE Xr: CUT I ON :s 2 QUE NeE
3.7.3 COLLATlnN CO!'ITROL
-------------~~-----------------------------------------------------
function references in the Jines following the directive and
preceding another collation control directive, if any, or the END
~:; t:2itament
of the program unit.
In
the case of a character
reintional
expression or a CHAR or
ICHAR intrinsic function
reference in a statement
function statement} the collation that
app J i es i s that in ~ffectfor th(1
line or lines containing a
rf;:'rarence to thf::: s t atementfunct j on.
Consider tht~ example:
PROGRAT'1 P
.LOGICAL LSF
CH ARACT [ R:!: 5 ,
X,
y"
S-'
T
COLLATE(USER)
LSF(X,Y) = X.LT.Y
•
•
•
cs
COLLATE(FIXEO)
IF(LSF(S,T) A=l.O
•
•
END
The reference LSF(SJT) results in an evaluation of the character
relational
expression
S.LT.T with the collation that of the fixed
Hei'CJht table.
A coll.::ltion contro' directive found by the processor to be In
results in a diagnostic message.
A DO-loop control
direc~ive
error
has the form
0 0 ( n. t =Q] )
C.;;
Hhere:
The
E.
is OT
~
is
B
constqr'lt or the sYmbol;e
R
con.5i;;}nt wJth the vBlu8
constant
n P p;:~ ~ f3 n c r~ of
is
optional;
its
name of a constant
abs~ncc
The DO-loop control directive modifIes
SJ:ll.t.cb.
Th:;
S':I i tell
is
in it i e II J
is
equivalEnt
to
the
on,~.
the state
set (or
of
the
res~t)
DD:loOll
when
the
CONTROL DATA PRIVATE
3-13
Control Data Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------_.
3.0
CHARACT::RS., LIHES.!' AND EXECUTION SeqUENCE
3.7.4 DO-LOOP CONTROL
-------------------------------------------------------------------Gorr·~spondin'.J
DNE_TRI?_OD
option
is
(or
is
not)
r€Cluested
at
A DO-loop control directive switch selection
overrides the corresponding ONE_TRIP_OO option request.
processor
invocation.
The .DT p~ramGter controls the minimum trip count.
If OT
is sot
(OT=l)} the minimum trip count for DJ-Ioops 15 one.
If or Is reset
(OT=O.), the minimum trip count for DO-·loops is zero.
A On-loop controt directive sffects the interpretation of only those
DO-loops whose DO-statements follow the directive in the same
program unit.
A DO-loop control directive found by th':1 prOCflssor to
rf!sufts in a diagnostic mess2ge.
be
in
error
CONTROL DATA PRIVATE
4-1
Control Data Corporation Standard FORTRAN
83/06/30
4.0
DATA TYP[S AND CONSTANTS
4.0
DATA TYPES AND CONSTANTS
The nine types of data are:
( 1 ) Inteaer
( 2)
R B fll
( 3 ) Double precision
( 4 ) Camp I 'J;{
( 5 ) LOJical
(6 )
Character
(7) Half precision
(8 )
Bit
( 9 ) Boolean
type i~ differnnt And may have
a
rerresentation.
The type may affect
the
operations involving the datum.
C~ch
different
internal
interpretation of the
The name employed to identify a datum or a function also identifies
its
dqta typAl A symbolIc nAme representinD R constant, variable,
array, Or functIon (except a generic function) must have only one
type
for
each program unit. Once a particular name is identified
with a particular type in a program unit, that type is
implied for
;.l n :' IJ s a iJ e 0 f t h:3 n am c 1 nth e pro 9 ram \J nit t hat r € qui f' e s a t y P e •
5ymhoJic name that identlfies a constant, variabte, array,
fUnctIon, or statement function may have its type specified
in a type-statement (8.4) as integer" real, doubJe precision, half
A
cxtiJrnaJ
prcci::;ionJ
hit,
compfox,lo9ical, Bool9anJ
or
charkicter.
In
the
ahsence of 3n expllclt declaratIon In a type-statement, the type Is
i,mplied by the 'first letter of the name. A first Jetter of I, J, K,
L,
~: 0'
0r
>1 imp Ii est Yp '3 i n t 0 J e r ? n d I) n y 0 the r let t e rim p t I €: S t; YP e
real' unless 1n IMPLICIT statArnent (8.5)
is used to ,change the
default impl ied type.
cnnTROL DATA pRIVATE
4-2
Control Data Corporation Standard FORTRAN
83/06/30
-
....................... ..... - ............... -..---------------------------------------------------.--4.0 DATA TYPES AND CONSTANTS
4.1.2 TYPE RULES FOR DATA AND PROCEDURE IDENTIFIERS.
---~
-----------------------------~--------------------------------------
The data type of an array element nami is the same as
its array name.
Tho
supp)
the
type
of
data type or 3 function name specifies the type of the datum
ied by the function reference in an expression,
A symbolic name that identifies a specific intrinsic function
in a
prOJrfifl1 unit has ;3 type as specJ'fsBd In 16.10.
An expl1clt
t y p e - S tat erne n t is no t r e C] u t red; howe v e r JI i t i s perm itt e d.
Age n e ric
function name does not have a predetermined type; the result of a
ueneric function reference assumes a typa that depends on the type
of
tho argUmf~nt, '3S spr:!cifled In 16.10.
If a g€:neric functIon name
appears in a type-statement, such an appearance is not sUfficient by
itself to remove the generic properties from that function.
\
I n .:1 pro J r a ;j) u n t t t hat con t a ins ant:: x t ern & I run c t Ion r e 'f ere nee .1 t h ~.!
type of the function
is
determined in the same manner as for
variables and arrays.
T h a t ~' p e
n~mejl
0
· r Jn
type-statement.
sub pro J r
t h8
A
S t.I b
(H;}
m a,:;'
e x to rna I fIJ net jon iss p e c i fie dim p lIe i t 1 y by its
FUNCTION
statement,
or explicitly in a
that an IMPLI:IT statement within a fUnction
a f f ~1 C t t h f.! t Y P e 0 f the e}{ t ern G I fUn c t ion s pee if i e din
explicitly
1n
a
Note
pro ~] r 71 i~ •
sYmbolic name that identifies a main program, subroutine, common
or hlocl{ d2\t:::~ -suhprogr,nm has no di:Jta type.
bJock,
mat hem a tic a 1 an cI rep res e n tat ion pro P ,3 r tie s for,) B. c h 0 f the d a t a
types are zpecified in the followina sections. For real, double
precision, half precision, and
integer data ..- the v;;tlue zero is
con sid ere (I n e i the r
po sit i ve nor neg a t i ve • The val u e 0 f a s i 9 ned
~z t~ r 0 i s t h -;3 Ll IT! e (l s the '/ 'i1 I U l'; 0 f A. nun s i !J ned z e r 0 •
The
4. 2 CJltl~IAMIS
consttint,
bit
GQo.s..tao.t i s an arithmetic constant., logic,f11
constant, Boolean constant., or char a ct e r const3nt. The value of a
constant do~s not change.
Hithtn an executable program,
aI I
constants th:-:1t have the same Porm hn vc the same value.
/\
The
the strin0 representing a constant specifies both its
APARAMf:TER stcltement (B.6) 8.11oHs a constant
to be given a symbolic name.
The symbolic name of a constant must
not be used to form part of another constant.
Val\L~
form
of
and ddtn type.
CONTROL DATA PRIVATE
4-3
Control Data Corporation stanrlard FORTRAN
83/06/30
{t.O
DATA TYPES AND CO:'ISTANTS
4.2.2 BLANKS IN CONSTAHTS.
-----------------------~---------------~-------------.---------------
characters oGcurr Ing In a constant, except in a character
constant or a HoI Jerith constant, have no effect on the value of the
. constant.
i1lanlc;
real, double preCision,
oonstants are 3LlthB~tl~ ~~D~lan±s£
Integer,
half
pr(!cision,
and
complex
llu~llln~d ~2Q~iant Is a constant without a leading sign.
A SlgD~~
~nnstaDt is a constant with
q
leadlno
plus or minus sign,
An
Q£tlnDal!~
Si2DRd GnDst~n! is a constant that nay be either signed
An
or unsigned. Integer, real, double precision]
and half precision
constants may b0 optionally siDn~d constants, except where specified
othorHise.
Ani n t
t:~'J
cr
d a tum
i s a I H 3 Y san c}( act
rep res e n t
2. t
ion
0
·r
an
Integer
value.
It may assume a positive, negative, or zero value. I t may
assume only an integral value. An inte.ger datum h:as one numeric
~torage unit in a storage sfqucnce.
The form of an InieaaL QDDstaot is an optional sign followed by n
nonempty string of digits~ The digit string is interpreted as a
decimal number.
A real
datum is a processor 8pproximation to.the value of a real
number. It ffi3Y assume a positive, neQative, or zero value. A real
:.latum h~,s 0.1,;: numeric storage unit in J stora:Je sequence.
Th·:J ·form 0 r 0£1 bas.l.n I:.a.al ~aus.tEat i oS an opt i ana lsi an, an I nt cger
part, a decimal point, and a fractional part, in that order.
Both
th(:
int~JGi"
p;;1rt
end
the
'frnctional part are strings of digits;
efther of thi~Sf~ p;:.lrts mny he omitted but not
both.
A basic
real
constant may be written with more digits than a proces~or wi) I use
to approximate the value of the constant. A basic real constant is
int(~rpr(~tF1d
83
n ol)oiml,l
n\Jmh·~r.
CONTROL DATA PRIVATE
4-4
Control nata Corporation Standard FORTRAN
83/06/30
------------------------------------~-----------~-------------------
4.0
DATA TYPES AND CONSTANTS
4.4.2 REAL EXPONENT.
-------------------------------------------------------------~------
The form of
option~lly
of ten.
letter E followed by an
a L~al eXenngo± is the
siJned inteJer constant. A real exponent d~notes a po~er
The forms of
(1)
d
L~al
cDus~a~t
are:
Basic real constant
(2) Bnsic: real constant foJ
to~ed
(3) Intejer constant followed
by
b;' a rea) t'!xponont
a real exponent
The value of a rea) constant that contains a real
exponent is the
product of the constant th3t pr~cedes the E qnd the power of ten
indic8ted b~ the tnteger following the E. The integer constant part
of form
(31 may be written with more digits than a processor will
use to approximate the value of th~ constant.
A double precision datum is a processor approximation to the value
of a reRI
nUlaber. Thn oreclslon, nlthough not specif;.ied, must b~
greater than that of type real. A double preclsion datum may assume
a positive,· negative, or zero value.
A double precision datum has
two consecutive numeric storage units in a storoJe sequence.
The form of 3 ~Qubl~ nL~clslno ~!~ungot is the letter D folloHed by
an optionally signed integer constant.
A double precision exponent
denotes a power of ten. Note that the form and interpretation of a
,)0 u h lor r ~! cis i on r~;.: p 0 n'l:l n t; a r '3 i dl,; n tic a I t o t h 0 S e 0 f a r e a I e 'X p on e n t J
·}xccpt that the letter 0 is used instead of the letter E.
Th~
forms
or
3 ~nubla
lltBclslnu
~nustan±
are:
(1) Basic real constant folioHed by a double precision exponent
(2) InteJar constant followed by a double precision exponent
The value of a double precision constant is the product of the
constant that pre(':f!d(!s th,~ 0 and th,:! p01Jer of ten indicated by the
i n t: e 0 e r f 0 I 10) JI n 9 t (J e D•
The 1 n t e'J n r con stant par t 0 f for m (2 )
may
be \lritten Hith more digits th::tn a processor Hi II use to approximate
the value of the constant.
COtlTROL DATA PRIVATE
4-5
Control Data Corporation Standard FORTRAN
..................... -.-_ .... - ..................
4.0
83/06/30
------------------------------_._----- -.----~---.------
DATA TYPES AND CONSTANTS
'4.6 CDl'1?l[X TYP[
-------------------------------------------------------------------A complex dotum is a processor approximation to the value of a
cOt;l!11 ex
number.
The r epr esen ta t i on
of a comp I ex datum is in the
form of an ,orrlered pair of real data.
The first of the pair
represents the real part of the complex datum and the second
repreS!2!nts the 'imaJlnary psrtll
E~ch part has
the same degree of
approximation as for a reaJ
datum.
A complex datum has two
consecutive numeric storage units in a storago sequence; the first
.s to ftl J a u n I ·c i s ,t her e fl J P J r tan d t h;a sec 0 n d s tor age un j t t s the
Il'naginary part .•
The for~ of a nnmQl~x C2DSiBOi is a left parenthesls followed by
an
ordered pair of real or integer constants, or symholic names of real
or integer constants, separated by a comml1, and foJ lowed by a ri ght
pnrenthes is. The f'i rstconstant, or sYFlboJ ic nane of a constant, of
the pair is the real part of the compl ex constant and the second
the imaginary part.
A logical datum may assume only the values true or false.
~~Jatum has one num'~ric storagf': un'it in a stor~!Je sequence.
The forms and values of a
loal~al
~onsi3Di
is
A loaical
aro:
+-----------+---------+
Form
Value
+-----------:---------+
-TRUE.
tru~
.FALSE.
false
+-----------+---------+
A charariter datum is a string of characters. The string may consist
of any charJcters capable of repr~sentation in thn processor. The
b I a n k ell a r3 C t (~ r j s val I dan d s ian if J can tin a c h (1 r act e r d F.i tum ..
The
l~nnth
of a character datum is the number of characters in the
!Jtrina.
A ciluracti!Jr dntlJrn h~s on"?, character storagn unit in a
storage sequence ?or each character
in the strlng~ The maximum
number of characters in a character datum is 2**16-1 (2~:*16-1 =
65.1535).
::: ? C h
c h ~ rae t i;. r i nth e s t r I n J h n5 '~ c h a rae t e r p 0 sit ion t hat i s
numbered consecutively 1; 2, 3,
etc.
The number
indicates the
sequential position of a chqracter in the strino, beginning at the
COilTROl DATA PRIVATE
Cnntrol Datd Corporation Standard FORTRAN
4-6
83/06/30
4.0 DATA TYPES AND CONSTANTS
4.0 CHARACT2R TYPE
left and proceeding to the right.
The form of a nba[acte~ ~nDst3Dt is an apostrophe followed by a
noncmpty string of characters followed hy an apostrophe. The string
ma~ consist of any
characters capable of representatIon In the
processor. Note that the delimiting apostrophes are not part of the
datum represented by the constant. An apostrophe within the datum
strina is rapresented by two consacutlve apostrophes with no
intervening blanks.
In a character constant, blanks. embedded
between the delimiting apostrophes are significant.
character constant Is the number of characters
except that each pair of
apostrophes,
consecutive
apostrophes
counts
as
a single character.
The
dt".! lim i t j nLl lPostrophe$ arl~ not counted.
The lenDth of a chsracter
aOflst ant must be gr:::!F.1ter than zero·.
Tho
length
of
the
betHeen
3
delimIting
A Boolean datum is B string of ~ bits, wh3re 2 is the number of bit
positions belongina to one numeric storage unit.
A Boolean datum
has one numeric stofsJe unit.
A R2DlaaD_CDnstsDt Is a Hollerith constant, an octal constant, or a
hexadecimal constant.
nHf
L "f"
RH !,"
H..E n
where:
;:} n 1.J n.s i Dned J non Z~~ r 0 ,
i n t :~ !J e r e 0 n s tan t
not 9 rea te r
than g, where Q is the maximum number of characters that
onn be represented hy the processor in one numeric
!l' i.s
CONTROL DATA PRIVATE
4-7
Control Dqta Corporation Standard FORTRAN
83/06/30
-------------------~--~-~~-~-~-~~-~~~~~~~--~-~--~-----~~-~-~-------11' .0
0.1\ TAT YpES AND C STAN T S
on
4.9.1.1 Hol13rith Constant
storage unit.
f
is £ string o? D charActers. The string may cons 1st of
any
characters
capable
of
representation in the
processor.
Blanks
in
a
Hollerith
constant
are
siJnificant only in this string.
.datul'l
rBj:tresentt~d by a Holler ith constant is determined by the
internal processor code for the characters in the string f
and
the
'I' 0 r m 0 f
f i I l i n die <'d; e d by
the for In 0 r the con s tan t •
By till j s
meant the string of bit values supplied by the processor either to
tho left or right of fJ if any is requireri, to complete the datum.
The datum is compl ete Hhen a11 its bits are determined.
The
For the OH! and "i" forms, the str inJ f.
is
l~ft-jlJsti fl ed
in the
J~tum
anJ the flIt
is a string of bit values constituting the
internal processor code for a string of blank characters.
For the LUt u form,
the f i l l
For
the P."f" form .•
th:e f i l l
the string f. is
left-justifi\~d
in the
datum
and
is;') strlnJ 0'[ 0 bit values,
the string f. is right-justified in the datum and
is a striniJ of 0 bit values.
The chC1ractf~r n within "f" is represented
consecutive It characters within !.
by
a
string
of
two
Q"b[hl ••• "
HhS!re:
b is an octa1 dijit.
datum represented by sn octal constant Is the string of bit
obtained by mnppinD each octal
dJolt
into
Its equivalent
three-digit binary number system value._ right-justified with a fill
which is a string of a bit values.
The number of bit values in the
resulting string must not he greater than the number of bit
rositiuns In ono numeric stora99 unit. Note that a blank character
is not significant anywhere within an octaJ constant.
The
l.J~lues
CONTROL DATA PRIVATE
4-8
Control Data Corporation Standord FORTRAN
83/06/30
--------~------------------------~----------------------------------
4.0 DATA TYPES AND CONSTANTS
4.9.1.3 Haxadeclmal Constant
Z"Z[Z]· ••
H
Hhere:. Z. is a hexadecimal diait.
The datum representod by a hexadecimal constant is the string of bit
values
obtained
by mapping
each hexadecimal digit into its
oquivalent four-diait binary number system value, right-justified
with 3 filt whIch 15 n strinD of 0 bit values. The number of bit
v~lues in the resultin6 string must not be greater than
the number
of bit positions in one numeric storage unit. note that a blank
o h n rae t (;: r i s not s 1 J n i f i (; ant 1 n ;<'t..J her C i'li t h i n ,1 hey. \31 e c i rr. a leo n s tan t •
A half pracision datum is a processor approximation to the veluc of
a real number. A h~lf precIsion datum may assume a positive,
neJative, or zero value. A half precision datum has one-half of a
numeric storaoe unit in a storage sequence.
form of 3 b~!! 2teglslgo ~~u~o~oi is the letter S fol lowed by an
optionally signed inteoer constant.
A half precision exponent
denotes a power of ten. Note that the form and interpretation of . a
hair p r ~~ C I .s I on a~,t p 0 n n n t -are i'·1e n t i to::1 I to t h (' S e of are 8 I exponent,
or double precision exponent, except that the Jetter S is used
j nstead of the letter f, or D.
Th~
The forms of a bilf
e[g~l~lDn
£2osiaut
are:
(1) bastc real oonstant followed by a half precision exponent
(2)
inte£er constant followed by n half precision exponent
vallJ~~
Oh~
a
h~lr
pr'.'!CISlon constant
is the product of thfJ
constant that precedes the S and the pOHer of ten indicated, by the
integer following th~ S.
The integer part of form (2) may be
The
COt,! T ROLD ATAP RI VATE
4-9
Controt Data Corporation Standard FORTRAN
---...........-........
4.0
83/06/30
-
............. ..... ----------------------------------- ----------------DATA TYPES AND CONSTANTS
-~--
4 • 1 0 • 2 HAL F ? REel S I :] N C 0;., STAn T
I r itt en wit h m0 red i 9 its t han apr 0 c e S S 0 r }Ii I 1
the value of the constant.
to
a p pro x i mat e
B"O" and nUl".
A bit datum
j
A
bit
datum may assume on 1y th e vn lues
use
has one bit stor69c unit jn a storage sequence.
forms of () bit constant are BUO" and B"l n ,
Note
that
a
character is not significant anywhere within a bit constant.
Tt"l'~
b1ank
CONTROL DATA PRIVATE
5-1
Control
Corporntlon Standard FORTRAN
O~ta
83/06/30
5.0
ARRAYS AnD SU8STRINGS
5.0
ARRAYS AND SUBSTRINGS
.ac.r..ay is a (possibly empty) sequence of data. An 1l!.r..a~ ,gl£m~Ll.t
is one member of, the sequence of date.
An atta~ nam~ is the
symbolic name of an array. An B£tBx nlgm~Dt nim~ is an array name
An
fl u a J i 'r- 1 .~ d b ::l a sub s c rip t
(,5. 4 ) •
An array name not qualified by a subscript identifies the entire
sequence of elements of the erray in certain forms where such use is
per Til itt e d (5. ,) ); h 0 ~I e Vi? r , I nan EQUI VALE tlC Est ate I'll e nt, a n a r ray n a me
not qualified by a subscript tdentifies the first' element of the
array (8.2.4).
An array element n2m8 identIfies one element of the sequence. The
subscript value (Table 1) specifies the element of the array being
identified. A different array element may be identified by changing
th~ subscript value of the Array element name.
An
A
:3 r
ray n rl(il cis
5yb~lr!ng
5.1
I 0 C ;[j I t (}
2
pro 9 ram un i t
(1 9 • 1. 2 ).
is a contiguous portion of a character datum.
ARRAr~_AtlQ_ARRAY_S~~II~~S
5.1.1
ABEAY_UA~E_AUD_A&RAY_Sf~IID~_&EEf&EU~E
Whenever an array name, unqualified by a subscript, or an array
section name is used to designate the whole array, or an array
section, thc'sppeer,lnce of the array nama or array section name
implies that the number of values to be processed is equal to the
number ,of elements in the array or array section and that the
eluments of the array or arrAY section are to bn processed In
sequential order, 9xcept in the eva~u3tJon of array expressions and
in array assiunment statements.
An' assumed size arr1Y m&y not be used in an array reference. An
1ssumed siz~ array s9ction reference may not be used In an array
reference if a section selector of
or -* is used in the lasi
subscript position.
*
An 3LLEY
:1rr':\y
dg~lALa!Q~ specifies a symbolic
name that identifies
p prOOf8n1 unit '1nd .~p?ci'fie.s certain properties of
Onl;- one ~rr;1y dt'!ctarr-ltor for an array name Is permitted
Hithin
']rray.
a progrrlm unit.
an
the
in
CONTROL DATA PRIVATE
)
ControJ
D~tn
5-2
Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------5.0 ARRAYS AND SUBSTRINGS
5• 2• 1
FOR j'l 0 F AI,I ARRAY 0 eel ARAT 0 R
The form of an 2lrrdJ' rioclarator
is:
is the symbolic nama of the array
~
is a dimension dec'arator
Thd number of dimnnsions of the array is the number of dimension
df~Gtarators
in the
array declarator..
The minimum number of
dimensions is one and the maximum is seven.
The form of a dlmenslQQ
~e~lBLBtor
is one of the forms:
[ill:] .02
[!.II]:
Hhar~:
£11
r!2
i s the
) O)OH1r
dimension bound
1.5 the upper dimension bound
The 'o~er and upp~r dimension bounds Bre arithmetic or Boolean
scalar expr e sslans3 called dlm~n~lnn hQgn~ ~XQLgs~lQn~, in which
~~ n c h r r i In'] r y i s
0
constant" s y mb 0 Ii c n :a me of cons tan t s ,
dummy
8rJument nenc of a vnriab't.: or array, or any Intrinsic function
reference which is allowed in an extended
integer
constant
expression.
A dimension bound expression must be scalar and of
int~~f.)~r t~'pe.
An:lctual argulni3nt to an intrinsic function reference
In a dimension bound expression may be ~ny entity that is allowed tn
an extended constant expressiori or that is allowed in a dimension
b 0 un d
r: :~ p rf! S S ion
for
an
Cl d J ~.J S t a hie
a r ray dec 1 a. rAt 0 r •
The up per
dlnenslon bound of the 1·;jst dlm!~nsion must be
nn· asterisk in an
assumed-sizQ array declarator.
A dimension bound expression must
not contain a nonintrinsic fUnction or
array element reference.
V a ria b I e s
rn ::;1 y
tl P pea r
i n dim ens Ion
b 0 un d ex p r n s s Ion s o n I y
1n
adjustable arra~ declarators and as actual arguments to intrinsic
function references.
Array names may appear in dimension bound
~xpresslons
only ~s actunl arguments
to
intrinsic
function
references.
In
a dimension bound expresslon, the symbolic name of a constant, a
or
~n
1rray must be l~xpticitlY typed prior to its
varjqbl~,
in the dimension bound expression.
If It is not
typed prior to its appearance
in the dimension bouncd
e x pre s s ion,
i t
wj J i b e
t yp e d
us i n 9 its i nit i a I let t era n d the
lpp38rance
cxplicitJ~
d ~~f a u I tim p I iJ M t YP i.~ r u 111 S t h ::! n
dim ens ion
b <) u n d
,~ x pre s s ion
In
effect.
i s t y pc d by
I
r
::1 n
imp lie d
entity
in
u
t y pin g,
any
CONTROL DATA
)
?RIVAT~
5-3
Control Data Corporation Standard FORTRAN
63/06/30
---~----------------------------------------------------------------
.5.0 ARRAYS AnD SUBSTRINGS
5.2.1.1 Form of a Dimension Declarator
-------------------------------------------------------------------sub s e (HI en t e): P 1 i cit t y p 1n g mus teo n fir m the imp lie d t y p e •
No array name appearing in an array decl arator
in
statement may be referenced in a primary of any
the same specification statement. For example,
a
specification
~xpressjon
within
REAL A(lO,EXTENT{A,l»)
is prohibitHd.
If a dimension bound dl is a Boolean expression, the v31ue used is
INT(!il).
The value or eIther dimension bound may be positive,
neDative, or zero.
If only the upper dimension bound is specified,
thiJ
valuo
of
thf!
IO~10r dimension bound is one.
If the dimension
declarutor Is of the forn [dl]: and the
lower dimension bound Is
omitted,
its value is one. An upper dimension bound of an asterisk
Is ~INays greater than or equal to the Idwer dimension bound.
Eqch arrAY J~clarator is cithar 8 constant array deC)BratorJ an
adjustable array declarAtor, an assumed size arra~ declarator, or an
assumed-shape array declarator.
A £QQst~Dl ~£La~ ~g~l~IalgL is an
array d~clarator in which each of the dImension bound expressions Is
~n integer
constant expression (6.1.3.1).
An 3~jy~t~bl~ ~LLB~
je~lBLatnL
is an Qrray declnrator that contains one or more
va r f '~b 1es •
An
3s.,s,UIDf.u:!-z.lzfl 3r:..r:.!!~ .d~.cl.a.c.E.j;!lr. 1 s a
.Co.l11!DO:!dl.sg
3E~um~~=~lzg
aLL~~
~gglaLa!g£
or a LntlHl~~ as~um~d=sl~~ ~LI~1
A CQ!umuHlse
~~~l~LBtn.r:..
constant
that
A
tlv~
as~umad-~lzB
array declarator or
lIpp::~r
~QtlHl~a
~n
d i !lIons ion bound of thtJ
Essum~d=slzg
0 r B n ~ ,1 j U 5 t ;3 b I
BLca~
ELLa~
d~c13.r:.atg~
Is
a
adjustable array declarator, except
last dimension is an aster i sk.
~gQ!3~B!QL
is a constant array
ear ray dec' a rat 0 r.' e )'; c e p t tho t the up p 0 r
.Jin·~!nslon
bound
of the f1rst dimension
is
an ;:\sterisk.
An
lls.s.llmill1-!l.b..a2!l .aL.r:E~ .dS!~1.2lr.1!±.Q!' is a constant array declarator or an
adjustable array ~ecl aretor, except that one or more of the
dImension decJHrr:tors htlS a speclflcaton of the upper bound omitted.
rJ eel a r Q tor
I·
array declarator is either an actual array declarator, a dummy
arr·qy d8clarator, or nn alloc;,table array declarator.
~ach
)
An a~tY31 ~LL3~ ~~glatutg[ is nn array declarator
in ~hich the array
a dummy argument.
Each actual array dt~cl arator must be
array declarator.
An
actual
array deciErator
is
in a DIMENSION statement, a type-statement, or B COMMON.
name. is not
a
constant
permittad
stJtemsnt (Section B) •.
)
CONTROL DATA PRIVATE
I
:a
•
I
5-4
Control Data Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------5.0 ARRAYS AnD SU3STRINGS
5.2.2.2 Dummy Array Declarator
---------------------------------~----------------------------------
is an array declarntor in which the array
tor J s the n am e 0 ill: the s r r E 'j - val u e d fun c t Ion
in which the array is being declared. A dummy array declarator may
be a constant arraY declarator, ~n adjustable array cteclarator, an
rls£umed-si1ap€! array d\~clarator, or an assumed-size array declarator.
A dummy array decl arator is permitted in .. a DINENSION statement or a
type-statement but not in a COMMON statement.
A dummy arraY
lee I a r:l tor ill il yap p 0 a ron I yin H f un c t i on or sub r 0 \,1 tin e sub pro 9 r am •
A
~YmID~ a~Ln~
~g~!~L3!nL
n a !il e 1sad u tU:l Y
B. r J u man
i
An al1Q~at~hla StL3~ jeGlaL2ta~ Is an array declarator in which the
array name 15 not a dummy argument. An allocatable array declarator
must be an assumed-shape array declarator with both upper and lower
:1 i m1~ n s ion b 0 1.1 n d s 0 in itt,~ d r- 0 r eve r y di men s I on •
The foJJowin0 properties of an array arC specified hy the array
declarator:
th€~
number
of dlfrenslons
of the array, the size and
bounds of each dimension, and therefore the number of array
elements.
The properties of nn array in p projram unit are
array d{~cJar.lt{ir for the array in that pronram unit.
An array nBme has 3 data type C4.1.1}.
the sam~ data type as the array name.
An array
element
The
number of dimensions of an array is equal
dimension deciarators in the nrr~y declarator.
The
slz9 of
3
~lm~n~lnD
speclfl~d
by
name
the
has
to the number of
is the value:
••
••
Hhere:!II
d2
is the
v~aJue
(IF the lower dlmenslon bound
is the value of the uppor dimension bound
Note that If tha vf.l!ue of the lower dimension bound is one,
of the dimension is HAX(!i2,Ol.
The
size
specified.
the size
o?
u dimension whose Upper bound Is an asterisk is not
The size of a dimension of an
assumed-shape
array for
CONTROL DATA PRIVATE
5-5
Control Data Corporation standard FORTRAN
83/06/30
.... ----_ ...................................... ----------------------,------_._---------:---------------
5.0 ARRAYS AND SUBSTRINGS
5.3.2 DIMENSIDNS OF AN ARRAY
-----------------------------------------------~-------------------~hlch the dimension
bound expression
is of the form [dl]:
is
MAX(sa-dl-1,O} where S8 is the size of the corresponding dimension
of the associated actual argument.
The number and size of dimensions in one array declsrator may be
different Prom the number and slze of dimensions In another ~rray
declarator that is associated by common,
equivalence, or argument
association, except as prohibited by the table in section 8.2.3 and
hy section 16.9,3.3.
The 51z~ Qt an aLta~ is equal to the number of elements in the
nrray. The size of an array 15 equal to the product of the sizes of
the dimensions specified by the array
declarator for that array
name.
The
size of an assumed-siz,e dummY array (5.8) is determine<1
.1 s f 0 I I 0 vI S :
(1) If tha actual argument corresponding to the dummy array is a
noncharacter array name, the size of the dummy array is the
size of the actual araument arr oy.
(2)
I f the f\ctual
argument corresponding to the dummy array name
noncharacter array element n~me with a subscript value
of t in nn ~rray of size I, the size of the dummy array is ~
+ 1 -r..
is
a
the Rctual argument is s character array name, character
element name, or character array element substring name
and begins at character storage unit t of an array with ~
character storaJe units, then the sIze of the dummy array Is
I NT ( (£: + 1 - .1) I In), "., her e 10 i s the len 9 tho fan e I em e n t
of the dummy array.
(3) If
arra~
If a colunnwlse assumed-size dummy array has D dimensions, the
product of the sizes of the first 0-1 dimensions must be less than
or equal to the size of the array,
as
determi ned by onp. of the
immediately preceding rules. If a rOHwise assumed-size dummy array
htl's 0
dim"~n,sions,
the
product of the sizes of the last .0-1
dimensions must be less than or equal to the size of the arraY" as
determined by one of the immediately preceding rules.
The,size of
statement.
)
)
nn
alloc~table
Is
array
specified
by
an
ALLOCATE
;~I!.Hn0nt.s of an array are ordered 1n a sequence (2.1).
An array
element name contains a subscript (5.5.11 whose subscript value
Th0
( 5• 5•3)
d (;! t 'a r fi1 i n e.s
':fJ hie h
c I "~ fa e n t
0 f
the
3r
r :J y i sid en t i fie d by t h t1
CONTROL DATA PRIVATE
5-6
Control Data Corporation Standard FORTRAN
83/06/30
.5.0
ARRAYS AND
SUBSTRINGS
5.3.4 ARRAY 2lEMENT ORDERING
array element name.
valu.i.1
of
Oili3;
The first element of the array has a
eJem:~nt
the second
has
subscript
a subscript valuE; of two; the
last element has a subscrtpt value equal to the size of the arraY.
Whenever an array name unqualified. by a subscript is used to
designate thc whol8 arrey (5.9), the appsarsnce of the array neme
implies that the number of values to be processed Is equal to the
number of elements in the array and that the elements of the array
are to be taken in sequential order except in the evaluation of
nrray expr~ssions,
in arrey a~siDnmant statements, and in FORAlL
statements.
An ~rray has ~ storage s~quence consistln~ of the storage sequences
of the arra,i elements in the order determined by the array element
ordering. The number of storage un1ts in an array is X*Z, where X
is the number of the clements in the arrRY and Z Is the numher of
storage units for each array element.
The form of an array element name is:
Hhere: .a
is the array name
(~['53
£
••• )
is a subscript (5.5.1)
is a subscript
e~presslon
(5.5.2)
The number of subscript Qxpressions must be equal to the
diucnsfons in the array decl arator for the array name.
5.5
number
of
SU.aS.CEIEI
The form of a
(.5
Hhere
~
~UbS~~lQt
is:
[".5.] ••• )
is a subscript expression.
Note thz.t thr,;! t'3rm "subser ipt" Includes
the parentheses that del imit
the I ist of subscript expressions.
CONTROL DATA PRIVATE
5-7
Control Data Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------5.0 ARRAYS AnD SUBSTRINGS
5.5.2 SUBSCRIPT EXPRESSION
-------------------------------------------------------------------A ~llbs~£l~±
nXeLe~~!QO is an 'nteger! real, double
precision, half
precision, complex} or Boolean scalar expression.
A subscript
;;'!xpression filay contnin arr~y element ri;ferences and
function
references.
Note
that
a restriction in the evaluation of
expressions (6.6) prohibits certain side effects.
In particular,
evaluation of a function must not altar the value of any other
subscript (~y..?ression ·~·dthln the sa.me subscrIpt.
within a program unit, the value of each subscript expression must
be greater than or equal to the corresponding IOHer dimanslon bound
in the array declar~tor for the arrey.
The value or each subscript
expression must not exceed the corresponding upper. dimension bound
declared for the array in the program unit. If the upper dimension
bound is an ~starjsk, the yalu~ of the corresponding subscript
ex~rcssionnust be such that the subscript value does not exceed the
si.ze of the dummy array.
If an upper dimension bound is omitted in
an assumed-shape array, the value of the corresponding subscript
expression Si must be such that
s.i
~
rlt + s.a - 1
r e LlI
i s tho I 0 ':1 e r dimenzion bound of the dImension where the
subscript is written and SB is the size of the corresponding
d InHl n s ion or t h e:-t c t \J a I argument Associated with the assumsd-shape
array.
';I h~
The value of each subscript expression of an aJ locatable array must
be greater th~n or equal to the correspondinJ lower dimension bound
e .s tab , i $ h is!C1 b y the e x C cut ion o'f the ALL 0 CAT Est ate men t •
The val u e
of each subscript expression of an allocatable array must not exceed.
the corresponding upper dimension bound established by the execution
of th~ ALLOCATE statement.
The ~Yh~QLlet xalY~ of a subscript is specified in Table 1. The
5ubscrtpt vd)ue det~rrnin~s whIch ~rray element is ldentlfied by the
~rray
element name.
Within a program unit, the subscript value
depends on the values of the subscript exprassions in the subscript,
the dimensions of the array specified in the array declarator for
the arr~y in the program unit, and whether the array is a columnwise
array or a rowwise array (see B.10).
If the subscript value is £,
thn c.th c I emont of the :.~r r ay is i dent If i e d.
CONTROL DATA PRIVATE
•
••
I
Control
Dqt~
5-8
Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------5.0 ARRAYS AND SUBSTRINGS
5.5.3 SUBSCRIPT VALUE
I.ahl!;_l
Subscript V?: Ille
For Columnwise Array
+---+-------------------------+-----------+--------------~-+
Dimension
Declarator
: n :
~
Subscr ipt :
••
Suhscrlpt
Value
+-~~:---~--~~-~~-~~---~--~-~--:~~------~~~:~---~-----------+
•,
I
1
•:
: 1
•
;l+(sl-Jl)
(s 1)
-------------------------:-----------:----------------+
+---
1
I
2
(j
1: J, 1 ... J 2 : !( 2 )
(51,S2)
:1+(Sl-j1)
: +(s2-j21*dl
+-~~:-~--~-~~~----~~-~~~----~-:-~-----~~--:--~-------- -----+
•
I
(sl,s2~s3)~1+{sl-jl)
3
: +(s2-j2)*dl
: +(s3-J3)*d2*dl
+---:-------------------------:-----------:----------------+
J
I
•
I
•
•
•
•
I
•
I
•
I
I
•
1
I
•
•
I
•
t
+---:------------------------n
(jl: 1<:1., ••
t.t
jn: kn)
j
•
-----------.~---------------+
(S1, ••• ,50) 1+(51-jl)
+(s2-J2)*d1
+(s3-j3)*d2*d1
+ •••
+(sn-jo>*dn=l
d .0= Z*•.. ~: d 1
*
-r.---+-------------------------+-----------+-.-~------------+
CONTROL DATA PRIVATE
Control
o~ta
5-9
Corporation Standard FORTRAN
83/06/30
------------------------------------------------------------~------5.0
ARRAYS t\nD SUBSTRINGS
5.5.3 SUBSCRIPT VALUE
-----------~--------------------------------------------------------
(continued)
Subscript Value
For Rowwise Array
TabJe 1
+---+------------~------------+------~----+-------------~--+
~ n :
0 i iiv;ns I on
~ Subscr i pt;
Subi,cr i pt
Declarator
;
Value
+---+-----~-------------------+------~----+----------------+
1
I
I
I
I
; 1 : (jl:kl)
1
t
:l+{sl-jl)
(s1)
J
+-.--+-------------------------+-----------+----------------+
•
(j1:I*d2
0.
1rd3~:
••• *dn
+(s2-j2)*d3
*d 4* ...... !".,: du
+ •••
+(sD=l-jo=l)*dOI
+(sD-Jn)
+---+-------------------------+-----------+----------------+
Notes for Table 1:
( 1 ) n 1 s the nunber of d i
,
'
nl!~n s
j 1 i
( 3)
ki
i S tht.!
(4 )
rr.
only the up P0 r bound
(5) si
~
n ~ 7
s the value of the lower bound of the lth dimension
(2)
'j
Ion s ~ 1
is
valu\~
o'r the
upper
bo lln d
of the ith dimension
i s s peel? 13d, the'n j I
=1
the integer value of the ith subscript expression
CONTROL DATA PRIVATE
5-10
Control Data Corporation Standard FORTRAN
83/06/30·
.....,. . . I.. . . . . . . . _ _ _ _ _
5.0
5.5.3
~ . . . . . . , . . . . ",.. . . . . . . . . . . . . . . ' - - - - - - - - - - - - - - - - - - - - - - . - - - - - - - - - - - - . - - - - - . - - - - - - - - - - - -
ARRAYS AND SUBSTRINGS
SUBSCRI~T VALUE
-------------------------------------------------------------------(6) di = ki-Ji+l is the size of the lth dlmension.
of the IOHer bound is 1, then d i = ki
If the
value
that for arrays that do not have size zero a subscript of the
form (Jl, ••• /Jn) has a subscript value of one and. identifies the
first element of the array. A subscript of .the form (kl, ••• ,kn)
identifies the last elom~nt of the array;
its subscript value is
;~ota
nquuf to
numbsr of elements in the nrr('.lY ..
th(;~
.subscr i pt va I ue and the
necessar i I y th€ s amo, f3ven fOr.
The
fl
subscript expression value are not
one-dimensional
array..
In the
~xJmpJe:
DIN EN S ION A(-1: n ) J B ( 10,10 )
= B(1,2)
1\(2)
A(2) identi·j~.iI::S tho fourth element of AJ tht: subscript Is (2) y,lth a
subscript value of four, and the subscript expression is 2 with a
value of two.
n;~ d S:3 C {; ion i S lJ sed, the n u mb e r 0 f el em e n t sin
the
.resulting section along the dimension selected by the vector-valued
expression is determined by and is equal to the number of elements
in th0 vector-vuluad Dxpression.
An
array refsrence involving vector-valued subscripts} when used as
an actual arJument is an expression and may not be defined within
the 5ubprogr am.
For example, suppose Z Is u two dimensional array of 5 by 7 elements
nnd U and V are
one dimensional
arrays of 3 and 4 elements,
respcctivdly. Assume th~ values of U and V are:
U
V
= 13 2
= 211
then Z(3,V)
order:
3
of the alements of the third
consists
rOH
of Z in the
and Z(U,Z) consists of the column elements:
Z ( 1 ... 2) Z ( 3 .. 2) Z ( 2,2)
nnd finally Z(U,V)
consists of the elements:
Z ( 1, 2) Z ( 1) 1 ) Z ( 1,1 ) Z ( 1, 3)
Z(3,2)Z(3,1)Z{3,1)Z(3,3}
Z(2,2)Z(2,llZ{2,l)Z(2,3)
A
dllmm~
aL£3~
is an array for which the array declarator is a
dummy
:'lrrr:l),
decl.]r~ltor.
An:;l~s.!.!.mll!:l=s.lZf. !!!JIllIll~ .art..a~ is " dummy array for
which the array declarator is an assumed-size arrRY declarator.
An
aS~llm~d-~bae~
dCGlaratnr
dummy
is
an
permitted only
in
dummy array for which the arraY
declarator.
A dummy array Is
function or subroutine subprogram (Section 16).
array
is
a
assumed-shape
~
CnnTRGL DATA PRIVATE
)
5-13
Control Data Corporation Standard FORTRAN
...-_"
...... - ... ---_ ............... - ......
83/06/30
-----------------------:---------------- -~-----.-----~--
5.0
ARRAYS At'10 SUBSTRINGS
5 • ,3 DUf'P' YAH D ACT UAL AR RAY S
An .a~.t.Y.alEr.r.llY is an array for which the array declarator
is an
uctu;'
arr3: declarator or an aJlocntable array declarator. Each
qrr~y tn the main program must be an actual array.
An actual array
in a subprogram must have a ConS tant array declarator or an
a I I 0 cat a b I ear ray . d 8 CJ :1 rat 0 r • An act u a I a r ray . tJi t h n n a I I 0 cat a b I c
array dec1arator Is called an allnGat3bl~ EL~a~. A dummy array may
be used as an actual argument.
An
is an array for which the array declarator is an
arrny ;jeclqrator.
In nn adjustable arrnY declarator,
those dimension declarators that contain a variable name are cal led
3~JYli1~blg aLti~
Jdjustabll.?,
3~lystahlg rtimeD~lnD~.
An sdJustahle arraY declarator must be a dummy array declarator. At
Je3st one dummy argument I ist of the subprogram must contain the
nAme of tha adjustable array. A vRriable name that appears in a
Jimenslon bound expression otan array must also appear 8S 8 name
either in every dummy argument list that contains the array name or
in a common block in that subprogram •
th~ time or oxacution of a reference to a function or
subroutine
GontainlnJ an adjustable array in its dummy argument list, each
~ctuaJ arJument that corresponds to a dummy argument appearing in
a
Jim~nsion bo~nd expression for the srray 3nd ~ach variable in common
lPpearing in a dimension bound expresslon for the Err8Y must be
defined with an integer value. The values of those dummy arguments
or variab1es in common, together with any constants and. sYmbolic
nam0S of constants nppeArino
in the dim~nsion bound expression,
determine the slzf! of th;.! correspondIng adjustable dimension for the
execution of the subprogram. The sizes of the adjustable dimensions
;:, n d 0 f n ny :) 0 n s t 2 n t d i ill <~ n ~ i on:; n p p e :\ r i n :1 i n n n n d J lj S t 6 b I € a r ray
lee J or utor
df:!ter:T1 i ne the number of e 1 eJiH::nts 1n the ar r ay and the
array element ordering. The execution of different references to a
subprogram or different executions of the same reference determjne
possibly diffurent properties (slz9 of 'dimensions~ dimension bounds,
nUmb1?r
of ~:~I.ements.· and array element ordering) for each adjustable
arrny in the subprogram. These properties depend on the values of
n n Y~1 c t lJ a "1 r fl u rn en t S ;:1 n d v a r i:l b I c sin com m0 n t \1 ;\ t n r e r B fer en c c din
thJ adjustable dimcloslon expressIons In the subprogram.
. At
During the execution of an external
procedure in a subprogram
containing an adJustnhle array, thg array properties of dimension
5 i z e,
I 0 W~ r an d U il per d i ;11 ens I on b 0 U n d s " and a r ray
s , z e ( n u mbe r 0 f
elements in the arr~y)
do
not change.
However, the varlables
involved in nn adjust~ble dimension may be redefined or become
;.J n n the abovd nlt:!nt J Oiled pr opert i es.
)
COPTROL DATA PRIVATE
5-14
Control Data Corporation Standard FORTRAN
83/06/30
~-------------------~----------------------------------------------5.0
ARRAYS AI'lD SUBSTRINGS
5.9 USE OF ARRAY NAMES
-------------------------------------------------------------------In
~
~rray
program unit, each appearance of an array name must
element name 3xcept in the foltoMing cases:
(1) In a list of
(2)
dU!/liT1~'
be
in
an
arguments
In a. COfH'10N .statement
(3) In a type-stntemant
(4) In an array declarator. Note that although the form of an
array declarator may be identical to that of an array element
ntlm(~J'an array dec1 arator Is not an nrrey element name.
(5) In an EQUIVALENCE statement
(6) In a DATA statement
(7) In the I ist of
actu~d
tU'Juments
In a reference to an external
procedure or en intrinsic function
(8) In the list of an input/output statement
( ') ) As a tJ n j t i d e n t i fie r f 0 r a, n I n t e r na J f i Ie in an
stqtement
(10) As the format identifier
(II) In
8
i n put lou t put
in an input/output statement
SAVE ststement
L12 ) As a primary in an array expression
(13) In an array assignment statnment
(14) In an ALLOCATE or FREE statement
In
(1S)
In an IDENTIFY statement
(16)
In
a
~
FORALL statement
program
unit~
arraY section
na~es
may appear In the following
places:
(1) In the list of actual arauments in a reference to an external
proccdur2 Or an intrinsin fu~otion
(2)
In tlH:
Jist of <30 I nput lou tput st
dt~nli3nt
conTROL DATA PRIVATE
)
5-15
Co,trol Data Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------5,.. 0
ARRAYS AnD SUBSTRINGS
5 ~ 9 • 1 A P PEA RA HCEO FAR RAY SEC TIn N NJ\ t" E S
-------------------------------------------------------------------(3) Asa unit
for an internal rile in an
id~JntJfler
input/output
statement
(4) As the format identifier
in An input/output statement
(5) As a primary In an array expression
(6) In an array assignment statement
(7) In a FORALL statement
A
character
an::1 is of
t':"rd~
substrinJ is e contiguous portion of a
ch~ractcr.
A
char:hct~r
substring
is
cher~cter
datum
Identified by
a
substring name and may be assigned vaJues and reFerenced.
The forms of a
~
-..,here:
1.
3
sYb~tL!Da D~m~
( Enl] :
[~2J
are:
)
is a character variable name
(s.
(,s,J ••• )
is
a character
array element name or array
section name
al
~nd D2 arc each an integer. real, double precision,
half
preCISIon, complex, or Boolean scalar expression and are
called ~Ybst[lO~ ~leLB~sluos.
If a(s[,~] ••• )
is an
Jrr3Y s\~ction, it Identifies the.suostrlngs of the array
clements identified by the section subscript.
The value el specifies the leftmost character position of the
substring and tha value ~2 specifies the rightmost character
position. For example, l,d2:4) specifies characters in positions t\,IO
throuuh fo~r of the character vAriable AJ and B(4,3)(1:6) specifies
c tLl ra c t e r s j n ? 0 sit ion so n e t h r 0 U &J h sIx of the character array
element B(4 ..fl3).
The length of a char3cter substrina is MAX(0,~2-ll1+1). If the
length is non-zero then the values of gl and g2 must be such that
l~~l~l£D' 1~a2~!~D.
If Rl Is o~ltted, 0 value of one is Impl led for
ill.
If ~2 is omitted, a value of l.e.n is implied for
.e2.
Both ~1
~l n d
112 !:I ~1 ':' b ~ 0 mJ 't t ~ d; for P,X n ITl pie J the for m y. ( :) I seq u I val e nt t 0
~J '~nd the form .a(~ [ , s ] ••• )(:)
is equivalent to a(~ ['Sl ••• ).
CONTROL DATA PRIVATE
5-16
Control Data Corporation Standard FORTRAN
83/06/30
3.0
ARRAYS A>lD SUBSTRINGS
5.10.2 SUBSTRING EXPRESSION.
A
maY be any scaJar
integer, real, double
precision, complex
or
Boolean expression.
A
substring exprassion may contain array eJement references and
Punction references.
Note that a restriction In the evaluation of
expressions (6.6) prohj"bits certain side effects.
In particular,"
evaluation of a function must not
alter the.VRlue of any other
~ub~tLIDJ
precision,
a~e~a~slQn
half
t)::**C2
I
Dl
1
D = 01** D2
:C=CMPLX(REALC01),O.)**C2
I
s
HI
C1
:
,•
D
=
OBLL(H1)~!*D2
:C=Cf1PLX(REAL(Hl),O.}*i'C2
:C=Cl**CMPLX(REALCD2),O.):
C
=
C1**C2
+--------+------------------------+--------------------------+
+--------+--------------------------+
x2
HZ
:
xl:
:
+--------+--------------------------+
H = HALF (II ):¢!l}:H2
II
t
R1
R
Dl
0
=
=
HI
}J
=
C1
Rl*~:R2AL
(H2)
Dl:}:~}!DBLE(H2)
HI:~;'!H2
lC=C1**CMPLX{REAL(H2),O.)
+--------+--------------------------+
Five entries in Table 3 speclfy an interpretation to be a complex
I U~
r a i ::; r~ d to:] C 0 H1 P fey po N .3 r •
I nth as H ca s 8 s, the v C1 , u e 0 r t h ~
"" ;'l.
CONTROL DATA PRIVATE
6-11
Control DAta CorporationStandgrd FORTRAN
83/06/30
-------------------------------------------------------------------6.0 EXPRESSInNS
6.1.4 TYPE AHD INTeRPReTATION OF ARITrHIETIC EXPRESSIONS
**
express i on is the "p r inc i pal
val u e " d e t e r min e d by
x 1 x2
=
2XP(x2*LOG(xl», where EXP and LOG are functions described in 16410.
Except for a value raised to an inteoer power, Tables 2 and 3
specify that if two operands are of different type, the operand that
~iffsrs in type from the result of the operation is converted to the
type of th~ result and then the operator operates on e pair of
operands of the same type. When a pr imary of type' real, double
precision, half precision, or complex is raised to an integer power,
thcl integer operand rlf~ed not be converted.
1il the value
of
12
is
negative,
the
interpretatlon of I1**12 Is the same as the
intnrpretation of 1/(Il**ABS(I2}), which is subject to the ru1es for
Integer divi3ion (6.1.5).
For
example, 2**(-3) has the value of
*
1/ (2* 3 ),
~,h
I ,c his z ~ r
0 •
The type and interpretation of an expression that consists of an
oPJrator opera~lno on either a single operand or a pair of operands
arc ind~pendent of the context In whicll the expression appears.
In
particular,
the type and interpretation of such an expression are
independent of the type of any other operand of sny larger
;:1)cprf.~ssion
in uhioh it ,3ppears.
For e1\1.lInp I e. ... if X Is of type real,
.J i S 0 "f t y pel n t e 9 e r, and
I NT
is
the
rca 1- t 0- i n t e 9 e r con v e r s ion
Function,
the expression INT{X+J) is an integer expression and X+J
i s n r (: Hie;!, p r t:: s s ion •
A Boolaan op<~r~lnd (Hither base Or
**
pOHer,)
of
the
operator
Is
converted to integer and the operation is performed on the converted
operand. A Doolean operand of the operator +, -, * or 1 is subject
t o t h ~~ f
0
I I 0 !.! j n!J rule s :
If two operands are of different type and one type is Boolean,
the result has the type of the other operand. If both operands
are of tYP3 Boalaen, the r~5ult has type integgr. The result of
the operator + or the operator - operating on a single Boolenn
operand is of type integer. A Boolean operand is converted to
the type of the result, and the operation is performed on the
convert~)"
operand.
operand of type intnger may he rlividect by ?nother operand of
inteJer. Although the mathemRtica' quotient of tHO integers Is
not necessarily an integer, Tabte 2 specifies that an expression
involving the division operator with two operands of type integer is
intarpreted qS ~n expression of type intencr. The result of such a
dlvlslon is cJlled an InianeL uuntlant Rod is obtained as fol lows:
If
the magnitude of the mathematical quotient is less than one, the
int8ger Guotient is zero.
nth~rHiseJ the integer
quotient is the
One
tyPi[~
CONTROL DATA PRIVATE
6-12
Control Data Ccrporai;ion Standard FORTRAn
83/06/30
----------~---------------------------------------------~-----------
6.0 EXPRESSIONS
6.1.5 INTEGER DIVISION.
integer whose magnitude is the largest integer that does not exceed
the magnit'Jd8 of
tht! mathematical fluotient and Hhose sign is the
S;;Elf3 as the sign o'f the rnathenatical
quotient.
For example, the
value of the expression (-8)/3 is (-2)
II
A character expression Is used to express
Evaluation of a character expression produces
ChJr8cter.
a
a
character string.
result of type
The simplest form or a character expression Is a character constant,
symbolic name of a character constant, character variable reference,
ch~r8cter
array element reference,
character array reference,
c h :) r ~, etc r a r ray s 'C c t i Q n r ef B r en c e , c h:1 r ~, c t e r sub s t r i n 9 r·~ fer e nee J 0 r
character
function
reference.
More
complicated
character
expressions may be formed by using one or more charRcter operand~
tOJother ~ith character operators and parentheses_
Tho char actor operator is:
+------------+-----------------+
Operator
Representing
+------------+-----------------+
II
Gt ion
+------------+-----------------+
Conc3tt~n
The int~rprBtation
np(!r8tor is:
of
the
~xpression
formed
with the character
+-------------------+--------------------------+
Usc of 0 per a tor
Interpret at i on
+-------------------+--------------------------+
:
xl II x2
xl with x2 :
Concaten~te
+-------------------+------------------~-------+
",h"'::rn: xl
d·~~not€:s
the operan1 to the Jeft of tht! operator
x2
Jenot~s
the operand to the right of the operator
The result of R concatenation operation is a character string whose
value is thu valu~ of xl concatenAted on the right oith thE value of
x2 and whose length Is the sum of th·,3 lengtlls of
xl
and
x2.
For
nxample .• the value of 'AB' II "CDE' is the string ABeD::.
A character
expression and the operands of a character expression
Except in a character
must identify values of type character.
CONTROL DATA PRIVATE
6-13
Control Data Corporation Standard FORTRAN
83/06/30
................... ..-,... ............... ..- ........ --------------------------------------------------6.0 EXPRESSIONS
(-, • 2 • 2 FOR ~,' Ann I NT:; R ? RET AT ION i] F CHARACT ERE X? RES S ION S •
"..... .-
-------------------------------------------------------------------assignment statement (10.4), a character expression must not involve
concatenation of an operand whose length specification is an
asterisk in parentheses (0.4.2) unless the operand Is the symbolic
name of a constant.
(1) Character constant (4.8.1)
(2)
Symb(aJ Ie name of a character constant (8.6)
(3) Character varlable reference (i.5)
(4 )
ChrlrZLcter arrey element reference (5.4)
(5)
Char~,ctt!r
(6 )
Character array section reference
( 7)
Chqr']ct,or substrioa r tlfer ence (5.10)
(8 )
Character functi on reference (1 6. 2 )
array reference
(9) Character expression enclosed in psrentheses (6.2.2.2)
(1) Character primary
Thus, a character expression 1$ ~ sequence of one or more character
primaries separ~ted by the concatenation operator.
Form
(2)
. indicnt9s that in a character expression containing two or morc
concatenation operators, the primaries are combined from left to
right to establish the interpretation of the expression. For
example, the formation rules specify that the interpretation of the
c} h J fa c t i= r e j4: pre .s s ion
'AB' II 'CD' II 'EF'
is the same as the interpretation of the character expression
)
)
('AB' II 'CD')
II
'2F'
The value of the character expression in this eXAmple is the s~me as
that of the constant 'ABCDEF'. Note that parentheses have no effect
CONTROL DATA PRIVATE
6-14
Control Dtlt:2\ Corporqition St::lndard FORTRAj··1
83/06/30 .
-------------------------------------------------------------------fh 0
EXPRESSIONS
6.2.2.2 Chr-Ir·:lcti:f
E)~prf,essi
on.
on the value of a character expression,
A
~bBLa~tgL ~gnslBn1 ~x2£esslnn
is a character expression
in
which
nach pr j mar y
is
a char ~.cb3r
const an t.l the symbol i c nsmeof a
ch',1racter constant.} or a ch;lracter constant expression
enclosed in
parentheses.
Note that variable, array element, substring, and
function references Arc not alro~ed.
An
e~±'~nd.eLl
ch8.ractl~r
constant express Ion is
character
a
constant
expression except:
(1)
sel(!cc~d
··~Ieml)ntal
intrinsic.
nrc alloHed" Hhen
functions
referenced with constant arguments,
(2) selected array-valued intrinsic functions
~re
alJoMed.
The 'I s t 0 f n J I \) w;~ del d mf~ n t a Jan dar r a y- vat u e din t r ins i c
is implementation dependant.
fun c t Ion s
A
relational
expression is used to compare the values of two
or Boolean expressions, ttlO character expressions, or tHO
bIt expressions. A relational expressIon may not be used to comp2re
the value of an arithmetic or Boolean expression with the value of a
character expression or hit expression.
A relational expression may
not be used to compnra the value of 2 bit 8vpression with the value
of D character expressionarithm~tic
Relational
expressions
may appear only within logical expressions.
produces a result of type
JOjfcaJ, with a vaJue of true or false.
eV3111,=ition of
The
fi
r~lational
rDlationalexpr~ssion
opefltors are:.
+------------+----------------------------+
1perator
Representing
+------------+--~-------------------------i
.IT.
.LE.
.EO.
.NE.
.GT.
.GE.
Less than
Less than or equal to
equal
to
Not equsl to
Greater than
Greater than or equal to
+------------+----------------------------+
CONTROL DATA PRIVATE
6-15
Contr1)1 Datn Corporation
St~,ndnrd
FORTRAH
83/06/30
-------------------------------------------------------------------6.0 EXf'JRESSIDNS
6.3.2 ARITH1'1ETIC RELATIONAL EXPRESSION.
l-Ihere: gl
and S!2
are each an ari thmetic expression,
primary, or arithmetic array eHpression
~~la~
A
Boolean
is e relational o?erator
complex operand is permitted only when the relational operator is
or .NE.
.EQ.
An arithmDtic relational expression is
interpreted as having the
lo~lcaJ
value true if the v~lues of the, operands .satisfy the
relation specified by the operator.
An arithmetic relational
e x p re s s ion i s i n 1; '':~ r pre -c:: d as fl nv i not h e I 0 0 i cal va 1Ul3 f a Is e i f the
valu8s of th:;! oper:lnds do not satisfy the re1atlon specified by
the
operator.
If the two operands are of different types or are both of Boolean
tyPO, the v11ua of the relational expression
is tho
~llu~
of thQ expression
Hhere 0 (zero)
~nJ
Leln~
where:
~l
is of the same type ns th:;;: ';!xpression «(.el)- (,e2».,
is the same relational operator in both expressions.
and
~2
·lrray
t~!22
are character expressions or character
ions
e}:pr,~ss
is a relational operator
A character retational
expression is
interpreted as the logical
value true if the values of the operands satisfy the relation
spacified by the oporator.
A char~ctar relational expression is
CONTROL DATA PRIVATE
6-16
Control Dsta Corporation Standard FORTRAN
83/06/30
6.0
EXPRESSIONS
6~3.5 I~TERPRETATION
OF CHARACTER RELATIONAL EXPRESSIONS
interpreted as the logical value false if the values of the operands
do not satisfy the relation specified by the operator.
The character expression ~1 is considered to be less than ~2·if the
value of al precedes the value of a2 In the col fating sequence; ~1
is greater than ~2 if the value of ,fl fol lows the value of .e2 in the
col
'1:~ting
s(!qu~;!nce
(3.1.5).
Note
that
the
co) latlng
sequence
depends on the col tation weight table used by the processor;
h 0 \<, eve r, the res u Ito f the use 0 f the 0 per s tor s • EQ •
Q n d • NE •
can
d8pnnd
on the collating sef"]uence only if the user-specified
collation weight table is selected, and then only i f the program has
ass 0 cia ted the sam ewe i 9 h t wit h t \-1 0 0 r m0 r e c h a r ·a c t e r s (3. 1 • 5) •
A Ghar~cter relational
expression that is a logical primary of a
JOJical constant expression appearing in a nonexecutable statement
(7.2)
or
a
conditional compilation IF-directive (3.7.2)
is
intorpreted using th~ ASCII col latinJ soquenco (Appendix A). Use of
the
C;;;
col I at ion
con t r 0 I
d t r e c t i ve
( 3. 7 • 3 )
doe s not a f ·f e c t the
interpretation of such expressions.
The "f or m
o~f
a hi! l:.el.atlno.al .e.X!u::..esslan is:
~1
where:
~1
and
r.~!Q2
r..e!Qll .e2
~2
are hit expressions or bit array expressions
is ? relational operator
A bit ri!!lational expr(~sslon Is Interpreted as the log;cal value true
if
the values of the operands satisfy the relation specified by the
oPorqtor. A bit rei at; onGI expression I s interpreted as the logical
value
false
It the values of the operands do not satisfY the
rel~tion
specified by the operator.
A log i C <.1 I .:: ): j') res s 1 () n J s u s e d t 0
e x pre s s
a
log i c a I com put a t ion.
Evaluation of a logical expression produces a result of type
fOJical., \lith a villu~ of true or false.
The slmplc!st form O'P:3 Inglef'!' expression
Is a logical constant,
symholic name of a logical constant, logical variable reference,
10JiCi:tJ iirr~1y ~~'ement reference, fogicnl
af'rilY r{~f€:ronce,
102ic91
arr8y section refarence, logical function reference, or relational
expression. More complicated logical expressions may be formed by
using one or more logical operands t0gether with logical operators
CONTROL DATA PRIVATE
6-17
Control Data Corporation Standard FORTRAN
83/06/30
6.0 EXPRESSIONS
6.4 LOGICAL EXPRESSIONS
-------------------------------------------------------------------and parentheses.
+------------+-----------------~---------------+
Op8rator
:
Representinq
:
+------------+-----------------------------,;,..--.+
• >1 0 T •
:. Log i c a I Ne ga t ion
•
1·
I
a
.A:I0.
.OR.
~
J
lorJical Conjunction
LOJical Inclusive DlsJunction
:
Log i c a I fl 0 n - E qui .v a len c e
.EaV.
• ~1 E
Q".
.XDR.
0
logical Equivalence
r
I
+------------+---------------------------------+
set of r 0 r III ~J t ion r u , e sis use d toe s tab J Ish the tnt c r pre t 2 t Ion 0 f
logical expression that contains two or more logical operators.
There is a precedence among tho logical oporatorsJ Hhich determines
the order in Mhich the operands are to be conblned unless the order
f s c h a fI g e db;' the use 0 f par en the s e s • The pre c e den ceo f the Jog i c a I
operators is as foJ lows:
J\
a
+----------------------+--------------+
Operator
Precedence
+----------------------+--------------+
.NDT.
H ghest
j
.AND •
• OR.
• EQV., .t'lEQV. or
••
• XOR.:
Lowest
+----------------------+--------------+
For 8 ~Ul mp , e J
i
nth,~
A .OR.
a x pre s s ion
B .AND.
C
th~
.AND.
opcr~tor has higher precectancn than the .OR.
operator;
the r €: for e.t the I n t ~ r pre tat Ion {) )": the abo vee x p r ~ s s Ion t s the sam e as
the interpretation of the expression
A • OR.
(B • AllO •
C)
(1) Looicai primary
( 2 ) L 0 J i c .) I
f act 0 r
CONTROL DATA PRIVATE
6-10
Control Data Corporation Standard FORTRAN
83/06/30
.-------------------------------~------------------------------------
&.0 EXPRESSIDNS
6.4.2 FORM AND INTERPRETATION OF LOGICAL EXPRESSIONS.
-------------------------------------------------------------------( 3 ) LOdieaf
term
(4 )
Logical disjunct
( 5)
LOJic::l1
')xpr,~~ssi
on
Tha formation rules to be app'ied In establIshing the InterPretation
of q logical expression are in 6.4.2.1 through 6.4.2.5.
(ll LOJic'al
(2)
constant
Symbolic name of
(4.7.1)
a loglcaJ
constant (8.6)
(3) lOJical variable reference (2.5)
(4)
Lo~ical
array element reference
(5) Logical
array reference
(6)
;~lrrFlY
LO:.JiG~:lJ
(5.4)
secti on fl:lference
(7) loaicJl function reference (16.2)
(8) Relational expression
(9) LOJicni
(n:pr~:!ssion
(6~3)
enclosed in parentheses (6.4.2.5)
( 1 ) Loa i c a I p rima r y
( 2)
• ~H) T •
The forms
of a
( 1) L 0 J i cn I
( 2)
L 0 Die a I
T h'J S,
~)
th,,J .AHD.
IOJical
J 0 2 i C :3
I p rim a r y
l~gl~Bl
f
G ct 0
taLID are:
r
t e r m • AN D.
lo~]ical
factor
I 0 J i caI
te r m i 5 a seq u en ceo 'f I 00 i c a I 'f act 0 r sse per ate d by
o::-arstor" Form (2)
Indicates that in interpreting a
term containinu two or more .AND. operators1 the logical
'fflci::or;:; rife l:)ombintJ-:1 'From Idft to right.
CONTROL DATA PRIVATE
Con t r
0
6-19
IDa t ~J Cor P 0 rat ion S t and 1.1 r d FOR T RA t~
83/06/30
6.0
EXPRESSIONS
6.4.2.4 LO£li
c~1
Thg forms of n
Disjunct.
Inlll~al
dl~luDGt
are:
(1) Logical term
logical disjunct is a sequence of )ogical terms separated by
the .OR.
operator.
Form (2)
indicates
that in interpreting a
IOJical disjunct containIng two or more .OR. operators, the logical
terms are combined from left to right.
Thus, a
Th2 forms
of
a
1921~BlexnLesslDD
are:
( 1 ) LOJical disjunct
( 2)
L0 0 i C~ I
( 3 ) Louical
( 4)
Thus,
LoU i
1
G;:\
I
tJX
pr ess ; on
expression .NEQV.
logical disjunct
expression .XOR.
expression
!oJical
dIsjunct
logical
.EOV.
disjunct
logic.:"
is
a
sequence
separated by either the .EQV., .NEQV., or
.XDR.
( 2 ) J (3 ) j r J n d (4 ) i n die at (! t hat i n i n 't e r p r t~ tin 9
of logical disjuncts
operator.
Forms
t\ I 0 Q i c ~ I e x pre s s ion
t'/IO
or mar e • EQ',!. J
.NEQV • .J or • XOR.
JO£Jical disJ1Jncts are combineo from left to right.
conta j n I OJ
The value of a logical factor lnvolvinD .NOT.
op~r
t:tor 5,
the
is shown below:
+----------+----------+
x Z : .NOT. x2 :
+----------+----------+
: true
false
:
false
true
•
+----------+----------+
Tho v31ue of a logical terrr involving .AND.
is shown below:
)
CONTROL DATA PRIVATE
Control
6-20
CorporatIon Standard FORTRAN
Dat~
83106/30
-------------------------------------------------------------------6.0 2XPR[SSIDNS
6.4.3 VALUE OF LOGICAL FACTORS, TERMS, AND EXPRESSIONS
,·l·----------i·---------+-------------+
xlx2
; x l . AND. y,2 :
+---------+---------+-------------+
true
true
true
true
false
false
~
fals~:
false
true
false
false
false
+-~-------+-~-------+--------~----+
Th3 vnlue of a logical disjunct Involving .OR.
Is shown below:
+---------+---------+----~--------+
xl
x 2 : xl .!JR. x2
+--~------+---------+-------------+
I
true
true
true
false
~
true
false
true
fals3
:
false:
~
!
true
true
false
I
+---------+---------+-------------+
The value of a logical expression invo'ving .EQV.
is shown below:
+---------+---------+-------------+
xl
x 2 : xl .EQV. x2 :
+---------+---------+-------------+
true
true
true
true
fals~
false
true
false
false
ThQ ~alua of
shown below:
3
logical
e~pre$sion
false
false
true
Involvina
.NEQV.
or
.XOR.
Is
+---------+-~-------+-------------+
~1
>e 2
: xl. I'E:; Q V• x 2 :
:
xl
:
x2
: xl .XOR • .x2 :
+---------+---------+-------------+
true
true
f a Is e
t r \J I;)
falst~
true
fa' s ~
false
true
false
f al se
true
+---------+---------+-------------+
A InQl~3! ~Qn~±Bot ~x2£esslgn is a I09ical expression in which each
prim?ry is ;)Jo;]icl1l constant, th? .symbolic name of a logical
. GO 11 S t an t,
;) r e la t jon') I e)( pre s s I on In ,-4 h j c h e a c h p rim a r y i s a
constant expression, or a logical constant expression enclosed in
par,~nth~sost
t,1ot/J
that varIable,
arra~>
olement,
~,nd
function
CONTROL DATA PRIVATE
6-21
Control Data Corporntion Standard FORTRAN
83/06/30
6.0 EXPRESSIONS
6.4.4 LOGICAL CONSTANT EXPRESSION.
references are not allowed.
An 33t~Ddnj IOJic~l
expression except:
constant
expression
Is
logical
a
(1) selected elemental intrinsic functions
referenced with constant arguments,
tare
constant
aI1o~~ed,
lethen
(2) selected array-valued intrinsic functions are allowed.
The I ist of ~1 lowed elemental snd array-valued
1s implementation dependant.
intrinsic
functions
In 6.1.2 and 6.4.2 precedences have been established among the
arithmetic operators and the logical operators, respectively. There
is only ono character operator. No precedence has bean established
~nong the relational operators.
The precedences among the various
operators .are!
+--------------------------+--------------+
l
Prncedcnce
+--------------------------+--------------+
Arithmetic
Highest
Op~retor
~
Character
RJI,ltionot
Bit
LOGical
Lowest
+--------------------------+--------------+
An
expressIon
may
contain
than
more
one kind of operator.
For
examp I e, the 100 i ca' expre ss i on
L • OR.
A + B • Gi:.
C
reA 1 B ~ and Car e 0 f
t y per e a )
and L i s 0 f
t y pel 0 9 i c a I ,
contains an arithmetic operator, a relational
operator,
and a
IOjical operator. This 0xpression ~oulrl be interpreted the same as
t 11:~ .; x:' res s j I) n
:-1 h t:!
L .OR.
(eA + B) .GE.
The order
in
which primaries
determined by the following:
(1)
USd
C)
are
combined
using
operators is
of paranthases
(2) Precedence of the operators
CDnTROL
)
DATA
PRIVATE
6-22.
,Control Data Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------6.0 EXPRESSIDNS
,i.5.1 SUt1HARY OF IHTERPRETATION RULES.
(3) RIJht-to-left Interpretation of exponentiatIons in a factor
(4) Left-to-right interpretation of multiplications and divisions
ina term
(5)
(6)
int(!rpretation of additions e:nd subtractions In
an arithmetic expression
L~ft-to-ri;)ht
Left-to~right
·~xp
interpretation of concatenations in a character
r \~s:s I on
(7) Left-to-right
term"
(B)
1300
interpretation of
lean te rm, or a bit term
conjunctions
Lf)ft-i:o-right interpretation of disjunctions
disjunct, Boolean dIsJunct, or a bIt disjunct
in a logical
in
a
logical
(9) Left-to-right
~xpression,
interpretation of equivalences in a logical
Boolaan expression, or hit expression
This section applies
to arithmetic"
Boolean, and JOJical e:{ pre 55 I ans.
characterJ
relationel,
bit,
Any variable; array, array section,
array element, fUnction, or
character substring referenced as 3n oper,~nd 'in an expression must
be definad Jt the time the reference is ex~cuted. An integer
operand must be defined with an integer value,
rather than a
statement label value. Note that if a character string or substring
is referenced} aJ I of the reforanced characters must be defined at
'th'~ t tma th~ reference is executed.
Any arithmetic operation whose result is not mathcmaticalty defined
is prohibitn1 in the execution of an executable program.
Examples
are dividlnJ by zero and ralslno a zero- valued primary to a
zero-valued or neg~tlve-valued power.
Raising a negative-valued
primary to a real or double precision power is also prohibited.
The execution of 0 function reference In a statement may not ulter
the value of any other entity within the statement in which the
function reference appears. The execution of 8 function reference
in :.1 st'3tem~!nt n1HY not nltBr tho vnll1~ of any entity in common (8.3)
that affclcts the value of any other function reference 1n that
statement. However: execution of a function refeience in the
expression g of a logical IF statement (11.5) is permitted to affect
nntitles in the statement s! that Is executed when the value of the
expression g is true. If a function reference causes definition of
;:\n actual arJ'Jm(;;!nt of th~ functIon, that argument or any
associated
entities must not appear elsewhere
in the same statement. For
examp.le, the statements
CONTROL DATA PRIVATE
6-23
Control Data Corporation Standard FORTRAN
83/06/30
......... --.- ............. _-.. ...- .... ............ --------------------------_._------------------------"''''
6.0 EXPReSSIDNS
6.6 EVAlUATI8N OF
... .............. ... .................
---
--
EX?R~SSIONS
------.....-....... -......... - ..--...
~
A(I)
Y
=
.
-~-~--
- ---.....------... ------ ....--.---_ ...- ..--_._-
.... ....
.
,
FCl)
= G(X}
+ X
ure prohibited If the reference to F defines I or the reference to G
defines x.
of an expression in which 3 function refarence appears
does not affect the evaluation of the actual arguments of the
function.
The data type of an expression in which a function
reference appears is not affected by the evaluation of the actual
~rJuments
or the function, except that the result of e generic
~unctlon r~ference assumes q data type that depends on the data type
of its arguments as specified in 16.10.
Th8 data type
Any execution of In array element reference requires the evaluation
of its subscript~ The data type of
an expression in which a
subscript appears does not affect,
nor is it affected by, the
evaluation of the subscript.
Any execution of a substring reference
requires the evaluation of
substring expressions. The data type of an expression in which
a substrinD name appears does not affect, nor is it affected by, the
evaluation of the substrIng Expressions.
its
Any' executton of an arraY section reference requires the evaluation
of
its
section
subscript
exprt3ssions.
The
data
type
in which an 8rray section appears does not affect,
it affected by, the evaluation of the. array section.
c~pres:.Slon
an
nor is
of
When an arithmetic operator,
character
operator,
relational
operator, or '0910al operator operates on a )alr of operands and at
J east one of the operands is an array operand, the operands must
be
conformable.
The
arithmetic
operation, character operation,
relational
operation,
or
109}01'
operation
is
performed
ule~ent-by-e'emcnt on
corresponding ~rray elements of the operands.
The result of the operation is the same shape as the array operand
or array operands. For 0xemp10, the 3rra] expression
A+B
produces
~n
array the same shape as A and B. The individual array
of the res u 1t h a vet h ~:! V ~ I u e S 0 f the .fir s t e l em e n t
af
A
added
to
the
first e tement o·r B, the second el ement of A added to
the second clement of B, etc.
The processor may perform the
clement-by-element operations in any order i t chooses.
':'~ 1 c~ man t s
~1 hen
::1 r'\
'(1 r J t h met l e o per ~ tor
1) r
8
I n a I c ~ lop era tor 0 per e t e son a
single ~rray operand, the operation is performed element-by-element
and the result is the same shape as the operand.
cor~TROL
)
DATA PRIVATE
6-24
Control Data Corporation Standarrl FORTRAN
83/06/30
6.D EXPRESSIONS
6.6.1 2VALUATIOtl OF OPERANDS.
-------------------------------------------------------------------is not necessary for a processor to evaluate all of the operands
of an expression if the v~lue of the expression can be determined
otnarHise. This principle is most ort~;n applicab.le to
logical
expressions
and
zero-sized
arrays,
but It applies to· all
expressions.
For example, in evaluating the logical expression
It
X .GT.
Y ,OR.
L(Z)
Hh8re X, Y, and Z ::lre reJl and L. Is a logical function, the function
reference L(Z) need not be evaluated i f X is greater than Y.
Similarly in the array expression
x + y(Z}
size Zero and Y is an
array-valued 'function, the
function r~f~rcnc8 Y(Z) need not ba evaluated. If a statement
contains 9 function reference In a p~rt of an expression that need
not be ev~luatedJl all cnti ties that Houl d have become def ined in the
execution of that reference become undefined at the completion of
~vGluation
of thn e~prQsslon containing the function reference.
In
the example above, evaluation of the expression caus~s Z to become
undefined i f L defines its argument.
Hhcre X is of
I f
a
s t a tei:l e n t e o n t n i n.s
m0 r e t han
0 ne
fun c t i on
ref ere n c e,
a
processor may evaluate the functions in
any
order, except for a
I o!J i c a I
IF
s t d t eiii 0 n t a n d ::\
fun c t ion
a r gum ~~ n t
lis t e o n t n i n i n D
\l.'Iuflction r'.1f-(!rences. For eXf:rlf,Jle, th3 statement
Y
~"h\}re
= FCG(X»
F and G vre functions, requires G tobe evalunted before F
is
dvafu3tcd.
In a statement that contains. more than one function reference, the
value provided by each function refer(~nce must 'be independent of the
nrder chos{~n by the processor for
cvaJuutlon .of the function
references.
t h H t.f 0 I I 0 H S tat e c e r t a I n c 0 n d i t ion sun d e r wh i c h a
processor may evaluate an expression different from the one obtained
hy ~pplyinJ the int~rpretation
rules ~iven in 6.1 through 6.5.
However.
any expressIon cont~incd tn parentheses must be 'treated 95
an ~ntity. For example, in evalu~ting the expression A*(B*C),
the
product
of Band C must be eVlluated and then multiplied by A; the
T h'~ sec t ion s
processor
m~st
not
~V3Juutc
the mathemntical Iy
e~uivalcnt
expression
CONTROL DATA PRIVATE
Control
6-25
Corporation Standard FORTRAN
Dat~
f.'3/06/3Q
(,. 0
E X~ RES S I i]N S
6.6.3 INTEGRITY OF PARENTHESES.
expressions may not appear:
Array~valued
(1) As a 10g1ca) expressIon of
:3
IOiJlcal IF statement
(2) As a logical expression of a block IF or ELSE IF statement
(3) As
~1,
~2,
or a3axpressions of a DO statement
(4) As an arithmetic expression in an
(5)
In
compu'Cc{1
J
GO TO,
OPEN}
arithmetic IF statement
CLOSE,
INQUIRE~
or
RETURN
st~21t~m'2.nt
( 6) In the REC= s p e c i fie r
(7) In a
~ubstrinD
0
f
a Qili s.J:
expression
(8) As an external unit identifier
The rules Jlven In 6.1.2 specIfy the interpretation of an arithmetic
expressi on.
Once the interpretation ht1s been estab I i shed
in
3ccordanc8
with those rules, the processor may evalu~te any
qat h r: in a tic a I I j,' e qui v die n t e x pre s s lon, pro v I cI e d that the integrity of
parentheses is not violated.
Two arithmetic expressions ar,a m.athcrnatically equivalent if, for all
0 f t h .~ i r p r I Tn a r J e s and Boo I e an p r i rna r I e s
( 6 • 7. 1. 1 ) ,
.their
mathematical values are equal.
However, mathematically
equivalent
arithmetic
expressions
may
produce
different
p 0 ~:; sib I e" 3 I u ~~ S
(: 0 li1 put a t i 0 n:1 ]
r ns u J t
$ •
Th0 math~~atlca1 deft nit Ion of integer dlvision is given in 6.1.5.
The difference between the value of the expression 5/2 and 5.12.
is
::\
HI 11 t h (! mnt i cal
differ e n c .~ , not H COin P1j t (' .t ion a I d i ff ere nee • If
Boolean operands (6.7.1) are pr~sent in an arithmetic expression,
its
operators may not have the associative and distributive
properties that would yield mClthematica' Iy 6quivalent 'expressions If
31 I operonds Here arithmetic.
For e~amrle, the expressions
2.0 + 0"1" + 0"1" and
2,0 + (1]"1" + r]Hln)
Jr'~
not !lI8thnmatic:llly e'lulvelc!nt.
)
CONTROL DATA PRIVATE
)
6~26
Control Data Corporation Standard FORTRAN
83/06/30
-----------------------~------------------------~-------------------
6.0 EXPRESSIONS
6.6.5 EVALUATION OF ARITHi1ETIC EXPRESSIONS
-------------------------------------------------------------------The fol lowlnu ~re examples of expressIons, along wIth allowable
alternative forms that may be ~sed by the processor in the
evaluation of those expr~ssions. A, B, and C represent arbitrary
rea.),
douole pracislon~ or complex operands; I and J represent
arbitrary integer operands; and XJ y,
and
Z
represent arbitrary
arithmetic operands.
+~-----------------+----------------------------+
Expression
: Allowable A1ternatlve Form 1
+------------------+----------------------------+
X+Y
y+x
X*y
v*x
-X+Y
X+Y+Z
X-Y+Z
X*J/Z
v-X
X+{y+Z)
X-{Y-Z}
X*(B/Z)
X*(y-Z)
A/{B*C)
O.2*A
X*y-X*Z
A/S/C
A/5.0
+------------------+-~--------------------------+
The fal1oHln,D are examples of expressions along with forbidden forms
that must not be used by the processor in the evaluation of those
axpr?sf.; i on.5.
+------------------+----------------------------+
Expression
Non-AlloHable Alternative
~
Form
+------------------+----------------------------+
I/2
0.5*1
X~: II J
I/J/A
(X1.~y)- (X::~Z)
X~'(Y-Z)
X*CI/J)
I
I
I/{J~~A)
I
X*(Y-Z)
I
I
X*y-X*Z
•
+----------------~-+--~-------------------------+
tot: h e p nrc nth H .s e.:S r c qui r fHJ toe s tab lis h the des i r n d
parentheses may b'c included to
restrict
the
alternative forms that may be used by the processor in the actual
evaluation of the expression. This is useful
for controlling the
11Hl :J n f t tJ d .e
an d 5 C GU rae YO'f i n t \;1 r m d i f:\ t;;! v:) I Urj S de v ~ lop e d d uri n 9 the
evaluation or an axrresslon. For examr'e~ In the expression
In
2,
(hI i t ion
Interpr~tat'i)n'
A+(B-C}
~: h:)
t ;~ r III (B - C ) must be eva I u ate d
:1 n d
the n added t () A •
Note that the
inclusion of parentheses may change the mathemat.ical value of an
expression.
For example, the two expressions:
A~'f.I/J
CONTROL DATA PRIVATE
6-27
Control Data Corporation Standard FORTRAN
83/06/30
--------------~-----------------------------------------------------
6.0 EXPRESSIONS
6.6.5 EVALUATION OF ARITHMETIC EXPRESSIONS
l\~qI/J)
may have d I:fjl ere n t rn a t h ~Hn a t I cal va I u e s .i f I and
integer data type.
J
are
factors
or
t: f\ C hop €: ran .~ 0 'f
an
~ r j t hme tic
0 per a tor has a d a tat y pet hat may
depend on the order of evaluation used by the processor.
For
example, in the evaluation of the expression
D+R+I
where 0, RJ
and I represent terms of double precision, real, and
integer data type, respectively, the data type of the operand that
is added to I may be either double precision or raal, depending on
which ~air of operDnds (0 and R, R and I, or 0 and I)
is added
first.
The rules given in 6.2.2 specify the interpretation of a character
expression as a string of characters. A processor needs to evaluate
only as much of the character eKPression as is required by the
context
In uhich
the expression appears.
For
example,
the
statements
CHARACTER*2 Cl,C2,C3,CF
C1
do
v::tl
= C2
II
CFCC3)
not require the function CF to be evaluated, because only the
of C2 i s nn~ded to determ i ne the va fur.: of Cl.
~E~
Tho rulas gi~en in ~.3.3 and 6.3.5 specify tho interpretation of
rcl.ational
expressions~
Once the Interpretation of an expression
has been estnbJ i shed in accornance with those rul es,
the processor
nHl y
e val u a t '::1 any 0 tho r f:nr. pre s s ion t h q t i s r f;! I at ion ~ I 1y e qui val en t •
For example, tilt.:! processor may choose tCJ evalunte the relational
expression
I . GT •
J
where I and J are inteJer varlnbles, as
J -
THO
r~lational
'oJlc~1
v81ucs
I .LT.
0
expressions are relationally equivalent if their
qre equal for all possIble vplucs of their primaries,
CONTROL DATA PRIVATE
6~28
Control Data Corporation Standard FORTRAN
83/06/30
690 EXPRESSIONS
6.6.8 2VALUATIOr·1 OF LOGICAL EXPRESSIC1NS
-------------------------------------------------------------------The rules given in 6.4.2 specify the
interpretation of a logical
~xpression.
Once the interpretation of an expression has been
established in accordance with those rules, the processor may
evaluate any other expression that is logically equiva1ent, provided
that the intnurity·of parenth~ses is not violated. For example, ths
pro c e S s 0 r IlHl y c h 0 os e toe v a Ju ate t h ~ '() 9 i cat e x pre s s I on
Ll .AND.
Hh;~rc
LI, L2., and l3
L1 .AND.
L2 .AND.
8re
l3
logic·)J
(L2 .AND.
variables)'
8S
L3)
Two logical expressions are 10nically equivalent if their values are
n q J i1 I for ; I I po S .s i b I'~ val u e s o f t h \: j r p rim a r i e s •
A fiQu!gaO_eXnLesslDn is formed with locical
operators and Boolean
operands and/or arIthmetic operands
(6.1.2).
Ev~Juation
of a
Boolean expression produces a result of type Boolean.
(1)
Boolean primary
(2 )
Bool~!\:ln
( 3)
Boolean term
(4 )
Boo J ':lan
( 5)
Boolean expression
fuctor
disjunct
The formation rules to be applied in establishing the interpretation
or 8 Boolean oxpr~ssion lre in Sections 6.7.1.1 through 6.7.1.5.
The,fiQn!~aD_ULlmatles
are:
(1)
UnsiJned Boolean constant (4.9.1)
(2)
Symbolic name of a
(3)
Boolean yariable reference (2.5)
Boo'e~n
constant (8.6)
CONTROL DATA PRIVATE
6-29
Control Dnta Corporation Stanrlard FORTRAN
83/06/30
-------------------------------------------------------------------6.0 EXPRESSIJNS
6.7.1.1 Bootenn
Prl~2ry
(4)
Boolnan array element reference
(5)
Boo t
(6)
Boolean array reference
(7)
Boolean array section reference
(8)
Boolean expression enclosed in parentheses (6.7.1.5)
(1)
Boo)ean primary
(2)
.NOT. DooJean
(3)
.NOT. arithmetic expression
(1)
Boolean factor
(2)
Boolean term .AND. Boolean fActor
(3)
Boolean term .AND. arithmetic expression
(4)
Arlthmetic expression .AND. Boolean factor
(5)
t',rithmetic expression .AND. arithmetic expression
Th 'J S a
~.~·)n
Boo I t:!a n
functl on
re"f~r;:!nce
(5.4)
(16. 2)
pri~ary
a 5~! que nee 0 f Boo I i~ a n factors and lor
separated by the .AND .. operator. Forms (2)
Rnd (3) indicate that in interpreting a Boolean term containing two
o r m0 r e • AnD.
0 per. a tor s ,
the Boo 1can f act 0 r san d :a r i t h met i c
TX l') r ~1 S $ jon S ::1 r e c 0 tTl bin 1.=! d fro m 1 eft tor 1 9 ht •
:lrithTiletic
term
is
(~xpressions,
(1)
Boolean term
(2)
Bool33n
(3)
Boolean dIsjunct
(4)
Arithmetic expression .OR. Boolean term
disjunct .OR. Boolean term
~OR.
arithmetic expression
CONTROL DATA PRIVATE
6-30
Control Data Corporation Standard FORTRAN
..................
-....---- .... --...
83/06/30
..--- .... ----.---~------------------------------- ---------------
6.0 EXPRESSIONS
6.7.1.4 Boolean Disjunct
(5)
Arithmetic expression .OR4 arithmetic expression
Thus a Boolean disjunct is a sequence of BooJe~n terms and/or
arithmetic 0xpressions, separated by the .OR. operator. Forms (2)
and (3)' Indicate that in interpreting a Boolean disjunct
containing
two or more .oR. operators,
the Boolean terms and arithmetic
dxprassions 8re combined from left to right.
The
forms of a U2nlesD
~xR[esslQo
are:.
(1) Boolean disjunct
(2)
Boolean expression .EQV. 8001 ean disjunct
( 3 ) Boo I
(!? ne ~t.
? r ;~ s s i
on • EQ V. a r i thin e tic
~ x pre S $
i on
(4) Arithmetic expression .EQV. Boolean disjunct
(5) Arithmetic expression .EOV. arithmetic expression
(6) Boolean expressIon .NEQV. Boolean disjunct
(7) Doolean expression .NEQV. arithmetic expression
(a) Arithmetic expression .NEQV. Boolean disjunct
(9)
ArithmetIc expression .NEQV. arithmetic expression
(lD) Boolean expression .XOR. Bool ean disjunct
(11) Boolean expression .XOR. 1rithmetlc expression
(12)
Arithmetic expression .XDR. Boolean disjunct
(13) Arit~llT'etic
expression .XOR. arithmetic expression
Thus, n Bnole~n expression is
~
sequence of Boolean disjuncts
seprlrated by the .E:QV.J .NEQV.} or .XDR. operators. Forms (2), (3),
(6)J (7), (10), and (11) indicJte that
in
interprutinp
a Boolean
;~~ x pre s s Ion
con t a i n 1 n D
tw 0
0r
m0 r e
• EQV • ,
• :,1 EQV • ,
0 r
• X 0 R•
operators, the Boolean disjuncts and
arithmetic expressions are
combined from left to rioht.
If an operand
is of type integer~ rea1, doub1e precision} half
prJcision, or complex, it is converted to Boolean and the operation
~erform~d
on the converted operand.
Conversion to Boolean is by
means of the ]enerlc function BaOl (16.10).
CONTROL DATA PRIVATE
6-31
Control Data Corporation Standard FORTRAN
.....
-......... ---..- ....
~
83/06/30
-
................ ...... --------~--------------------------------------~---
6.0 EXPRESSIONS
6.7.2 VALUE ;-)F BODLEAN FACTORS, TERNS, AND EXPRESSIONS
---------------~----------------------------------------------------
A Boolean operator determines each hit value of the value i t yields
independently of other bits of the value.
Each hit value Is
da·t,::~rmined from the corresponding
bit
valLles
of
the operand(s).
(THO bit i1ositlons correspond if they have the same ordinal, in their
storage sequence within their respective storage units.)
Ench bit vnluc of a Boolean factor involving .NOT. Is shown below:
+----+--------+
X2
+----+--------+
~
~.NOT.
X2~
{)
I
1
o
+----+--------+
::ach bit value of a Boolean term, involving .AND. is shown below:
+----+----+------------+
: Xl : X2 : X 1 . AND. X 2 :
+----+----+------------+
o
o
o .;
0
1
1
I)
o
1
1
o
1
J
•
••
1
I
•
I
•
+----+----+------------+
Each bit value of a
Boolean
expression
involving
.OR. is
shown
b<~~loH
+----+----+------------+
: Xl : X2 :X1 .OR. X2
+----+----+------------+
o
o
a
o
1
1
1
I
1
o
1
1
+----+----+-----------~+
Each
bit
value
o~
a
Boolean expression involving .EQV. Is shown
helt)!~:
CONTROL DATA PRIVATE
6-32
Control Data Corporation Standard FORTRAN
83/06/30
_
............. ..-- .............. ......... _-- ........ -----------------------------------------.-----------
6.0 EXPR~SSIONS
6.7.2 VALUE OF BJOL2AN FACTORS, TERMS, AND EXPRESSIONS
-------------------------------------------------------------------+----+----+------------+
: Xl : X2
.EQV. X2 :
+----+----+------------+
~Xl
o
o
1
1
o
1
o
1
o
o
.
.
+----+----+------------+
1
1
I
'
"
~ach
bit value of· a Boolean expresslon Involving
Iss h 0 yl n bel 0 \-1 :
.NEQV. (or
.XOR.)
+----+----+------------+
; Xl : X2 :XI .NEQV. X2:
+----+----+-----------.+
()
o
o
1
1
1
1
1
1
o
o
o
+----+----+------------+
A fiQal~an ~QDstaDt eXllLeSsl~D is a Boolann eXpression in which each
B() () J Ban p r i fll La r y i s a [3 0 Die a nco n s t e. nt, the S y mb 0 I len am e 0 f a
Boolean constant, or a Boolean constant expression enclosed in
parentheses! and each arithmetic pr1mery is en arithmetic constant,
thJ symhotic n~me of an 3rlthmettc constant, or an arlthmatlc
constant expression enclosed 1n parentheses.
An Bx1g0dg~ Boolean
expression oxc~rt:
(I) selected
referenced
constent.
elemental
~ith
expr~ssion
is
intrinsic
const~nt
a
fun c t ion s
arguments,
Boolean
constant
are a I lowed.1
\01 hen
(2) selected array-valued IntrInsic functions are allowed.
The I ist of allowed elemental
and array-v3tued
intrinsic
functions
is implementation dependant.
nQo~±ant ~~D£~salno is an arithmetic constant expression (6.1.3),
character constant expression (6.2~3), a bit constant expression
(6.9.3),
a logical constant expressi on (6.'t.4), a Boolean constant
cxprassion (6.7.3)~ or ~ hit const~nt 0xrression (6.9.3).
A
~
CONTROL DATA PRIVATE
6-33
Control Data Corporation Standard FORTRAN
83106130
--------~--------------------~--------------------------------------
6.0
EXPRESSIONS
6.8 CONSTANT EXPRESSIONS
.... .....
......---~~.-. ............... .... ...... ..... ---~----- ....
---.. -- ,--An
-- -
~xl~adnd
-.-.-----.-....--...---.... ----------------- ... -.,--
constant expression is a constant expression except:
(1) selected elemental intrinsic
functions
r l:! f (! r .;~~ nee d !'J i the 0 n s tan ~:a r [I U men t S J
are
allowed,
when
(2) selected array-valued intrinsic functions are allowed.
The lis t of a I 10 H e del e me n t a1 an r l 3 r r f\ Y - v a.l u e din t r ins i c fun c t ion s
is implem€:ntation depandant.
In order to eliminate circularity of
definition" no variable or
array name may be roferenced in an extended constant expression
unless that variable or array has been defined in preceding
specification statement(s). For expRmple,
REAL A( SIZE(S»
REAL Be SIZE(A»
1s
prohibited because
B
Has referenced prior to its definition.
A bit exprsssion 1s used to express a bit computation. Evaluation
of a bit expression produces a result of type bit, with a value of
B"l" or BHott.
The simpiest form of a bit expression is a bit constant, symbolic
name of a bit constant, bit variable reference, bit array element
referance, bit. BffJy reference, hit array section reference, or bit
function f9farance. More compl icated bit axpresslons may be formed
by
using
one or more bit operands tooether with bit operators and
parentheses.
+------------+-----------------------------+
Operator
Representing
+------------+------------------~----------+
.BNOT.
.3AND.
.BOR.
Bit Negntion
Bit Conjunction
Bit Inclusive Disjunction
B I· ...l. Equivalence
Bit Non-Equivalence
• 13E0V.
.nNE0V. or
:
.BXOR.
:
+------------+-----------------------------+
CONTROL DATA PRIVATE
6-34
Control Data Corporation Standard FORTRAN
83/06/30
--------~-----------------------------------------------------------
6.0
EXPRESSIONS
().9.2 FORH Ai\lD
INTE~PRETATION
OF BIT EXPRESSIONS.
-------------------------------------------------------------------A set of formation rules is used to establish the interpretation
a bit expression that contains two or more hit operators. There
.] precedence among the bit operators, Hhlch determines the order
which the operands are to be combined ~nlcss the order is changed
the use of parentheses. The precedence of the bit operators is
t" 0 J I 0 :'1 S :
of
is
in
by
as
.+._-----------------------+------------_.+
Operator
Precedence
+------------------------+--------------+
.BNOT.
: Highest
•
• BAND.
I
•,
.BOR.
;.BEQV.,.flNEQV. or .BXOR.:
1
+------------------------+--------------+
For example,
in the expression
A .BOR.
the .BAND.
B .BAND.
C
operator has higher precedence than the .BOR. operator;
of the above expres~ion is the same as
therefore~ th~ interpretation
th~ Interrr~tation
of the expression
(D .nAND.
A .BOR.
C)
(1) Bit primary
flctor
(2)
Bit
(3)
Bit terp;
(4) Bit disjunct
(5) Bit
~xpression
The formation ru1es to be applied in establishing the interpretation
of a bit expression are in 6.9.2.1 through 6.Q.2.5.
The
hil
QLIW3Ll~s
•
,•
•
1
lOHest
are:
(I) B1t constant (4.11.11
(2) Symbolic name ofa bit constant (8.6)
CONTROL DATA PRIVATE
6-35
Control Data Corporation Standard FORTRAN
83106/30
- - .... +. . . . . . _ - - . . - _ - - - - - ....................... - - - - - - - - - - - - - - - - - - - - - - - - - - _ . _ - - - - - - - - - - - - - - - - - - - - - - -
6.0 EXPRESSIONS
6. Q .2.1 Bit Primaries.
(3) Bit variable reference C2.5)
( 4)
Bit array element reference
( 5)
Bit ar r ay re;eerance
( 6)
Bit array section reference
( 7)
Bit "function r a·r.ar ence (16.2)
(5.4)
(8) Bit expression enclosed i'n parentheses (6.9.2.5)
The forms
or
a
bIt
lButQL are:
(1) Bit primary
(2)
Th~
forms
(l)
bit primary
.BNoT.
or
0
bit
±~£W
are:
Bit factor
(2) Bit term .BAND.
bit factor
Thus, a bit term is a sequence Of bit factors separated by the
.BAND.
operator.
Form (2)
indicates that in interpreting a bit
term containin~ two or more .BAND·. operators, the bit factors are
combined from left to rlaht.
Tho forms or
8
~lt
jlsluDC± are:
(1) Bit term
(2) Bit disjunot .BOR.
bit term
a h it dis J \.I n c t i s a seq u e nee 0 fbi t t e r msse par ate d by the
operator. Form (2) indicates that in interpreting a bit
disjunct
containing tHo or more .BDR.
oparators, the bit terms are
combined from left to riJht.
Th lJ S ,
.BOR.
The forms of u hit
(1)
Bit
~~u~~s~laD
are:
disjunct
CONTROL DATA PRIVATE
6-36
Control Data Corporation Standard FORTRAN
83/06/30
... - ....... ....- ... - .... .-. ................. --------------------------------_ ... _-_.------------.--'-
6.0 EXPRESSIONS
6.9.2.5 Bit Expression.
(2) Bit expression .BEQV.
(3) Bit expression .BNEQV.
(4) Bit expression •. BXOR.
bit disjunct
bit disjunct
.•
bit disjunct
,
Thus, a bit expression is a sequence of hit disjuncts separated by
ther the .BEQV." .BNEQV., or .BXOR.
operator.
Forms (2).1 (3),
nnd (4) indIcate that In interpreting a bit expression containing
two or more .REQV., .BNEQV.,or .BXOR.
operators, the bit disjuncts
are combined from loft to riGht.
':.~i
Th~;!
Is shown
value ofa bit Factor inVolving .aNOT.
below~
+--~-------+-----------+
.x2
! .BNOT. x2 :
+----------+-----------+
SH1"
B"O"
B"O'"
B"l"
+----------+-----------+
The value of a bit term involving .BAND.
is shown below:
+---------+-----~---+-------------+
y2
xl
: xl .BAtiD. x2:
+---------+---------+-------------+
B"l"
G 1"
B "I"
n
B" 1H
B"0"
B1'0"
B"O"
B"l"
BUO"
Otto"
B"O"
B"O"
~---------+---------+-------------+
Tho value of a bit disjunct involving .BOR.
Is shown below:
+---------+---------+-------------+
xl
x 2 : xl .BOR. y,2 :
+---------+---------+-------~-----+
BUl"
B"1"
B"l"
G"l"
B"O"
B"llt
13"0"
(3"1"
B"l"
(3" 0"
B11 0"
B"0"
+---------+~--------+-------------+
The value of a bit
~xpression
involvina .BEOV.
i.s s h 0 ~"I n below:
CllHTROL DATA PRIVATE
6-37
Control Data Corporation Standard FORTRAN
83/06/30
---~---------------------------~------------------------------------
6.0 EXPRESSIONS
6.9.3 VALUE OF BIT FACTORS, TERHS, AND EXPRESSIONS
+---------+---------+-------------+
xl
x 2 : xl • BEQV. x2:
.~---------+---------+-------------+
B"I"
Bn 1"
B"1"
[lul"
B"O"
B"O"
0"0"
:
B"llt
B"O"
B"O"
:
B"O"
•
a n 1"
:
+---------+---~-----+-------------+
The value of a hit expression involving .BNEQV.
below:
or .BXDR.
is shown
+---------+---------+-------------+
xl
x2
:xl .BNEQV. x2:
xl
x2:
xl • BXOR. x2:
+---------+---------+-------------+
BUI"
B nO"
B"l"
B"ln
B"on
BI1 O"
B "0"
anI"
B1'1 "
B"1"
B"O"
B"O"
+---------+---------+-------------+
A hl~ Gnnst3nt e~~~2SS1nD Is a bit expression in which each primary
is a hit constant, the symbolic name of a bit constant, or a bit
constant ~xprcssion enclosed in parentheses. Note that variable,
arr:1Y element~ '~nd function reFerences are not alloNed.
An
nxt~Dd~d
bit constant
~xpr~ssion
is
a
hit
constant
expression
(~XC~~pt:
(1) selected
r~fnrenced
(2)
sel~cted
eJemental intrinsic functions
with constant arguments,
are allowed, when
array-valued IntrInsic functions are
The I ist of at IOHed elemental and arrQY-Yf.l1ued
is implementation d~pendant.
allo~ed.
intrinsic
functions.
CONTROL DATA PRIVATE
7-1
Control Data Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------7 • 0 STAT E En T CLA S S I FIe" TID N
i\l
---------------------------------~----------------------------------
7.0
STATEMENT CLASSIFICATION
classified as executabte or
nonexecutable.
specify actions and form an execution sequence
in
an
eXflcu"'l;ah I e
program.
.Nonexecutab 1 e
statem(~nts
spec j fy
characterlstics~
arrangement,
and initial values of data; contain
0dltino lnformation1 specify statement functions;
classify program
u nit s ,;
and
.s p (;: c i f.Y en try pol n t s "" i 'i: h ins u b pro 9 rom s •
Non e )( e cut a b I e
statements are not part of the
ex~cution
sequence.
Nonexecutable
statements may be labeled, but such statement Jabe1s must not be
used to control the execution sequ~nce.
':;~ch
statement
Executable
The
is
statem~nts
folloHing statements are classified as executab1e:
(1)
ArithSl18tlc, IODic81, statement label
and character ~ssignment statements
(2) Unconditional
GO
TO,
assigned
GO
(ASSIGN), bit,
TO,
Boolean,
and computed GO TO
statumf:nts
IF statements
(3) Arithmetic IF and logical
( 4) B 1 0 c J< IF, EL S ElF,
ELS E,
and END I F s tat erne n t s
(5) conTltHJE statement
(6) STOP
(7) DO
(8)
(9)
and PAUSE statements
statement
WRITE, PRINT, PUNCH, ENCODE,
BUFF2R OUT statements
READ~
RE~IIND
...
DECODE,
OPEN,
BACKSPACE,
statements
BUFFER
CLOSE,
and
IN,
and
INQUIRE
(10) CALL and RETURN statements
(11) ALLOCATE and FREE statements
(12)
WHERE,
statements
LOJicE.d
Block
~JHE
RE,
OTHERWISE,
and
ENDWHERE
(13) IDENTIFY statement
(14) FORALL
(15) END
statenent
st~tement
CONTROL DATA PRIVATE
)
7-2
Control Data Corporatlon Standard FORTRAN
83/06/30
-.-~~~~--~~-~~~~-------------------------------------- ---------------
7.0
STATEMENT CLASSIFICATION
7.2 NONEXECUTABLE STATEMENTS
-------------------------------------------------------------------The folloHinJ statements are classified as nonexecutable:
(1)
PROGRA~',
statements
FUNCTION,
SUBROUTINE,
ENTRY,
(2) Dli,tEf,lS ION,
and
CONHON,
E QUI VAL EI~ CCJ
I HPl Ie I T, .
EXTERNAL, INTRInSIC, and SAVE statements
BLOCK
DATA
PARAMETER,
(3) INTEGER, REAL, DOUBLE PRECISIOM, COMPLEX, LOGICAL, BIT,
PR2CI SI01'.1.. BDOLEAtt, and CHARACTER type-statements
HALF
(4) DATA statement
(5) FORMAT statement
(6) statement function statement
(7)
NAMELIST statement
(8) ROWWISE statoment
(9) INTERFACE end END INTERFACE statements
CONTROL DATA PRIVATE
)
8-1
Control Data Corporation Standard FORTRAN
83/06/30
---------------~~-~~~~---~~~~~-~----~-------~--------~~-------~-----
1.0
.... ,... ......
SPECIFICATION STATEMENTS
--- ....--- ... -- .......................... -...---..-,-... -...-....--...- .... ........-.............. -----------------.---------~
n.o
SPECIFICATION STATEMENTS
Thore are twelve kinds of speclficRtion statements:
(1)
OIi'1ENSION
(4) INTEGER, REAL, DOUBLE PRECISION, HALF PRECISION, COMPLEX,
LOGICAL, BIT, BOOLEAN, and CHARACTER type-statements
(5) IHPLICIT
( 6)
PAR Ai-I J.:: T ER
(7)
EXTERNAL
( 8 ) INTRINSIC
(9) ,
SAVE
( 10) ROH\41 SE
(11) Procedure interface
( 12)
information} INTERFACE and END INTERFACE
VIRTUAL
AI I specification statements are nonexecutable.
A DIMENSION
dimension
statement
specif~cations
Th;:;: form ofa
Is
used
to specify the symbolic names and
of arrays.
DIHEI1SIOn statemc1nt is:
Each symbolic name a appearing in a DIMENSION statement declar~s ~
to b e ~\ n a r raY i n th at pro a ram u nf t • r~ 0 t e t hat a r r .:l y dec I a rat 0 r s
ril~~' also appear in COf1r10N statements, and type-statements.
Only one
appearance of a symbolic name as an array name in an array
',1 e C ! a r ') tor i n J pro 0 r a ill un i t i ~ P P. r mf t ted.
CONTROL DATA PRIVATE
8-2
Control Data Corporation Standard FORTRAN
83/06/30
--------~--------~----------------------------~---------------------
a.o
SPECIFICATION STATEMENTS
8.2 EQUIVALENCE STATEMENT
---------~----------------------------------------------------------
An EQUIVALENCE statement is used to specify the sharing of storage
units by tNO or more entIties In a proarcHil unit. This c·auses
association of the entitles that share the storage units.
If the equivalenced
different data types, the
type conversion or Imply
mathematical
equivalence.
If a variable and
an
array
are
nquivalenced,
the variable does not have array properties and the
array does not have th) properties of" a variable.
2QUIVALENCE
entities
statement
does
are
not
of
cause
The form of an EQUIVALENCE statement is:
EQUIVALENCE (nllst) [,(0111t)] •••
where each 01151 is a 1 ist (2.11) of variable names,
arr6y element
names, array names, and character substring names. Each list must
contain at least two names. Names of dummy arguments of an external
procedure in a subprogram and allocatable arrays must not appear in
the list. If a variable name or arrny name is also a function name
(1&.5.1), that name must not appear in the I i.st.
Each subscript eXpression or substring expression in a list
must be an o~tended integer constant expression.
olist
stat~::!mnnt specifi es that the storage sequences of the
"'hose
names appear
ina I is t nll.s1 share the same fi rst
stor~Je unit.
This causes the nssociation of the
entities 1n the
list nll~± and may cause assoclatlon of' other entitles (18.1) ..
An
EQUIVALE1~CE
i:!nt I ties
An entity of any type may be equivalenced with entities of other
types. The lengths of the equivalenced entities ara not required to
be the samo,
However, alignments, as specified by the user, must
conform with the al~gnments as shown In the fol lowing table, Table
6:
CONTROL DATA PRIVATE
8-3
Control Data Corporation Standard FORTRAN
_-SPECIFICATION
.... -----..- - ------_._----------------------- -------------------STATEMENTS
83/06/30
......................
......... .....
....
0.0
8.2.3 EOUIVALENCE OF EnTITIES OF DIFFERENT TYPES
-------------------------------------------------------------------Iahl~_b
1
•
••
ALIGNMENT REQUIREMENTS FOR
EQUIVAlENCE(Xl,X2)
+---------------+---------------+-------~-~-+----------+----------+
x2
Integer, Real,:
:
Double
precision,
Half
p r ec is i on
Character~
Bit
Camp 1 ex,
Logical,
Boolean
+---------------+--~------------+-----------+----------+----------+
xl
Integer, Real,
NUmeric
Doubl~
Numeric
Numeric
Numeric
~recisinn .."
Complex,
,
••
Log iog.l,
Boo 1'Ban
1
+---------------+---------------+-----------+----------+----------+
Hal f: Half: HalfI H:llf procisionl
Numeric
numeric: numeric: numeric
+---------------+---------------+-----------+----------+--------~-+
:
I Character
Numeric
Halfnumeric
: Character: Character:
: Bit
Numeric
numeric
: Charpcter: Bit
+---------------+--------------.+----------+----------+---------+
:
Ha I f:
:
:
+---------------+---------------+-----------+----------+----------+
An EQUIVALENCE statement specifies that the storage sequences of the
character entities whose names appeQr in a list ollst share the same
first character storage unit.
This causes the association of the
entities in the list oll~t and may cause association of other
entities (18.1). Any adjacent characters In the associated entities
may also have the same character storage unit and thus may also be
associated. In the example:
CHARACTER
A';~4.J
B*4, C(2)*3
EQUIVALENCE (A,C(l»J (B,C(2)
the association of AJ B, and C can be graphically
iJ
lustrated as:
;-----A-----:
~-----B-----:
:--C(1)--:--C(2)--:
. CONTROL DATA PRIVATE
8-4
Control Data Corporation Standard FORTRAN
83/06130
-------------------------------------------------------------------0.0 SPECIFICATION STATEMENTS
8.2.4 ARRAY NAMES AND ARRAY ELEMENT NAMES.
-------------------~-----------~--------------------~---------------
If '3n arraY -clell1ent name appears In an
EQUIVALENCE statement, the
number of subscriPt expressions must be the same as the number of
rl i OFJ n s ion s s pc c i fie din the a r r ;] y dec I ~r a tor 'f 0 r the ar ray n am e •
The use or an qrray name unqualJ fled by a subscript in an
EQUIVALENCE statement has the same effect.as using an array element
name that id'~ntifias the first r11ement of the array.
An EQUIVALENCE statement must not contain virtual
(IDENTIFY)
automatic array names, or allocatable array names.
array
n~mes)
Alignments,
as specified by
at ionments as shown In Tab1e 6.
the
usar,
must
conform
with
the
An EQUIVALENCE statement must not specify that the same storage unit
is to occur marc than once in a storage sequence. For example,
DIflEnSIon A(2)
c QUI VALE 1'1 CE ( A( 1 ) , n} ,
( A( 2) , B}
is prohibited, because It would specify the same storage unit for
A(l) and A(2). An EQUIVALENCE statement must not specifY that
consecutive storage units are to be nonconsecutive. For example,
the folloHing is prohibited:
REAL A (2)
DOUBLE PRECISION 0(2)
EQUIVALENCE (A(l),O(ll), (A(2),D(2»
The COM i'1 0 N s t it t em e n t pro v J d es a mea n s
0 f
ass 0 cia tin 9 en tit i e s i n
rlifferent program units.
This allows different program units to
derine and reference the seme data without using -argUm;90ts-,
snd to
share stor~ae units.
For COMMON the campi 1er will allocate storage in. conformance with
requirements as specified In the foJlo~ing tahle~ Table 7:
CONTROL DATA PRIVATE
8-5
Control Dnta Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------B.O SPECIFICATION STATEMENTS
8 • 3 C0 r-1 i1 0 N S TAT EMF. NT
----------------------~---------------------~--------~-- ------------
Iab.!.e_Z
ALIGNMENT REQUIREMENTS
FOR COMHON
+ .... ---...... - ..... ---.....- ....... -+-....... --~ ....... --.......... -+
TYPE
BOUNDARY
InteJer
.
R'aa J
.
1
Numeric
Dble precision
Complex
Logical
Boolean
+-~~--~-----~----+--~-~~--~--~-+
:11 a I f pre cis ion : Ha If- n urn erie:
+----------------+-------------+
: Character
: Character
+-~-~~-~------~--+-~--~--~~--~-+
: Bit
: nit
:
+----------------+-------------+
Th~
form of a COMMON statement is:
COMMON
Hhare: ab
[/[~b]/]
ollst
[[,]/[~~]I
nll~!J
•••
is a common block name (19.2.1)
olls.! is a list (2.11) of variable.names, array names, and
1rray dncJarators.
Only one appearance of 2 symbolic
name as a varlabJe name, array name, or array declarator
is permi tted in all such I ists within a program unit.
names of dummy arguments of nn ei~t9rnal procedure in a
subprogram must not
appear In the J 1st.
If 'a variable
name is also a function name (16.5.1), that name must not
appear in the list.
Each omitt~d ~b specifies the blank common block.
is omitted, the first two slashes are optional.
In each CDNHI1H st atem~nt.... the !:!n tit i os
"ihose
names
If the first
app ear
in
~~
an
nllst foJ lowina a block name cb are declared to be in common block
gb. If the first nb is omitted, all entities whose nameS apPear in
the flrst.n!l~t are specified to be In blank common. AlternativelY,
the appearance of two slashes with no block name between them
decl~re5
the sntities HhoS9 names appear in the list o!lst that
folloNs to be in blank common.
CONTROL DATA PRIVATE
\
8-6
Control Data Corporation Standard FORTRAN
83/06/30
....-- ........ _... _-------- ............... ---------------------_ ... _-_._------------------------8.0 SPECIFICATION STATEMENTS
n• 3. 1 FOR )" i] F A C0 IHl 0 N STAT E", ENT.
---------------------------------------~----------------------------
Any common block name £~ or an omitted ~~ for blank common may occur
mora than once in one or more COMMON statements in a program unit.
The list Dlls~ following each successive appearance of the same
common block name is treated as a continuation of the list for that
common block name.
For each common block, a
n~mmno
hlQ~~ stgtaD~
s~nu~u~~
is formed
as
fo 1 lows:
(1) A
consisting of the storage
segu~nces of all entitles In the t Jsts n!lst for
the common
block.
The order of the storage sequence is the same as the
orrler of the appearance of the lists nllst in the program
unit.
storage
sequence
is
formed
(2) The storage .sequence formed
in (1) is extended to include all
sequence associated with It by
equivalence association.
The sequence may be extended only
by
adding stor~ge units beyond the last storage unit.
Entities associated ~ith an entity in a common block are
considered to be in thgt common block.
storsJc units of any
Th~
~lza
at
stor~ge
black is the size of its common
~ ~ammQD
sequence,
including any
equivalence association.
block
storage
extensions of the sequence resulting from
1,~ithin an executable pro:)ram, aI' named common blocJ:'3cution of
a 109ical IF statement causes evaluation, of the
expression c.
If the value of ~ is true, statement ~t is executed.
If the valu~ of ~ is false, statement st Is not executed and the
execution sequence continues as though a CONTINUE statement were
ql:oGut~!d.
)
Note that the execution of a function reference in the expression ~
of a logical
IF statement is permlttod to affect entities in the
st.atement st.
)
CONTROL DATA PRIVATE
Contro1 Data Corporation Standard FORTRAN
11-4
83/06/30
11.0 CONTRoL STATEMENTS
11.6 DLOCK IF STATEMENT
The block IF statement is used with the END IF statement and,
optionally, the ELSE IF and ELSE statements to cnntrol the execution
sequence.
The form of a block IF statement is:
IF
(~l
THf:N
rlhere g is a scalar logical expression.
11.6.1
The
lE=Lr:~;.;,l...
lE=lfry..el of
a' s ta temen t
.s.
i.s
01 -02
where 01 is the number of block IF statements from the beginning of
J;"h~
progr am un i t up to and inc I tid in D ;5, and 02 is th e number of
END IF statements in the program unit up to but not Including ~.
Tht:: IF-li!v~J of evary statement .must be zero or positive.
The
IF·-Ievel O.f eAch bJock IF, ELSE IF, ELSE, and END IF statement must
be positive. The IF-level of the END statement of each program unit
must be zero.
t\n lE=hl!L.G1s consists of all of the executable statements that appear
rolloHing ttV! block IF st~tem~nt up to, but not including, the
next
ELSE IF., ELSE, or END IF statenent that has the same IF-I evel as the
block IF statement. An IF-bloCk may be empty.
Execution of a block IF statement causes evaluation
of
the
ex pre s s ion ~ • I f the val u (-: 0 f f 1st r U D J n.o r m!l I e.x e C lJ t ion seq u e n c e
continues with the first statement of the IF-block.
If the value of
~
is true and the IF-block is empty, control is transferred to the
n Po x t Et\1 D I F s t e: t e men t t hat has t h 1.2 5 :3:n e I F- I e v eJ
as
the
b I 0 c kIF
statement.
If the value of ~ is false, control is transferred to
the n··:nct ELSE IF, ELSE, or EnD IF statement th~t has the same
IF-Ieve~ ~s the block IF statement.
T ran s fer
0
f
con t r 0
,
j
nt
0
a n I F- b 1 0 c k fro III out sid e the I F- b lac 1< i s
prohibited.
If thl~ execution of the lB.st statement
In the IF-block does not
result in a transfer of control,. control is transferred to the next
END IF statement thnt has the snmo IF-level 9S the block IF
CONTROL DATA PRIVATE
Control Dnta Corporation
stAn~ard
11-5
FORTRAN
83/06/30
------------------------------------------------------------------11.0 CONTROL
STAT~MENTS
11.6.3 EXEC1..JTIOH OF A BLOCK IF STATEi'1ENT.
--------------------------------------------------------------~~~-~-
statement that precedes the IF-block.
The form of an ELSE IF statement is:
E l S E I F C£) T;-1 E N
Hhere
£:.
ELSE
An
is a
scalar IODical expression.
consists of all of the executable statements that
the ELSE IF st:.ltement up to, but not including, the
next ELSE IF~ ELSE, or END IF statement that has the same IF-level
as the ELSE IF statement. An ELSE IF--block may be empty.
Jpp1Hlf
IE=hlQ~k
-follouina
Execution
of
an ELSE IF statement causes evaluation of the
expression ~t If the value of ~ is true, normal execution sequence
continues with the first statement of the ELSE IF-block. If the
value of B is true and the ELSE IF-block is empty, control
is
transferred to th~ next END IF statement that has the same IF-level
qS the ELSE IF statement.
If the value of ~ is false,
control
is
transferred to the next ELSE IF, ELSE, or END IF statement that has
th~ S'3me If-lf~v~~1 JS the ELSE IF st;:~tement.
Transfer of control into an ELSE IF-block from outside the ELSE
I F- b 1 0 c k i s pro h i bit e d •
The s t ;:1 t e men t I a b a I, if ~: ny, 0 f the E l S ElF
s tate In e n t mu s t not b ere fer e nc e d by any s tat e fT1 e n t •
If execution of the last statement in the ELSE IF-block does not
result
in a transfer of control, control is transferred to the next
END IF st8te8ent that has the same IF-level as the ELSE IF statement
that precedes the ELSE IF-block.
Th9
form of an ELSE statement is:
ELSE
An
EL~E_hlo~~
~ppear
neKt
st
dt
[NO IF
.r: in ~~ n t •
~\n:'-;ND
conslsts of al I of the executable statements that
the ElSe statement up to, but not including, the
~tatement
that has the same IF-level as the ELSE
folloHin!]
An EL SE- b I 0 C 1\ may b Po em p t y •
IF statement of the same IF-J ev cl
as the ELSE statement
must
CONTROL DATA PRIVATE
11-6
Control Data Corporation Standard FORTRAN
83/06/30
__ ... r.- ... _ ........... __ .... __ .. ~ .......... _ ..... - _ _ _ _ _ _ _ _ _ _ ·_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
11.0 CONTROL STATEMENTS
11.A.l ELSE-BLOCK.
appear before the appearance of an ELSE IF or ELSE statement of
same IF-level.
the
Execution of an ELSZ statement has no effect.
Trunsfur of control into an ELSE-block from outside the ELSE-block
is prohlbit8d. The statement label, if any, of an ELSE statement
must not be referenced by any statement.
The
form
of ;'In END IF statement is:
EqD IF
Execution of
For
each
Gn
END IF
block IF
statem~nt
has no effect.
there must be a corresponding END IF
Program unit.
A ~Q£Lg~e~DdiDn
ftlD IE
s±~±~m~ot is the next END IF statement that has the same IF-level as
the b locl< IF statement.
statement
in
the
st~ternent,
same
A DO statement is used to specify a loop, called a DD=!QQB.
T h ~:: for m
0
faD 0 s t
II t
em en t i s !
i ,s t he ..5·c nt I) m~ n t I n hoi 0 fa n e}~ 13 cut a b I c s t ute men t •
The
statement identified by S, calted the i~£mlnal ~la1~ment
of th~ DO-loop, must follow the DO statement in the
of statem';!nts
the DO statement.
s,,~quenc'~1
i
~/lth
'
in the same program unit as
i:s the n \j In e 0 'f ani n t (:,l 9 nr ,
r ,1 aI, hal r pre cis ion,
d)ub I,~ pr ec is i on var I ab Ie, en I I ad the Il!J_~.ar:.1E.h!.e
0
r
gl ... g2J
and fl3 are each an integer, real, half precision,
doubla precisIon, or Boolesn scolar expression
The terminal statement of a DO-loop must not be an unconditional
~n TJ,
~ssiJned
Gl TJ, arithmetic IF, block WHERE, OTHERWISE,
END ~H'H: REJ I 0 J j c a J ~1 H[ REJ b I 0 c i~ IF, El SElF, ELSE,
END IF, RET URN,
STOP, END, or DO statement. If the termlnal statement of a DO-loop
is ::l logical IF statement, it may contain any executable statement
~XC8Pt
a DO, block IF, ELSE IF, ELSE, END IF, END, or another
IOJical IF scatement.
CONTROL DATA PRIVATE
·11-7
Oata Corporation Standard FORTRAN
Control
83/06/30
---------------------~------------------------------~---------------
11.0 CONTROL STATEMENTS
11.10.1 RANGE OF A DO-LOOP.
The [~Qng Qf
that appaar
a UD=lnnn consists of all of the executable
fol
lo~inu
statements
the DO statement that specifics the DO-loop,
to and .includin'J tha terminal statement o·f the DO-loop.
If a DO statement appe~rs within the range of a DO-loop,
the range
of the OQ-Ioop specified by that DO statement must be contained
entirely within the range of the outgr DO-loop.
More than one
DO-loop may have the same terminal statement.
If a DO statement appears within ~n IF-block, ELSE IF-block, or
ELSE-block, the ranae of that DO-foop must be contained entirely
within that IF-block, ELSE IF-block, or ELSE-block, respectively.
block IF statement appears within the rence of 0 DO-loop, the
END IF statement must also appear within the range of
that DO-loop.
If
a
corraspondin~
A DO-loop is either active or tnactive. Initially inactive, a
DO-loop becomes active only when lts DO statement is executed.
!lnee nctiVi!, the On-loop becomes inactive only ,·,hf:n:
(1)
Its iteration count is tested (ll.lO.4) and determined to
z er OJ
(2)
its DQ-Yeri1bJo becomes undefined or Is redefined by means
other than the lncrementation descrlbed in 11.10.7,
(3)
i t is
(4)
?\
be
in the range of another Dn-Ioop that becomes inactive,
R::TURN."
STOP .• or
END st~te!iient
is executEd
In
its
program
unit) or
(5) i t
is
in the range of another DO-loop
WhOS,~1
DtJ-stC1tement is
~xnc~Jt:(~d.
Execution of a function reference or CALL statement that appears in
the
range of a DO-loop does not oause the DO-loop to become
inactive. Notcthat transfer of control out of the range of a
DO-toop does not .inactivate the DO-loop.
However, the DO-Joop
becomes
inactive if the DO-variabl e becomes undefined or
is
rQdofinad outside the rnnge.
Wh~n
8
DO-loop beco~es
Inactive, the DO-variable of the DO-loop
ret a ins its I a s t d e r i ned v:a I u e J u n I e s s i t has bee 0 me u n d e fin e d •
CO~tTROL
)
DATA
PRIVATE.
11-8
Control Data Corporation Standard FORTRAN
83/06/30
11.0
CONTROL STAT2ilENTS
.11.10.3 EXECUTlf\lG A 00 STATENEtlT.
The affect of executing a DO statement is to perform
steps in sequence:
(1)
The
Inl±131 2Bt3UfiBL ml, the t2£mlnal
lQn[gill~nla11Qn e3Lamg!~~
il2 .. ~\n;J !i3, respectively,
the
B3LBm~1at
following
m2, and the
m3 are established by evaluating 21,
includinj,1 if necess6ry, conversion
to the type of the DO-variable according to the rules for
arithmetic conversion (Table 4). If ~3 docs not appear, m3
has a value of one. m3 must not have a value of zero.
(2) The DJ-varigbla
par a~;H"1t e r mI.
(3) The
iteration
b~comes
count
1efined with the value of the initial
is estAblished and is the value of the
(!xprtJs~ion
where:
mtn
is the minimum-trip-count
either
one Or 2ero~
and
invocation. The value of m1~
the ntnimum-trip-cQunt control
Note
that
:
the
paramet8r. mi~ has a value of
is established at processor
may be dynamically modified by
directive (3.7.4).
iteration count is equal to the value of
mt~
Hhf:!n',,:~v(~r
m2 andm3
>
0, or
rul < m2 and m3
<
O.
81
>
At the C()NPJ·~tion of execution of the
process ina hegins.
DO
statement,
loop
control
Loap control processinu deter~lncs if further execution of the range
of the Do-lciop is required. The iteration count is tested.
If it
is not zero, execution of the first statement in the rAnge of the
DO--loop b>'s!oins.
I'f the iteratl'~n count Is zero, the DO-loop becomes
inactive. IF, as a result, aI' of the DO-Joops sharing the terminal
statement of this DO-100p are inactive, normal execution continues
Hith oxecution
of ,the next
eX::!c,ut!J.ble s~;atement
follo,,,,Jng the
t e r rl ina J s t ') t fHi1 (J n t. H0 H eve r , I f s 0 me 0 f the 00- I 0 0 p s s h a ring the
terminal
statement
are
active,
execution
continues
with
j nCr 8 fll (! n t rl t ion pro C ..1 Ssin J, 0 S ,~, a s cr. i bed i n 11. 1 O. 7 •
cnnTROL DATA PRIVATE
11-9
Control Data Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------11.0 CONTROL STATEMENTS
11,10.5 EXECUTION OF THE RANGE.
------------~---------------------------------~---------------------
statements in the range of a DO-loop Bro executed until the terminal
statement is reached.
Except by the incrementatlon described In
11.10.7, the DO-variable of the DO-loop may neither b~ redefined nor
become undefined during execution of the range of the DO-loop.
Zxecution of the terminal statement occurs as a result of the normal
execution s~quence or ns a result of transfer of control, subject to
tha restrictions 1n 11.10.8.
Unless
execution of the terminal
statement results in a transfer of control, executlon then continues
Hith incrementation processing, as described in 11.10.7.
1ncrementation processing
performed in sequence:
has
the
effect
of the following steps
(1) The DO-variable, the Iteretion count, and the incrementatlon
parameter of the active DO-loop whose DO statement was most
recently ~x'9out!Jd, are s)Ject~.)d ror processinn.
ria b I e is inc rem l! n ted by the
the incrementation parameter m3.
( 2 ) The v:! I u e of t h~::! 00- V ?
(3) The iteration count is
d~crementcd
by
value
of
one.
(4) Execution continues with loop control processing (11.10.4) of
the same DO-loop whose iteration count was decremented.
An
eX~Hnpld
illustrates the above:
N=O
Dr)· 100 1=1,10
J =I
D] 100 K=1,5
L=K
100 n=N+1
101 Cil1\TINUE
Aft~r
execution of the above
st~tcments
and at the execution of
statement, 1=11, J=10, \(=6, L=5", and N=50.
the foJloHing example (mlG=O):
COnTINUE
AI
the
so consider
N=O
DO 200 I=I,10
.J =1
00200 K=5,1
L=I\
CONTROL DATA PRIVATE
11-10
Control Data Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------11.0 CONTROL STATEMENTS
11.10.7
INCR2M~NTATION
PROCESSING.
-------------------------------------------------------------------200 n=H+l
201 C 0 \'1 TIN UE
After execution of
CO>lTINUE
th~
sC3tem-antJ
above statements and at the execution of the
and N=O. L is not df;fined by
1=11" J=10, K=5,
the above st3tements.
Transfer of controf Into the range of an
Inactive DO-loop is not
permitted.
Transfer of control to any executable statement in the
range of an active Dn-Ioop is permitted unless the statement is also
in th~ ranGe of an inactive DO-loop or the transfer of control Is
!lot permltted by the rules for execution of an IF-bloclt, ELSE
IF-block, ELS~-block, WHERE-block, or OTHERWISE-block.
The form of
A
CONTINUE
statement is:
CDNTINUr:
Ex<~cution
a CONTINUE.statement has no effect.
of.
If
the CONTINUE statement is the terminal statement of a
naxt statement executed d~pends on the result of the
inc r e me n t El ti on pro c (! sst n 9 ( 11. 10. 7 ) •
th~
DO-Jo~p,
DO-loop
The form of a STOP statement Is:
En]
STap
Hhere
il
is
J
strlnu of not
Iil0ra
than five djgjts, or is a character
constant.
of a STJP statement causes termination of execution of the
aXJcutabl8 ~rogram.
At the time of termination, the digit string or
character constant is accessible.
2~Jcution
The form of a PAUSE statement is:
PAUSE [0]
whAre n is
c. 0 n.:5 t: an t •
~
Execution
of
string of not more than five digits, or is a
a
character
PAUSE statement causes a cessation of execution of
CONTROL DATA PRIVATE
11-11
Control Data Corporation Standard FORTRAN
83/06/30
~----~-------------------------------------~------------------------
11.0 CONTROL STATEMENTS
11.13 PAUSE STATEMENT
-------------------------------------------------------------------the ex e cut a b t e p r () :J ram.
Ex e cut Jon 1s res u rna b , e •
At
the tim e 0 f
cessation of execution,
the digit string or character constant is
accessible via displaY to the operator, and also to the user if the
I a t te r
is
i n c 0 min lJ n i ca t I· 0 n ~..J I t h t he pro c e s s 0 r d uri n 9 ex e cut i on •
Resumption of execution is not under control of the program.
If
execution is resumed, the execution sequence continues as though a
COnTINUE st;~itement 1'Jer(1 CXE:cuti2ld. Sae the referfJnCO manual for the
21P?rOpr j-at~~ operating system r i2jarding the means for Inci cat Ing ·that
execution should be resumed.
If the
program
is
executing
interactively, the user caUses execution to resume by enterino an
inp\Jt.1 ine. consisting of the characters GO In columns one
and
two.
The alphabetic case of the letters in GO 1s not significant.
The END statement IndIcates the end of the sequence of statements
and comment I ines of a program unit
(3.5).
If executed in a
function or subroutina subprogram,
i t has the effect of a RETURN
statement (16.Bl. If executed in a main program, It terminates the
execution of the executable program.
The form of an END statement is:
EilD
An END statement is written only in columns 7 through 72 of an
ini ti al I ine. An END statement must not be continued.
No
other
statcmnnt in a program unit may have nn initial I inc that appears to
be 3n END statement.
The last line of every program unit must be an END statement.
The I oa j c a I ~l HER Est ate men tis t1 sed to
con t r a I the ass i 9 n men t 0 f
values in 3n array assignment, 2nd to control the evaluation of
expressions in the array assignment statement, according to the
value of a logical array expression.
The form of a logical WHERE statement is:
HHER[
(1.3f:)
;S..t
Hhere:
of type logical or bit
1~~
is an arr3Y
s~
is an array assignment statement
Exocution
~x<:;:!cutJon
~xpression
of a Joglosl
of the sequence
WH~RE
statament
has
the same effect as
CONTROL DATA PRIVATE
11-12
Control Data Corporation Standard FORTRAN
83/06/30
~-~~~--~~~-~~~-~----------------------------------------------------
CONTROL STATEMENTS
11.0
11.15 LOGICAL \4HER2 STA TE1'1ENT
-------------------------------------------------~~-----------------
vI HER E (!.a,g )
;it
END }IHER f:
The block WHERE statement ls used wfth the END WHERE statement, and
opt ion a I I y
the
0 T:-I E R\~ I S (:
s tat em en t t o e 0 n t r 0 I the ass i 9 n men t a f
~a)ues in R block of array assignment statements, nnd to control the
evaluation or expressions In array assignment statements, according
to the .value of a logical array expression.
The form of a block WHERE stetement is:
whcr~:
The
lafi is an array expression of type logical Or bit
H~fBf=lQ~gl
of a statement
~
is
01 - n2
where 01 is'the number of block WHERE statements from the beginning
of the prOjram unit up to and IncludJng s, and 02 is the number of
2ND WHERE statements in the program unit up to but not including ~.
The WHER~-l~v€' of every statement ~ust be zero or one. Note that
this precludes nestlng BLOCK WHERE statements. The WHERE-level of
e ac h
b 10 c k
~1 HER E,
0 T H:: R WI SE, and 2N D WHER Est a t (~m e n t mu s t b eon e •
T h (l WIH: RE- I !9 vel 0 'f t h3 En 0 s tat I~ men t 0 f e a c h pro !J r a HI U nit
mus t
be
zero.
A H~~R~=bln~k consists of 81 I of the executable statements that
appear fol lowing the block WHERE statement up to, but not including,
the next :JTHERWISr: or
END VlHERE statement that h~s the same
qHERt-I·~v;,;~1
as the block WHERE
~::;tatement.
All
of
the
t;xecutable
st3tements in a WHERE-block must be array assignment statements that
do not involve an array-valued function reference.
In each array
'~1 s sin n mc: n t
s t ~d: em e n t
of
the for m U. =[:!. =.J ••• jJ, ~ mU s t h 8 vet h e sam e
shape as lEg. No statement 1n a WHERE-block can be the terminal
s t 8 t e m,j n t 0 faD 0 •
A HHER c- b I 0 c k may b \~ em p t y •
T ran sF € r 0 f con t r 0 I
into a WHERE-block is prohibited.
Execution of a blo~k WHERE statement
The statements in the
expression i.a£!.
caus':es
evaluation
of the
\'JHERE-bI6ck are executed in
CONTROL DATA PRIVATE
\
11-13
Control Data Corporation Standard FORTRAN
83/06/30
~~-~~-~~-~-~~~~~----------------------------------------------------
11.0 CONTROL STATEMENTS
11.16.3 EXECUTION 1F A BLOCK WHERE STATEMENT
norma1 execution sequence. When an array assignment statement
executed under control of a block WHERE statement, the semantics
of the st:?ltdm'Jnt a.fEJ 8S j'f it Nere executed as "fellows:
is
(1) The
evaluation of the expression ~ takes place as if it were
(! dF 0 r
a I I c: I e m~~ n t S 'i h ~) r e 13 ~ i s t r \H~ and
the
res u I t
of the evaluatlon assigned to the corresponding element of y.
At points where lll~ is false, the v11ue of the corresp~nding
element of y is not altered and i t is as If the expression ~
was not evaluated.
e v n I u ::~ t
(2)
Assi JfH,lent
stltements
( 1 nc Iud ing
:an
bethl(!'on
a
VJH1~RE
and
an
ENDHHERE
block) are executed in
normal execution sequence.
Values
defined in y. in one
~ssiJnment
statement
~ay
be referenced or defIned in
subsequent assignment statements.
The value of
!a~
OTHER vII SE
opt J ana I
is not affected by the execution of
statements
in
the HHERi:-b 11Jc'<.
TrRnsfer of control into a' WHERE-block is prohibited.
The form of an OTHERWISE statement is:
OTHERHISE
An
QI~E&HlSa=nLD~~ consists of all of the cx~cutablc statements that
a;>~Bar FoJ I ')1;Iin9 the OTHERWISE statement up to, but
not
Including,
the END WHER~ statement that has the same WHERE-level as the
T 1., ER \>11 SE s t ate men t •
AI I 0 f
t h n f;! x \} cut a b 1e s t a t ;~ men s
1nan
n
t
() T 1-1 ERI~ IS E- b 10 C1<
mu s t
be
~ss
a r ray
I sm Iil en t
s tate men t s t hat don 0 t
involve ~n 3rray-v~lued functlon
reference.
In ~rray assignment
statements of the form X=[~=J"'f' X must have the same shape as
llbJ..
t':o st3teEIant In ~~n OTHERWISE-bJoc!< c.:n be the te.rminal
statement of a Dn. Transfer of control into an OTHERWISE-block is
pro h i bit e d •
AnD T 1-1 ERWI Si: - h I 0 ':: I~ may b ~ c mp t y •
Execution or an OTHSRWISE statement causes the statements
in the
f1 THE RWI SE- b 11 Cl<
to bee x e cut e din no r ma I ex e cut ion seq u en celt \4 hen
an array assignment st3tement is executed in an OTHERWISE block, the
s~m;lnti
cs of the
(1) Ths
)
l~
si;,~tement
rlr'~
as
1f
i \:
avaluatlon of the expresslon
v:! I u.) l>71 d for
~
I t e l e m'~ n t
S
H her'~
;,~ore
~ncecllted
~s
foil
Ol~S:
~ takes place as if i t were
1 D.r. i s f a I s e tl n d the res u J t
CONTROL DATA PRIVATE
11-14
Control Data Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------11.0 CONTR1L STATEMENTS
11 .• 17.2 EXECUTION nF
An
DTHER\·IISE STArEi"lENT
-------------------------------------------------------------------of the evaluation assi)nnd to the corresponding element of ~.
At points where la~ 1s true, the value of the corresponding
element of ~ Is not altered and It is as If the expression ~
was not evaluated.
(2)
The
th~
A;ss iJnmen t
s tn t'3men ts
be t~tee n
a HHE RE
an dan END vII-IER E
(Including an optional OTHERWISE block) are executed in
normal execution s~quence.
Values defined in X in one
assionment statenent may be referenced or
defined
In
subsequent assignment statements.
value of 13f is not affected by the execution of statements tn
OTHERWISE-bJock.
Transfer of contro1
into an OTHERWISE-block is prohibited.
The form of an tND WHERE statement is:
i:ND Hi-JERE
:;)L!cution Of an 2ND WH::Ri: statement has no '9f-rect.
For
each
block
WHERE
statement, there must be a corresponding END WHERE statement
A ~QLL~liQQQdlDD
st~jtement that has the
in the same program unit.
the
n'~xt
t.:I,ID HHERE
fDll
siatsmfot
H~tEE
~!HERE-I€ve'
S2me
is
as the
btock WHERE statement.
CONTROL DATA PRIVATE
12-1
Control Data Corporation Standard FORTRAN
83/06/30
-----------------------------------------------------~--------------
12.0
ARRAY STORAGE ALLOCATION
-------------------------------------------------------------------ARRAY STORAGE ALLOCATION
12.0
There are two executable
storage for arrays:
statements
that
control
allocation
of
(1) ALLOCATE statement
The
ALLUCATE
st3tement
:) I I 0 cat a b len r ray •
is
Th~) for fl1
t')
used
to
allocate
storage
.r- an ALLOCATE statement
for
an
is:
ALLOCATE adtJ3dJ •••
:'Jht~re:
~.1
has the form
O(
a constant or adjustablE: array declarator.
The array names appearing in ad must have been specified to be
allocatable arrays. The direenslon bound expressions ere subject to
the' same I imitations as in an array declarator, except that array
element references are permitted to appear.
No
allocatable arraY
namq in an ALLOCATE statement may be roferenced in a primary of any
ex~resslon within the same ALLnCATE statement.
For example,
is prohibitud. Tho dimension bound expressions in 3d are evaluated
at the time of execution of the ALLOCATE statement. The values of
th~
ctimijnsion bound expressions determine the sizes
of
the
correspo~dinJ dImensions for the allocatable arrar and the upper and
lower bounds of the dimenslons.
The number of dimensions is
determined by the allocatab'e array declarator and must correspond
1Jith th~ numb~r sp~cified in 3~.
If the al locatable array Has
declared with an explicit lower bound ~l, then the corresponding
lownr bound of the arrny rlecJar3tor ad must specify the same value
An allocatable array must not he defined or referenced if i t is not
currently allocated.
Aftar ox~cution of an ALLOCATE statenent for
an array,
the
properties of dimension size, lower and upper dimension bound, and
array size are established. However, any entities in the dimension
hounds expr3ssions mny be radefinerl or become undefined with no
ef?Dct on tha above rnentloned properties.
Immcdl3teJy after an
arr~y
is :JI located the values of all of the array elements are
undefined.
An ALLOCATE statemont May appear in a main program,
subroutineJ
or
CONTROL DATA PRIVATE
)
12-2
Control Data Corporation Stand3rd FORTRAN
83/06/30
-------------------------------------------------------------------12.0 ARRAY STORAGE ALLOCATION
12.1 ALLOCATE STATEMENT
fUnotion subproararn.
At the beginning of execution of an executable
have
.a state of tlnot currently
that have been allocated storage
been subsequently freed, will be
the subprogram 1n Hhich they
were allocated is terminated by execution of a RETURN or END
statement, and the ailocatabJe ~rray n~me is not specified in a SAVE
proJram,
;d J
aj locatflble (;Irrays
allocated". All allocatable arrays
by
an ALL1CATE and that have not
fr08d automatically if execution of
a
currently
FREE statement. caUses the storsJefor previousty
orrays to be released. The form of a FREE statement is:
allocated
st'li:emr.:nt
(c}(plicitty
or
implicitly).
d I I 0 cat e dar r ny Is p r oh i bit e d.
Th~
Allocating
Hhere: .2. is the name of .~n ~I'ocatable array previously allocated by
execution of an ALLOCATE statement. Results are undefined if a is
not currently allocnted.
CONTROL DATA PRIVATE
13-1
Control Data Corporation Standard FORTRAN
83106/30
13.0
INPUT/OUTPUT STATENENTS
13.0
INPUT/OUTPUT STATEMENTS
Input statem~nts provide the means of transferring data from
external media to internal storage or from an internal fi Je to
internal
storage.
This process is
called
L~a~lD~.
Output
statements provlde the means of transferrlng data from internal
storage to. external media or from internal storage to an internal
fi Ie,
This procoss is called !:lI:.1tlD!1.
Some input/output statements
specify that editing of the data is to be performed.
In
addi tioTl
to
the
transfer data,
there ere
the external medium,
or to inquire about Or describe the properties of the connection to
the external medium.
HlI;ti Ii nry input/output
statements
th~t
statenh~nts
taman
lpul~te
There are fourtoen input/output statements:
(1)
READ
(2) WRITE
(3) PRIHT
(4) OPEN
(5) CLOSE
(6) INqUIRE
(7)
BACKSPACE
(8) ENDFILE
(9)
REHli-lD
(10) PU;'IC H
(11)
BUFF~:R
In
(12) BUFFER OUT
(13)
)
(14) DECODE
The
)
REAO,
HRITE.'
PRINT, PUnCH, BUFFER IN, BUFFER OUT, ENCODE, and
DECODE statements are 13i3
The
are
)
cNCOD~:
tL3n~fgL
i02ytlQYi2Ut
slat~mBnt~
(13.8).
[JPEN, CL(lSc..' InOUIRe, BACKSPACE, Et-lDFILE, and REwINO statemBnts
.3llxlll~L~
ENDFIL~,
and
InDlltLQut~lli
REWIND
~tatR~an±s
statements
(13.10).
The BACKSPACE,
are flig gn~111QoiOU l02y!Lgylnut
cnNTROL DATA PRIVATE
Control
D~ta
Corporation
St~ndard FORTRAN
13-2
83/06/30
13.0
13.1
INPI..JT/OUTPUT
ST.ATEjlENTS
B.E.;.~Q8Q.s.
A L~~QL~ is a sequence (2.1) of values or a sequence of characters.
For example, a punohed card is u5U~lly considered to be a record.
Howevar, a r~cord does not necessarily corr,espond to a physicaJ
entity. There are three kinds of records:
(1)
Formatted
(3)
EndfiJe
A formatted record consists of A sequence of characters that are
capabJe of r0presantetion in the proc~ssor.
The length of ~
formatterl record is measured In characters and depands primarily on
the number of characters put into the record when it is written.
110wever,
i t may
rlepend
on the processor and the external'medium.
Tho lenGth may be zero. Forrnal:·f.;ed rt"'!cords may be r(!sd or ~lritten
onl::/ by formatti.:d input/output st;)tem~nts (13.8.1),.
Formatted records may be prepared by some means other than FORTRAN;
for eX8mpl,:~ some m,)nual input d(~vice.
An unformHtted
of a scquence of values in a
may contain both character and
noncharacter data or may contain no data.
The I ength of an
unFormatted record is measured in processor-dependent units and
'lep~nds on the outPlIt list (13.3.2) used Hh~n it is ~'!ritten, as Hell
::tS
on
the
processor .lnd th-a ext,sr'nal mediurr. The length may be
record
proogssor-dQpen~ent
consists
form
2nd
Z f:!r o.
0 n I y s t ,;'1 t ':.) mn n t s t hat r e? d
fA n d
",r t ·c c!
\J n for ill a t ted
r e cor d s
are
unformatted input/output stetements (13.8.1), BUFFER IN, and BUFFER
OUT statements (13.15). An unformatted record to be read by a
BUFFER IN statement or to be written by a BUFFER nUT statement may
not contain character, bit or half precision data.
T h (:!
An end f i I e record is written h y e n Et,lD F I L Est 3 t C men t •
An endflle
r e cor d rn ~1 y 0 C cur 0 n I '! :3 S the I n. s t roc 0 r d 0 f a 'r i Ie. An endfile
record does not have a length property.
cot·;TROL DATA PRIVATE
13-3
Control Data Corporation Standard FORTRAN
,
,
...... -~----
.... -- ....
--....
83/06/30
----..~------------------------~----------.----------~----
13.0 INPUT/OUTPUT STATEMENTS
13.2 FILES
-------------------------------------------------------------------13.2
fILES.
A tilg is a sequence (2.1) of records.
There Ere
(1)
tHO
i1 0 \-l ~ V e r •• mea n s are pro v r de d t 0 c han get h e s t a t u s
0 f
a
unit and to connect a unit to a diffarsnt filo.
After
unit
has
been
disconnected by the execution of a CLOSE
"it may be connected
again within the same executable
pro£,1ram to th(: !::~"t!m"~ fi J e or (1 di ffnrnnt f i li-e. After a fi I e has been
dis con nee t (~ d by t lE!e X?l cut Ion
0 f?
ClOS E s t e:: t e men t ,
it
maybe
connected ajain within the same executable program to the same unit
a
st~tementJ
or a different unit.
;:1
ri
i: h ";} t
I (~
Note, however, that the only means to refer to
b r.~ end i s con nee ted
has
I s b y Its n n rn e I n
~n
0 PEN 0 r
Therefore, there may be no means to reconnect an
unnamed file once it is disconnected.
INQUIRE statement.
The form of a llnit
[Ut"~IT
where II is
irfcntifler.
an
s2£nlfl~£
=]
is:
!J
external
unit
identifier
or
an
internal
file
An externat unit Identifiar is used to refer to an external f i Ie.
An internal fit e identifier is used to refer to an internal f i Ie.
An
;1~J;~r.D.nl
(1) A
:Jolt
scalar
Ij~otifl£!.
integer
is one o "r the follorring:
or
sc~lar
Boolean expression
~
such that
:r~ithcr
CONTROL DATA PRIVATE
13-10
Control Datd Corporation Standard FORTRAN
83/06/30
-----------------------------~--------------------------~-----------
13.0 IN?UTJ1UTPUT STATEMENTS
13.3.3 UNIT SPECIFIER AND IDENTIFIER •
.-. ....... ---_ ....... .-_- ...
... ----_ ...
....--- .... --------_ ...
-_
.
_---_
__ .... ------- ............- ...
.-.
_ __ ... _---------
....... ... - ....
(b) BOOL(g) has a value of the form L"i", where f. is a
sequence of one to saven letters or digits, startIng
\-lith a letter, comprising a valid system file name.
Upper
and
lower case letters in the fi Ie name are
interpreted as YArinnts of the same letter.
There Is a correspondence between certain pairs of external
units.
In case (a), the unit identified by the value of
INTC~) corresP'Jnds to the,unit idi.!ntificd hy "lAPEls", t1here ~
is the digit string, with no leading zeros, representing the
val u e 0 fIN T (we) •
Inc as e (b) J i f f i S
0f
the for m TAP Els,
wh2re
~
1s
3
dia't strlnJ' with no leRdlng zeros,
representing an integer value in the range O-Q99,
then the
tJ n f t
i dt! n t i 'f i? 1'1
by
the v (] , Uf.!O f BOO L C~ ) cor res po n d s to t h 13
unit Identified by the value of k; if f is not of this form,
then no corr8sponJence exists in this case.
A correspondence between two external units means that if one
units is connected to a fife then the other
unit is also connected to the file.
of the external
1sterJsk, identifying a particular processor-determIned
external unit that is preconnected for
formatted sequential
(2) An
access
(13.().2).
ThD extern~1 unit identiFied by the value of ~ is the same external
unit in ai'
program units of the executable program.
In the
o:~
ump 1 ':.!:
SUi3RDUTINE A
~ :~AD
(6)
X
•
SUBROUTINE B
N=6
REHI!lD !'1
the value 6 usad in both
un it.
progra~
units Identifies the sgme external
An external unit identifier inanauxi J i ary
input/output
statement
( 13. 1 0 ) mus t not be a n as t e r i s I~ •
__ fllg __ lrl~otlfl~t provides the means of referring to a
or :Jztp.nden intnrnal fi Ie (13.2.5).
An
internal fi Ie
!d;::!ntJf"ier for
:l
st::\n:inrd Intern~1 file Is the symbolic name of a
character variable, character array,
character array
section,
character array ~JemcntJ Or character substring. An internal file
i d ,;; n t i 1: I err 0 ran (J x ten de din te rna I 'f t J e 1st h ~ s y mb 0 I 1 c n a 01 e
0f
a
An
Int~rn31
standard
CONTROL DATA PRIVATE
13-11
Control Data Corporation Standard FORTRAN
83/06/30
13.0 INPUT/OUTPUT STATEilENTS
13.3.3 UNIT SPECIFIER AND IDENTIFIER.
~-~-~~----~~-~-~~~~--~-~----------~--~~-~-~---~~~--~-~------~-~-----
variable, array, array section, or array alemant of type other
character, bit or half-precisJon.
than
If
the optional chRracters UNIT= are omitted from the unit
specifier, the unit specifier must be the first item in a t ist of
spaclfiars.
The form of
G
faLmat
[Ff'lT
A
be
fQLm~t
0 ne 0 f
=]
s2a£1!1~~
is:
f
Idaul1fi£L identifies a format.
t h ~,!
f
0
I I O,J i na :
A format identifier must
(1) The statement label of a FORMAT statement that appears in the
same ptoDram unit as the format identifier.
(2) An int~ger variable name that has ba~n assigned the statement
lebe! of a FORMAT statement that appears In the same program
unit as the format identifier (10.3).
(3) A
charact~r
array name or character array section (14.1.2).
(4) Any scalar character expression except a character expression
involving concatenation of a dummy argument or variable whose
lenJth specification is gn asterisk in parentheses. Note
that] character constt~nt ·is perra; tted.
(5)
An asterisk,
specifying list-rlirectcd formatting.
(6) A HAil2LIST Jroup name.
(7)
An array name or array section of type other than
bit or half precision.
character,
If the optional
charncters FMT= arc omitted from the format
spucifier, th~ for~at specifier must be the second item in the
control
information I ist and the first item must be the unit
sp~cifier without the optionnJ charActers UNIT=.
The form of a
REC
t~~g£~ sn~nifl~~
is:
= r.o
yhere LD is an integer scalar expression whose
value
is
positive.
CONTROL DATA PRIVATE
13-12
Control Data Corporation Standard FORTRAN
83/06/30
13.0,
INPUT InUTPUT STATEnENTS
13.5 RECORD SPECIFIER
.
.
--------------------------------------------------------------------
It specifies the number of the record that is to be read or
in a file connected for direct access.
written
The set of input/output error conditions is processor dependent.
An end-of-f,lle
occurs:
condition
exists If either of the following events
(l) An endfite record is encountered during the reading of a fite
connu Inth is case, the f i ~ e Is pas i t f oned ~fter the endf II e
record.
(2) An attempt is made to read
intf~rnalfj Ie.
~
record
beyond
the
end
of
an
If an error condition occurs during execution of an input/output
statement, execution of the input/output statement terminates and
the position of the fIle becomes indeterminate.
If an error condition or an end-of-flle condition occurs during
execution of a READ statement,
execution of the READ statement
terminatf-'2s nnd thi.:1 entities specified by the input list, and
implied-DO variables In the input list become undefined. Note that
variables and array elements appearing only in subscripts, substring
expressions~ and implied-DO parameters
in an lnput list do not
b~comt:
und·:;~rint3d
uhen
the entities specifl cd by the list become
undefined.
If an error condition occurs during execution of an
output
stJtement,
~xecution
of the output statemnnt terminates and
i~pl led-DO-vJriables tn the output fist become undefined~
If an error condition occurs during execution of an input/output
statement that contains nt:ither an inpllt/output status specifier
(13.7) nor no error speclffer (13.7.1), or if an end-of-file
condition occurs during execution of a READ statement that contains
neither an input/output status specifier nor
an
end-of-file
s p '3 G i fie r
( 13 • 7 • 2) ,
~! X e r;\J t ion
0f
t; h (!
e)( e C lJ t3 b I e
pro 9 ram
is
t e r ~1 I n J ted.
I]STAT
where
In~
= l!l~
is an Intaaer varlable or into]er array element.
Execution of an input/output
stAtement
contninlng
this
specifier
CONTROL DATA PRIVATE
13-13
Control Duta Corporation Standard FORTRAN
83/06/30
.------------------~~~~--~~~~-~~~----~-~--~~--~~----~--~~---~--------
1 3 • 0 IN PUT I L1 UTPUT STAT E:'\ ENT .s
13.7 1/0 STATUS" ERROR, AND END-OF-FILE SPECIFIERS
causes lQs to become defined:
(1) with a zero va1ue If neither an errOr condition nor
end-of-fi Ie condition is encountered by the processor,
an
(2) with a processor-dependent positive integer value if an error
condttion Is encountered, or
(3) with
3
processor-dependent
end-of-fi Ie
condition
negative
integer
is encountered and no
value if an
error condition
is encountered.
Th3
form of an
ERR
fl~~nc ~2ecl!1~~
is:
=~
I abel
of
an
eJ':~cutab Ie
statement
appears in the same program unit as the error specifier.
"Hhore So j;s th(! statemont
that
If an input/output statement contains an orror specifier and the
prOC3SS0r encounters an errOr condition during execution of the
statement:
(1) execution of the" input/output statement terminates,
(2) the position of the fIfe speclfled
statement becomes indeterminate"
(3)
in
the input/output
if the input/output statement contAins an input/output status
sP0cifier (13.7)~
the variable or array eldment In~ becomes
defined with a processor-dependent positive integer value,
and
(4) execution continues with the statement labeled s.
The
form of an
EnD
)
~nd=nf=fll~
=
SD~Glflf£
is:
.s
where S is the statement lahel of an executable statement that
j) p P 8 ,) r s
tnt h e S a 111 ~ pro 9 r a fiT Unit as the end - 0 f - f lIe s p '3 C i f 1 e r •
If a READ statement contains an end-of-file specifier and the
processor encounters ~n Qnd-of-file condition and no error condition
durtn:::; execution or thd st~te!1cnt:
)
(11 execution of the READ statement termjnates,
CONTROL DATA PRIVATE
13-14
Control Data Corporation Standard FORTRAN
_........ __............ _...
-..
63/06/30
.......- ........ --------------------------_._._----------------------
13.0 INPUT/OUTPUT STATEMENTS
13.7.2 END-OF-FILE SPECIFIER •
. (2) if the READ statement conta ins an
input/output
status
specifier
(13.7)~
the ~ariable or array element 19S becomes
rlafined with a processor-dependent neJativc Integer value,
and
(3) execution continues with the statement IRheJad
s.
The READ st)tumant is the data trans~er Input stntement. The WRITE,
PRINT, and PUNCH statements are the data transfer output statements.
The forms of the data transfer input/output statements are:
R:AD
(~111st)
[lo!lstJ
WRITE (gillst) (i211stJ
[J]
PRINT f (,lullsl] [,]
H
her e: . ~111s.± i s
r.l
con t r a lin for mat ion lis t (13.8. 1 ) t hat inc Iud e s :
(1) A
roference to .the source or destination of the data
to be transferred
(2) Optional
s~eciflcation
of editing processes
specl~Iers
that determine the execution
sequence on the occurrence of certain events
(3) Optional
(4) Dptional specification to
Opt1on~t
(5)
f
specification
input/output status
identify
8.
record
to provlde the return of the
is a format identifier (13.4)
lQ.lls.i is
JJ1
input/output list (13.8.2) specifying
the
data
to be transferred
Iof th~~
WRITE~
-fortll,:rt
ict:~ntifjf.~r
1:
-tt,e
is €n estcrisl"
PRINT or PUNCH statement may be followed
comma-has no 8ffect. If the format identifier f
naMe (13.14)~ lQllst must not be present.
list 1.n!ls1 In a
a comma.
The
Is a NAHELIST oroup
by
CONTROL DATA PRIVATE
13-15
Control Data Cbrporation St8ndard FORTRAN
33.106/30
-----~-------------------------------------------------------------13.0
INPUT /;-'lUTPUT STATEHENTS
13.8.1 CONTROL INFORMATION LIST.
-~---------------~---~----------------------------------------------
A ~DntL21 InfnLill3tlQ~ list, ~lil~i, is
items may be any of the following:
a
list
(2.11)
whose
list
+---------------+
[UNIT =J II
(Fl'lT
=
J f.
R :lC= I:.O
IiJSTAT
ERR
END
= s.
= ins.
=~
+---------------+
A control
(13.3.3),
informatlon list must contain exactly one unit specifier
at most on= formst spccift~r (13.4)~ at most one record
sp~clfler
(13.5), at most one ,Input/output status specifier (13.7,)"
at most one error specifier (13.7.1), and at most one end-or-file
specifier (13.7.2).
If the control
information list contains a format specifier, the
statement is a fQLm3ttg~ IDEutLnut2lli ~tBlgm~nt; otherwise, it is an
Un1aLwatl2u
InEu~Lu~±2ut S!~t~D~D1.
If the control
information list contains a record specifier, the
statement is ~ rll~tint a~~ftss ineutLaut2ut ~±at~meol; otherHise~
it
is a ~££llQntlBl E~~~S~ In2~1LQ~~gy! st3i~m~D1.
If
the
op1:ionfll
chardcters UNIT= arc onJtted from the unit
specifier, the unit specifier must be the first item in the control
information list.
If tho optional chsracters FMT= are omitted from the format
s p ~ c i 'f I e r, the for ill at s p e c I fie r mu s t b e t h esc con d i t e min the
control
information 1 ist and the first item must be the unit
specifier without the optionel charact~rs UNIT=.
A control Inrornatlon J 1st must not contain both a record
Hnd ~n end-o'f-fi Ie specifier.
If
the
format
ll~t=dlt~ct~d
be present.
IF
'~
In
is
nn
J
astarlsk,
the
statement
is a
lU2uiLnutnut si3temen± and a record specifier must not
Ide n t i f i ,~r I san At1 ELI S T D r 0 U P n am e , the s
InQll±Lg~t£llt ~t3tgmnnt and a record specif1er
the for f:l ,1 :
tlAMELISI
present.
),
identifier
specifier
WRITE stBternentJl
the control
tat e men t i s
must not be
Information list must not contaln
an en d-o f- f i f e :s pee i fie r •
)
CONTROL DATA PRIVATE
13-16
Control Data Corporation Standard FORTRAN
83106/30
13.0 INPUT/OUTPUT STATEnENTS
13.:3.1 COHTROL INFDRHATION LIST.
If the unit
information
asterisk or
specifies an
internal
file,
the control
list must contain a format identifier other than an
NAMELIST group name and must not contain a record
specifier
3
specifier,
An ID2UiLuui2ui 11£t, Inl1si, spectfies the entities whose values
arc transferred by a data transfer input/output statement.
An input/output I ist is a list (2.11) of lnput/output list items and
implied-DO lists (13.8.2.3). An In~lltLQY1£Yl llsl llgm is either an
input list item or an output list item,
If an:lrraY name
~ppe;-~rs as an lnputloutput list item, it is treated
al I of the elements of the array were specified in the order
:Jiv~n
bY'lrray (1'i!:mc~nt ordering (5 • .3.4).
The
nerne
of
an
:;'lssumed-size dumm,;1 array must notapp"eilr tlsanJn;:>ut/output Jist
i tern.
as
if
An 102Ut
Item must be one of the fol lowing:
11~t
(1) A variable name
(2) An
arr~y
element name
(3) A character substring name
(4) An array name
(5) An array scot Ion name
Only input 1 ist items may appear as input/output list
input statement.
An Qy1nyt
11~1
items
in
an
must be one of the following:
It~m
(1) A variable name
(2) An array element name
)
( 3)
Ac h"l r
(4)
An
f:
c t er
s u h:; t r inn n a IjliS~
array name
(5) An array section name
)
CONTROL DATA PRIVATE
13-17
Control Dat1 Corporation Standard FORTRAN
83/06/30
13.0 INPUT/OUTPUT STATEMENTS
13.8.2.2 Output List Items.
(6) Any other expression except a character expression involving
concntBnation of an operand Hhose length specification Is an
asterisk in parentheses unless the operand
Is the symbolic
name of a constant
Note that a constant, an expression involvinJ operators or function
references, or an expression enclosed In parentheses may appear os
an output list Item but mu~t not appear as an input I ist item.
An
Im2113~=rrD ll~t
~"here:
1, gl). Jl2,
is of the form:
and
~3
are
as
specified for the DO statement
(11.10)
dll~t
is an input/output list
The r an 9 e of an imp I i ed-DO 1 i s t i s t he I i.s t .d! 1 s 1; •
Not (! t hat
.d lis.t
nay contain impl ied-DO lists.
The iteration count and the values of
the DO-variable 1 are established from ~l, g2J and g3 exactly as for
a DO-loop,
In ail Inrut statement,
the
OO-variabl ;! 1, or an
associated entity, must not appear as an input list item in dll~t.
JIh'.;1n
an
imp I iad-DO
Jist appears in an input/output list, The list
i ten sin !ills.:t are' s p e c i fie don c e for e a c h i t era t ion 0 f
the
implied-DO list uith qpprOpriAt~ suhstitution of Yalues for any
occurrence of the DO-V3riable 1.
l
Tha effect of executlnJ a data transfer input/output statement must
be as if the following operations were performed in the order
s p ('.c i fie d :
( 1) 0 e t e r III i net he d Ire c t i on of d a tat r an s 'f e r
(2) Identify the unit
(3)
Establ ish th;:! forFlat
if any is specified
(4) Position the file prior to data transfer
(5) Transfer data between the fi Ie ~nd the ~ntttics specified by
the Input/output Jist (If any) or identified by theNAMELIST
group n~me
(6) Position the file after
( 7) C au 5
I:.'!
d~t1
the S:J e c 1f i ~~ din t r. J e r
trnnsfer
v a ria b leo r
a r ray e 1e men tin
the
CONTROL DATA PRIVATE
13-18
Control Datu CorporatIon Standqrd FORTRAN
83/06/30
-------------------------------------------------------------------13.0 INPUT/:]UTPUT STATENENTS
13.9 EXECUTION OF A DATA TRANSFER INPUT/OUTPUT STATEMENT
-------------------------------------------------------------------input/output st'Eltus specifier (if nny) to hecome d€fined
Execution of a READ statement causes values to be transferred from a
,'Ii 1:8 to the ;:;ntitJes specIfied by
tha
Input
list,
If one Is
specified.
Execution of a WRITE, PRINT, or PUNCH statement causes values to be
trunsferred to a fi Ie from the entitles specIfied by the output 11st
or tlAt1ELIST group name and format specification (if any), Execution
of a WRITE, PRINT, or PUNCH statement for a file that does not exist
cr~ates the filA, unless en error condition occurs.
A data transfer
input/output state;nent that co,ntains a control
inFormacion li.st (13.8.1) Includes ~ unit specifier that identifies
an external unit or an intern~1 fi Ie. A READ statement that does
not
contain
control
information list specif'ies a particular
unit, which is the same os the unit identified
by
an asterisk In a READ statement that contains a control
information list.
A PRINT
statement
specifies
some
other
processor-determined unit, which is the same as the unit identified
h y q n as t B r i s 1< ina WRITt: s tat e fi1 e n t •
A pun CH s tat e m·~ n t
5 Pe c1 'f I e s
stl II
another processor-determined unit. Thus each data transfer
input/output statement idcntifles an external unit or an internal
a
proc~ssor-dotcrminnd
f'llo,
Data transfer Input/output statements that do not contain control
information I ists refer to units that are preconnected as fo1lows:
+-----------+---------------+-----------+
: Stat8:·ilent: Stnndarc! Unit: File Name:
+-----------·t··---------------+-----------+
RSAD
L"INPUT"
'!r'lPUT'
PRnlT
l"OtJTPUT"
PUnCH
L"PUNCHtI
'OUTPUT' I
'PUNCH'
+-----------+---------------+-----------+
The unit idontifiad by ~ data transfer input/output. statement
.he connected to a fila when execution of the statement begins.
must
Data transfer statements that do not contain a control information
I ist refer to preconnactod fites that arC processor defined.
If the control
information list contains a format
id~ntifier
othor
:3st.dl'isk
or NANELIST group nart1:C! ... the format specification
identified by the format identifier is estahlished. If the format
!:h~ln
il.n
CDNTROL DATA PRIVATE
13-19
Control Data Corporation Standard FORTRAN
83/06/30
13.0 INPUT/OUTPUT STATEf"lENTS
13.Q.3 ESTABLISHING A FORNAT
-------------------------------------------------------------------,
i d en t i to: i e r
,
t e r J s!.;,1 1st - d Ire c ted for m1) ttl n 9 I s
,~ s tab lis h e d •
identifier is a NAMELIST group name, NAMELIST
formattina (14.7) is established.
If
the
j
s
B. f)
;3 S
format
CI u t put:
if H n
i n t ern a I
11 J J e
has
been spec t f I ed,
a
for mat
specification (14.1) that is
in the file or is associated (18.1)
Hith the file must not be specified.
LJ n
The positioning of the fi Ie prior to data transfer
method of access: sequential or direct.
depends
on
the
If the riJ,~ contains an endflle record, the file must not be
positioned after the endfi Ie record pr jor to data transfer.
On input, the file is positioned at the beginning of the next
record.
This record becomes the current record. On output, a new
record is crn)ted and becowes the last record of the file.
internal file is alHays positioned at the beginning of the
record of the file. This rrcord becomas the current record.
An
first
For direct access, the file is positioned at the beginning of the
record specified by the record specifIer
(13.5).
This record
becomes the current record.
are transferred between records and entities specified by the
input/output list. The list items are processed in the order of the
input/output list.
D~t~
vulues
needed
to determine Hhlch ent'ities are specified by an
input/output list i tern are determined at the beginning of the
processinJ of that ltem.
All
All
v~lu~s
are transmitted to or fron the entIties specified by a
list item prior to the processing of any succeeding list item.
In
t h 'J ~; X nmp J f; ~
READ
(3)
N...
A(N)
two
values are read; one
3ssigned to ACN) for the ne~
is
~alue
assi Dned
of N.
to
n~
An Input fistl'Cern.1 or an entIty associated \-lith i t
and the second is
(18.1.3),
must
COHTROL DATA PRIVATE
13-20
Control Data Corporation Standard FORTRAN
,...
.........
~--
.....
-.-- ....
--
-.-.
not contain
83/06/30
----....------ .... ----_..----------------
.... ,... .......
--...
~ny
portion of the established format specification.
--
.... ...... ... ... - .... --.- ...... - .......
13.0 INPUT/~UTPUT STATEMENTS
13.9.5 DATA TRANSFER
...
~---
If an internal file has been specified, an input/output
not b e i nth e )c i I 0 0 r ass 0 cia t € d lad t h the f i Ie.
list
item
IT! u s t
A DO-variable becomes defined at the beginning of processing of the
ltems that constitute the range of an implied-DO list.
nn output, every entity whose value is to
be
transferred
must
be
dt1finad.
On input, an attempt to read a r~cord of a file conriected for direct
access that has not previously been written causes all entities
specified by the input list to become undefined.
During unformattad data transfer, data Are transferred without
editlnJ between the current record and the entities specified by the
input/output list. Exactly one record is read or written.
nn
input, tho fi Ie must be positioned so that the recbrd read is an
unformatted record or an endftJe record.
the number of values required by the input I ist
less than or equaJ to the nUmb!f of values in the record.
nn input,
must
be
On input, ths type or each value in the record must agree with the
type of the corresponding entity in the input list, except that one
complex value may correspon1 to tHo fAa) Jist entltias or two real
v 1 I u e.5 m' a Y (; 0 r res po n d too nee 0 ';H pie x J i s ten t i t y.. . . If H n en tit y i n
the input list is of type character, the'ength of the character
entity must aJree with the length of the character value.
v ,:1 I u e [;J a,;:' cor r t.! s P0 n d to
an
I n teo e r
or
r ea I f 1st
to either half of a douhle precision or complex list
entity; and an integer or real value, or either half of a double
p r (! cis ion 0 reo lil pie x val u e , m'3 yeo r r D S po n d to a no 0 t €: a n lis ten tit y •
Also, n BCI 0
'3ntlty:
or
, i..1~1 n
On output to a file connected for direct access~
the output
must not specify more values than can fit into a record.
list
'] n 0 u t put .1 if t h? f i I 0 I s connected r 0 r d I r ~ c tile c e S S r1 n d the va J u e s
sp·ecified by the output list do not f i l l the record,
the remainder
of the record is undefined.
If
th~
fi 10
is connected for
data transfer is prohibited.
formatted input/output, unformatted
The unit specified must be an external unit.
CONTROL DATA PRIVATE
13-21
Control Data Corporation Standard FORTRAN
83/06/30
----------------------------------------~~---------------~----------
13.0
INPUT/OUTPUT STATEMENTS
13.Q.5.2 Formatted Data Transfer
Durina form1tted data tran~fer, data are transferred with editing
between the ent4ties specified by the input/output I ist and the
f i Ie.
The cur r en t r e co r d and po s si b J y add j t i on a 1 r e cor d s are rea d
or nritten.
On input, the fit9 ~ust be positioned sO that the record read Is a
formatted record or an endfile record.
If the fi lu is connected for
datn tr£nsfer Is prohibited.
If
a
form~t
(14.3)
is
specification
unformatted
has
been
input/output,
formatted
est2bllshed, format control
described 1n 14.3
irlitiated and editing. is performed as
throu!Jh 14.5.
:1 n
i n put J
t h i?: i n put lis tan d ·r 0 r mE: t s 11 e c i fi cat ion it U $ t not r e qui r e
more cbnr3ct<:;!rs 'from a record than the record contains~
If the fite
~s
connected for direct access,
the
record
number
is
increased by one tlS each succeedIng record is read or Hritten •.
On output, If the file Is connected for direct access or Is an
internal fite and the characters specified by the output I ist and
format do not f i t l 8 record, blank characters ere added to fill the
r'?cord.
nn
output, if the fi 1e is connected for direct access or
is an
internal
fila,
the output Jist and ?ormet specification must not
sneclfy mora characters for a record than can fit into the record.
If I ist-diracted formatting has
performed as described In 14.6.
been
est~bIJshed,
editing
Is
The transfer of
;
-
inrormatlon in a formatted record to certain devices
determined by the processor is called llIlo11oD.
If a formatted
record is prInted, the first character of the record Is not printed.
The remaining characters of the record, if any, are printed in one
lin~ beginning at the left margin.
Tho
first ch3ractor
or
such a record determines vertlczl sPQcing as
follows:
tONTROl DATA PRIVATE
)
13-22
Control Data Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------13.0 INPUT/OUTPUT STATEMENTS
13.9.5.2.3 PRINTING OF FORMATTED RECORDS
+-----------+----------------------------------+
: Character: Vertical Spacing Before Printing:
+-----------:----------------------------------+
: One Line
Blank
o
1
:
THO Lines
: To First Line of Next Page
NoAdvanc(~
+
+-----------+--------~----------------~--------+
If there are no characters in
spacing
is
the record (14.5.4), the vertical
one line and no characters other than blank ere printed
in that lintJ,
A pRINT statement does not imply that printing will
occur,
WRITE statement does not implY that printino wi 11 not occur.
and
a
If an end-of-fi1e condition exists 25 a result of reeding an endfile
record~ the file is posItioned after the endfiie record.
I f no err 0 reo n d i t ion 0 r en d-o f- f i 1 e con d it ion ex i s t 5, the f i l e i s
positioned
after the last record rnad or Hritt12n and that record
becomes the prece~ing record. A record written on a file connected
for sequential access becomes the last record of the file.
If
the file is positioned after the endflJe record, execution of a
transfdf input/output statement Is prohibIted.
However, a
BACKSPACE or REWIND statement may be used to reposition the file.
~Bta
an~1rror
ind~termlnat'2.
If
condition
e~y.ists,
the
position
of
the
file
is
If the data transfer Input/output statement contains an Input/output
status specifier, the integer variable or array element l~s becomes
defined. If no arror condition or end-of-file condition exists, tho
value of Ins is zero. If qn error condition exists, the value of
iQ~ is positive.
If an end-of-file condition exists and no error
Gondition exists .• the value of ins. 'is nOJativc.
13.10
AU~lLIAEY_l~2UllJUI£UI_S!AIEHEUIS
13.10.1
QeE~_SIAIEtlEMI
An OPEN st~tement maY be us~d to connect (13.3.2) an c~isting file
to a unit) cra~te a file (13.2.1) that
Is preconnected,
create 8
'file and connect it to a unit, or change certain specifiers of a
connection bctHeen a fi Ie and a unit.
CONTROL DATA PRIVATE
13-23
Control Data Corporation Standard FORTRAN
83/06130
.... ..... -- ...
........................ ..... ----------.--------------------.------ ---------------13.0 INPUT/OUTPUT STATEMENTS
~
-
----~-
o~")~n
13.10.1
STATEr1ENT
------------------~-------------------------------~~----------------
The form of
~n
DP[N
where
OPEN statement is:
Calls.t)
is a list (2.11) of specifiers:
Qll~!
(UN I T =3 .u
lOST AT = ilLS
ERR = So
FILE = .flo
STATUS = !i!.a
ACCESS = 11££
FORH= fEl
REel = r.1
BLANK = h!nb:
BUFL = h1
+---------------+
n!lst must contain exactly one external un1t specifier (13.3.3)
T h~
0
the r s p I;.~ c , fie r s
IOSTAT
and
at most ono of each of the other specifiers.
nl'-'Y contain
are des c rIb e d as
f 0 I low s
:
= lQS
Is
In input/output status specifler (13.7). Execution of an
OPEN statement containing this specifier causes ins to become
dafined t-!ith a zero value I·r no error condition exists or
with a processor-dependent positive integer value if an error
condition exists.
is an error specifier (13.7.1).
FILE
= tio.
flo
t
r~:li
is
character
a
scalar expression whose value when any
1 i n 9 b' un k $ ! ) r e r efTll) v e d is the nit me
or
the
f i 1 t?!
to
be
connected to the specified unit.
The alph3betic case of
letters in the value of the character expression is not
significant. The file name must be a name that is al lowed by
thfl procc~ssor.
If~ this spec~fler
Is ol!lltted and the unit Is
not
connected
to a file,
it becomes connected to a
pro c e s s 0 r - d e t e r min e d f i Ie.
( See a 1s 0 13.1 0 • 1. 1 • )
The processor dotcrmines a file name from the unit
folloHS
)
If INT(y} has
3
specifier
y
as
value representable by the digit string 0 in the
CONTROL DATA PRIVATE
'\
13-24
Control Data Corporation
Standar~
FORTRAN
83/06/3,0
13.0 INPUT/nUTPUT STATEf1ENTS
13.10.1 OPEM STATEMENT
-------------------------------------------------------------------range 0-999,
tho fi
I~
nama is TAPEn.
If BOOL(y) has a value of the form LUi U .,
where f
is a va' i d
system fi Ie noma starting ~ith a Jatter, the file name is f.
f i Ie
tnccept in tHO cases: If BOOL(U) has the,value L"INPUT" the
name
is
IHPUT" and if BOOl{ll) has the value L"OUTPUT" the file
name is OUTPUT~ Upper and lower case letters in the
are interpreted as variants of the same Jetter.
file
name
otherBise, the unit specified does not exist.
STATUS
= ~!:E
Si3 is d scalar character expression Mhose value when any
trailing blanks are removed is OLD, NEW, SCRATCH, or UNKNOWN.
The alphabetic c~se of letters in the value of the character
expr3ssion is not significant. If OLD Or NEW Is speclfied, a
FIlE= specifier must be given.
If OLD is specified, the file
must exist.
If NEH is specified, the file
must not exist.
Successful
t!xecuti on of an OPEN statement ttith NEW specified
cre3tes the file and changes the status to OLD (13.10~1.1).
If SCRATCH is specified with an unnamed file, the file is
connected to the specified unit for use bY the executable
prOOf'am
but is deleted (13.2.1) ~t the ,execution of a CLOSE
state~ent referring to the same unit or at the ~ermination of
the executable program. SCRATCH must not be specified with a
n a nH~ d f i I ,~ • I T U1-1 KNO viiI iss P ,1;! C i f i~ d -' the s t tl t us i s pro c e S S 0 r
dependent.
If this specifier
Is
omitted ...
A,
value of UNKNOWN
is assumed.
ACC~SS=
.af£&.
is a seuler character expression whose value when any
trailing blanks are removed is SEQUENTIAL or DIRECT. The
dlphabetic c~s~ or letters in the value of the character
expr~~ssion
Is not slgnlfic2nt~
It specifies the access
method for the connection of the file as being sequential or
direct (13.2.4).
If this specifier is omitted, the assumed
V3JUB is SEQUENTIAL.
For an existing file,
the specified
access method must be included in the set of allowed access
methods 'for the fi Ie (13.2.4). For a ne\oI fi I e, the processor
cr;~'at:)s
tho fi Ie wi th a set o'r alloued access methods that
i nc , u rJ t2' S t h,e S!,C c t fie d PH: tho d.
~CG
FORN
= fm
tm is a scalar character
expression whose value when any
b I an 1< s
are rem 0 v e d i s FOP. t'l ATT to, UN FOR i" AT TEO, 0 r
BUFFERED. The alphabetic case of letters in the value of the
c h '\ rae t €: r J ~{ P r ,~ s s jon i s not s i J n if I can t • Its pee I f J est hat
the 'Pi Ie Is being connected for
formatted,
unformatted, or
t r :.-) i i i n g
conTROL DATA PRIVATE
13-25
Control Data Corporatlon Standard FORTRAN
83/06/30
-------------------------------------------------------------------13.0 INPUT/OUTPUT STATEMENTS
13.10.1
OP~N
STATEi'1ENT
input/output, respectively. If this speclfJer
is
omitted,
a value of UNFORMATTED is assumed if the file is
b e i n J C on nee ted 'f 0 r d i r3 eta c C~ s s ... an d a v fa 1 lJ e 0 f
FQ RnA TTE' 0
is assumed
if the file
is beinu connected for sequential
access. For an ex i s tin gf i Ie, the specified form must be
included in the set of alloHed forms for the file (13.2.2).
For a neN file, the processor craates the file with a set of
allow~d forms that includes the specified form.
burf~r8d
REel
=
£01
£l
is a scalor inteJer expression whose value must be
positive. It specifies the length of each record in a file
being connected for direct access or for formatted sequential
acceS3.
If the 'ita is being connected for formatted
input/output~ the length is the number of characters.
If the
file
is being connected for
unformatted direct
access
input/output ... the lenJth is mensured in processor-dependent
units. For 3n existIng file,
the value of ~l must be
included in the set of allowed record lengths for the fi Ie
(13.2.2). For J new file, the processor creetes the file
with a set or allowed record lengths that Includes the
specified value.
This specifier must be given when a file Is
beinJ connected'for direct access.
BL Af·1K ,= hlali
scalar character expression whose value when any
are r em 0 v e dis, NUL Lor Z ERD.
The
a I ph abe tIc,
case (If J;~ttf-!rs in the value of the character expression is
not significant.
If NULL is specified", all blank
characters
in numeric formatted input fields 'on the specified unit are
i g n () r i~ d, .e x c cpt t h ,(1 t n fie' d 0 r 11 I b 1an 1<5
h 3 S a val u e 0 'f
zero.
If ZERO is specified, all blanks other than leading
bJanks are treated as zeros. If this specifier is omitted, a
vafu'1
of NULL i!:": assumed. This sP€cifi~;r is permitted only
for u file beinJ connected for formatted Input/output.
hlD~
is
a
t r a i i i n 9 b':) n J( s
The unit specifier is required to appear; a11 other specifiers are
opt i on ai,
e :'. c ~ p t
t h1 t t h (~ r e cor d Ii; n :.J t h r.:.l mus t b e s pee i fie d I f a
file is being connected for direct access. Note that some of the
specifications have an assumed value i f they are omitted.
Th9 unit spooificd must exist.
connected byexecutlon of an OPEN statement in any
connected, may be
referoncad in any pro0r~m unit of the executable prODr~m.
A
unit
may
be
prooram unit of an executable program and, once
l]UFL:::hl
CONTROL DATA PRIVATE
13-26
Control Data Corporation Standard FORTRAN
.--.
................ _--- ... .- ..........
13.0
83/06/30
...",.-
... ----------------------------------------------------
INPUT/OUTPUT STATEMENTS
1 3 • 10 • 1 D? EnS T AlE:-' EN T
---------~----------------------------~------~-----~----~-----------
hI Is an integer or Boolean expression.
The value of INT(hl)
must be nonnagative andspocifies the buffer length (15.1.1).
unit is connected to a fi Ie thnt exists, execution of an OPEN
Is permitted. I f the FILE: specifier Is not
inc 1 uded in the OPEN statement". the fi I e to be connected to the uni t
is the same as the file to which the unit is connected.
If
a
statement 'for that unit
If the fi Ie to be connected to the unit does not exist, but
Is the
the fJ Ie to Hhlch the unit is preconnected, the properties
specified by the OPEN statement become a part of the connection.
same
oS
If the file to be connected to the unit is not the s~mc as the fife
to which the unit Is connected,
the effect is as if a CLOSE
statement (13.10.2) without a STATUS: specifier had been executed
for the unit immediately prior to tho execution of the OPEN
statement.
If the file to be connected to the unit is the same as the file to
Vlhich the unit is connf.~ctt;:d, only thf.! BLANK= specifier may have a
v. ~ J u a d i ff ere n t ·f r 0 In t h ~ 0 nee IJ r r en tty i n fJ r·f (! ct.
Ex e cut Ion of the
nPEN statement causes the new value of the BLANK= specifier to be in
effect. The position of the fi Ie is unaffected.
If a fi Ie is connected to a unit, execution of an OPEN statement
on
that fi Ie and a different unlt is permitted. The effect is that the
f i I e becomes conn~cted to more than on e uni t.
A CLOSE
statement is used to terminate the connections of
particulRr fila to the unit or units to which it is connected.
Th9 form of
3
CLOSE stJtement I
CLOSE
where
~!ll~t
..;:
II'"
a
.
•
(Qll1~.t)
Js a list (2.111
or
specifIers:
+---------------+
[UN IT:]
!J
IOSTAT
ERR : s
I·
= lQS
: STATUS:
s±a
:
+---------------+
ulllst must
~ontein e~act'Y one external
unit specifier (13.3.3) and
may contain at most one of each of the other specifiers.
CONTROL DATA PRIVATE
\
13-27
Control Data Corporation Standard FORTRAN
83/06/30
.--.._ .....................
-- ... _- ................ .- .... ---------------------_._------------------------:--------
13.0 INPUT/OUTPUT STATEMENTS
13.10.2 CLOS:: STATi:i-1ENT.
The other spncif iers are describeo as fo Ilows:
IOSTAT
= lQ%i
Is an input/output status specifier (13.7).
Execution of a
containing this specifier causes 19~ to
becoma d~fined ~ith a zero valug if no error condition exists
orrith a processor-dependent positive integer value If an
error condition exists.
CLOS~
ERR
statement
= So
is an error specifier (13.7.1)
STATUS
= s.t.n
SiB is a
whose value when any
KEEP or DELETE.
The
alphabetic OnSE! ot letters In
the
value or the character
expression
is
not
significant.
st~
determines the
disposition of the file that Is connected to the specified
unit.
KEEP must not be specified For a file whose status
prior to execution of the CLOSE statement is SCRATCH.
If
KEE~
is specified for ~ fl I~ that exists, the file continues
to exist after the execution of the CLOSE statement. If KEEP
is specified for a fi1e that does not exist, the file will
not ~xist after the ex~cution of the CLOSE statement.
If
DELGTZ".:
is specified, the fJ I€! Hill not exist £lfter execution
of the CLOSE statement. If this specifier is omitted, the
assumed value is KEEP,
unless the file status prior to
a x u cut i on of 't h e CLOS Est ate mt:~ n t i s S CRAT CH,
in
~J hie h
cas e
the ussumed value Is DELETE.
trailing
2xecution of a
~n1 program unit
progra~'1
sa::1f1
character expression
hlanks
arc removed is
sc~lar
statement that refers to a unit may occur in
or an executable program and need not occur In the
unit as the execution of an OPEN statement referring to
CLOSE
thai: unit.
Ex~cution or a CLOSE statement specifying a unit that does not exist
or has no ftle connected to It Is permitted and affects no file.
After a unit has been disconnected by execution of a CLOSE
statement, i t mny be connecte~ again within the same executable
prOJr,HrI, elth'3r to tha same -rIle or to 3 different file.
After 'a
file has been disconnected by execution of a CLOSE statement, it may
be connected again within the same executable program, either to the
.5arn~! unit or to a Jiff;"]ront
unit,
provided
that
the
file
still
exists.
If
a
fi Ie
is connected to more than one unit, the CLOSE statement
t 0 ~:!n y 0 n8 0 'r the s e lJ nit S il i t h t h Po sam e e 'r- f e, c t : e e c hUn i t
Fl a y ref ,~~ r
CONTROL DATA PRIVATE
Con t r 0 I . D ;:\ t:1
Cor p 0 rat ion, S t ?. n dar d F rJ RTRAN
83/06/30
INPUT/nUTPUTSTATEnENTS
13.10.2 CLOSE STATEMENT.
13.0
-------------------------------------------------------------------is disconnected.
At termination of execution of an executable program for reasons
th,:]n nn error condition, :11 J uni ts that are conn€cted ere
closed. [ach unit Is closed w"fth status KEEP unless the file status
prior to termination of execution was SCRATCH, in which case the
unit is closed with status DELETE.
Not~
that tha effect is as
though a CLOSE statement without ~ STATUS= speclfler were executed
on each connected unit.
other
An INQUIRE stntement maY be used to inquire about properties of a
particular named fi Ie or of the connection to a particular unit.
Th;Jrf~ are tHo forms of the INqUIRE statement: i nqui fe
by
fi 1e
and
Inquire
by
unit.
AI I value qssJgnm~nts are done according to the
rules for, as.signment statements.
The INQUIRE statement may be exacutcrl before, whi Ie, or after a file
is connected to a unit.
At I
values assigned by the INQUIRE
statement are those that are current at the time the statement is
executed.
The form of an INQUIRE by file statement
is:
InqUIRE Cl!ll:ltl
Hhere
1~!xr1ctly
is
Ifl1~.t
one fi
a
list
specifi'~r
cont~ln at
J(!
The Ifllst may
described in 13.10,3.3.
(2.11) of specifiers that must contain
Bnd may contain other inquiry specifiers.
most one of e~ch of the Jnquiry specifIers
Tho form of a file specifIer Is:
FILE
= fln
.fin is a char,]cti)r expression ::fhose value Hhen any trEliJJng
blanks are removed specifies the name of the file being inquired
about. The named file need not exist or be connected to a unit.
The valuo or flo must be of a form acc~ptnble to the processor as a
file name.
qh::!re
Tilt:; form of an INQUIRE by unit stateMent
I ~'1 QU IRE
Is:
(1!!11~.t)
CONTROL DATA PRIVATE
13-29
Control Data Corporation Standard FORTRAN
83/06/30
13.0 INPUT/DUTPUT STATErlENTS
13.10.3.2 INQUIRE by Unit.
------------------------------------_._----------------_._----------where
lUllst is a
1 ist (2.11)
of specifiers that must contain
external unit specifier {13.3.3) and may contain other
inquiry specifiers. The l~llst may contain at most one of each of
th;:! inquir./ specifiers df:5cribed in 13.10.3.3. Tht unit specified
nf:ed nut exist or be connectE~d to a file·,
If.lt is connected to a
Fi Ie,
the
inquiry is being made about the connection and about the
file connected.
.ex3ctly
one
The folloHinJ
inquiry specifiers may be used in either form
of
the
INQUIRE statement:
+--------------------+
H1STAT =
ERR =
EXIST
lQ~
S
= !!~
or EllED = nd
NUNBER = DUID
NANEO = Dmd
Nfd1E =10
ACCESS = a~t
SEQUENTIAL = s..eg
DIRECT = dlr.
FORi-' = fm
FDRHATTEO
= fmt
un FORt·1ATTEO
ReCl = Ln!
N2XTREC = u£
Bl AI,lK
= !lnt
= b.lnll
I
I
+--------------------+
Tha spccifiQfS are iescrihed as
folJo~$:
= lQs,
IOSTAT
is
Jf1 input/o t.1tput status sp;eci'fi\~r (13.7).
Execution of an
INQUIRE statement containing this
specifier causes 19~ to
bee 0 rn c d c~ fin \!. d 'd i t h 6 z~~ r 0 I( a I u;! if no 1.:: r r 0 reo n d i t ion e x i.s t s
o r wit hap r \) c ~ s S .0 r - d e p f~ n den t p os i t 1vel n t e g e r val u e if an
error condition exists.
ERR
=~
is an error specifier (13.7.1)
EKIST
= g~
is a looical variable or 1i)glcal array clement.
Execution
of an INQUIR~ by ·fi Ie statement causes .e~ to be assigned
the
'19lun
true
if there exlsts;3 file Hith the specified name;
~A
COtlTROl DATA PRIVATE
13-30
Control Data Corporation Stand3rd FORTRAN
83.106/30
-------------------------------------------------------------------13 • 0
I NPUT I':] U T PUT STAT Eil E NT S
13.10.3.3 Inluiry Specifiers.
other~'Jisc:,
fd~
iSJ5Sifmed the value false.
Execution
of
~an
INQUIRE
tru~
by unit statement causes ~x to be assigned the value
if the specified unit exists; otherwise, ~~ is
assigned
the value false.
OPENED
= no
12!l j.s a log 1 c a I v ~t ria b J e '0 r, log i c a' a r ray e J em en t • Ex e cut ion
of an INQUIRE by of i I e statement causes .Q.Q to be ass i gned the
vaJue true if the file specified Is connected to a unit;
otherwise, Qd is .assigned the value false.
Execut.ion of an
IN qUI REb y un I t s tat em () n t C;J US ~1S Dr! to b!.) ass i 9 ned the val u e
true i f the specified unit is connected to a file; otherwls~,
Q~ is assigned the value false.
NUNBER
= n!J~
an integer vari~ble or int~ger array element that is
the value of the externaJ unit identifier of a unit
that is currently connected to the file.
If more than one
unit is currently connected to the file, the
choice of the
unit ~sed to assi]n a vatu! to Dum is as dtscribed below. If
there is an external unit identifier ~ currently connected to
the fi Je such that either
Q!HIl
is
~sslJned
(1) INT(u) h'ds a valur! in the range 0-999, or
(2)
BOOL(l1)
has a value of the form L"TAPEk", t,lhere 15 is
i nth era n 9 e 0-999 wit h no I e a din g z e r 0,
ani n t e 9 e r
the nth e val u e ass i 9 ned ton!J l!l ]fr i I I b e i n t h e r a n 9 e 0- q 9 9 •
(In c~se (1) the value asslgned to Dum Is the value of U, and
in case (2)
it is the value of k.
If external unit
ident'Ff(~rs
0f both
tYPt~S
(1) and
(2)
are currently connected
to the file, the processor may assign either a type (1) or a
type (2) value,) Otherwise, the value assigned to OYID is of
t h ~7! for OJ I N T ( L "f. n ), H her? f Is;;} V 3 lid s y s t e r~l f i len a n-, e •
NAi'lED
=
am!!
omrl is a IODle,,! vo.riabJe or logical array
eJement
that
assianed the value true if the File has a name; otherwise,
is ~ssigned the value raIse.
I'IANE
is
it
= fn
tn is a character vari3bJe or ch~racter Grrf.'.yel'cment that is
f::. 3 sf :J n ,~ d t h t~ va I u e of the na rn . ~.
(if" t h ef i 'e, I f the 'f if c h as a
name; otherwi se, it becomes undef i ned. If the name of the
file
contains alphabetic cheracters they wil I be returned In
upper case. Note that if thIs specifier appears In an
CONTROL DATA PRIVATE
Control Data Corporation Standard FORTRAN
13.0
13-31
ItJ.PUT/nUTPUT STATEf'lENTS
13.10.3.3 Inquiry Spe.cifiers.
INqUIRE by fi Ie statement, its value is not
necessarily the
some as the nam~ given in the FILE= specifier. For example,
the processor may return a fife
name qualified by a user
identification. However, the value returned must be suitable
for use 3S the yclue of A FILE= specifier in en OPEN
s tatelflent.
ACCESS
=
E~~
is
d ch.ar'lcter Vl\f i ab leo r ch3r acter srr Ey element that·
is assigned the value SEQUENTIAL j f the fi Ie Is connected for
sequential access, and DIRECT if the fi Ie is connected for
direot access.
If thore is no connection, 3~~ becomes
undefined.
.a~!.;i
SE!'~UcHTIAL
= Sft!J
a character variable or character array element that
if SEQUEliTIAL is
included in the
set of allowed access methods for the file, NO 1f SEQUENTIAL
is not included in the set of allowed access methods for the
f i I e J a n dUN I( 11 n ~1 N i f
the pro C e s s a r i s u nJ b I ~:l t 0 d e t e r min e
.1'hethcr or not SEQUENTIAL .Is Included In the set
o·r allowed
access rn e tho d 5 for the fi Ie.
is
~gg
is assiqned the value YES
DIRECT
= rtlr..
UIL is a chAracter variable or character array element that
is assigned the value YES if DIRECT is included in the set of
Rllo:'i~f1
c;cc:~ss
methods for the file' NO i f DIRECT Is not
Included In the set of at lowed access methods for the file,
and UNKNOWN if the processor is unable to determine whether
or not DIRECT i~
incltJd(~d
in
the sat
of
a1 'o,.~ed
access
(T! e t h (' d s
-f 0 r t h . ~ fit e •
FOR 1'1
= fill
fw is a
charact~r variable or character array el~ment that ts
a S5 i 9 ned the val u e FOR l1 AT TEO t f the f j I e 1S con n e c ted for
formatted input/output, UNFOR~ATTED if the fi 13 is connected
for unformatterl input/output, and BUFF[RED if the file Is
connected
for
buffered lnput/output.
If there is no
connection, Lm becomes undefined.
FORI1ATTED
= f211
!mt
is a character varinble or character array element that
Is assJgn@d the value YES If FORMATTED Is Included in the set
of allowed forms for the fi I c,
NO if FORMATTED is not
inc 1uded in the set 0 r ~ 11 oHed forms for th<.) f 11 0, and
UN K N 0 \-11'1 i'f t h~) pro C~ S S 0 r I S \J nab I (: t Ci
d e t € r n i new h e the r
0r
CONTROL DATA PRIVATE
f)at'~i Corporation
Control
13-32
Stflndard FORTRAI4·
63/06/30
-------------------------------------------------------------------13.0 INPUT/OUTPUT STATEMENTS
13.10.3.3 InquIry Srecifiers.
not F q RHAT TED i sin c I u de din
f i Ie.
t h (.!
set
0
·f a 1 I 0 He cl for ms f 0 r the
= uof
UNFORMATTED
uoI
is a character variable or character arrey element that
is assigned the value YES if UNFORMATTED is included in the
set
of 61 J owed 'forms for the fi J e, NO j f UNFORNATTED is not
inoluded in the set o~ allowed forms for the fl Ie, and
UNKNOWN
If
the
procesSOr is unable to determine whether 6r
not lJNFORNATTEO is included in the set of allowed forms for
thc~
REeL
fil(-l;.
= !.til
is an integer varinble or integer array clement that is
ass ion r;.: d the val U 1;: () f the r e co r die n 9 thor the f i I e con nee ted
for direct access.
If the file is connected for formatted
input/output~ the length is the number of characters.
If the
file is connectod for unform?tt~d input/output, the length Is
me8sured in processor-dependent units.
If there is no
connection, £~l becomes undeflned.
(Go!
= OJ:
HEXTREC
OJ:
is
iin
intoger
v?ri~ble
or integer ;array element th(lt Is
assigned the va1ue n+1, where n is the record number
of the
last
record read or Hritten on the fi Ie connected for direct
;lcces.s. I f tha fi J e is connected but no records have been
read or written since the connection, DL is assigned the
value 1. I r th(!f i I e. is not conn cctf:!d for direct access or
if the
posltinn of the flJe is indeterminate because of a
previous error condition, n~ becomes undefined.
B L AtH(
=
b.lu1s.
hlok Is a character variable or character array. e1ement
that
is assigner! th~: value NULL if null hlank control is in effect
for the ·r118 connected for ffJri1l;~tted
input/output, and is
assioned
the value Zi:RO if zero blank control is in effect
for the file connected for formatted input/output. If there
is no connection, or If the conncctlon is not for formatted
input/output, hlok becomes undefined.
v:'·, r i ':'& b I (: 0 r a r r :;l y e I ~~ m£~ n t t h::} t i s us f~ d a s asp e c i r t e r
1n . an
INQUIRE statement~ or any associated entity, must not be referenced
by any other speci"fi er in the same INQUIRE stntement.
t\
E ~;~cut i on of an
v,riables
or
INqUIRe
·sr rd.:/
by
fite
statement
causes
the
specifier
8' ements OI!!.d, fa! S2!l.t ni!.! Im.t, an d !Jnl to be
corlTROL DATA
PRIVATE
13-33
Control Data Corporation Standard FORTRAN
83/06/30
............... .-- ..... - ... - .... --. ... ..- ............ -----------------------_._------------.---.-----------
13.0
INPUT/OUTPUT STATEMENTS
13.10.3.3 Inquiry Specifiers.
-------------------------------------------------------------------assigned values only if the value of flo is acceptable' to the
processor 3s a fi Ie name and if there exists a fi1e by that name;
otherwise, they become undefined. Note that Dum becomes defined if
and only i f Qrl becomes defined with the value true. Note also that
the specifier variables or array elements a&c~ f~, LeI, OL, and h!nk
may be com e d e fin e don 1y i f .Q.Q be com e s de'f i ned wi t h the val u e t rue.
ExecutIon of an INQUIRE by unlt statement causes the specifier
variables or array elements DllID] nmrl, In, 3~~' s~~, ~lL' fm, fm~,
un!, LG1~ D~' and h!D~ to be assigned values only if the speclfled
unit exists and if a fi Ie is connected to the unit; otherwise,
they
become undefined.
If
an error condItion occurs during execution of an INQUIRS
statementJ all of the inquiry specifier variables and array elements
exc~pt lQ~ hocome undafine~.
Note that the specifier variables or array elements gX and Qd always
he GO In '3 d e fino cl t..J n I e 1) san err 0 reo n d I t 1 0 n 0 C cur s •
The forms of the file positioning statements are:,
BACKSPAC2 II
BACKSPACE C311s±)
ENDFIlE
!oJ
Cl1DFIL2 <.a115.:1:)
REv/IND !J
~'Ihere:
II
is an external
nllst 1s a list
unit identifier (13.3.3)
(2.11) of specifiers:
+--------------+
[UNIT
!.l
=]
:
IOSTAT
: ERR
= So
= lns. :
+--------------+
- .
must contain exactlY one external unit specifier (13.3.3)
contain <:It most Onl:.1 of ~1,anh of th~ oth~1r specifiers.
~llst
m~}'
and
The external .unlt specified by a BACKSPACE, ENDFIlE, or REWIND
statement must be connected for sequential access.
conTROL DATA PRIVATE
13-34
Control Data Corporation Standard FORTRAN
83/06/30
_
_.......... _-- ............ ....................... --------------------------------_._---------------13.0 - INPUT/OUTPUT STATENENTS
13.10.4 FILE
POSITIONI~G
STATEMENTS.
~-~--~~~-~-~-~-~---~~-~~----~-~~--~~~-~~-----~~~~----------------~--
Execution of a file positioning state~ent containing an lnput/output
status specifier causes lQ~ to become defined with a zero value if
no error condition exists or Hith a processor-dependent positive
integer value if an error condition exists.
Execution of a BACKSPACE statement causes the file connected to the
specified unit to be positioned before the preceding record.
If
thore is no preceding record, the position of the file is not
Ch3nged.
Notf:: thBt if the prt~cedlng record Is
an
endfi Ie record,
the file becomes positioned before the endfile record.
Backspacing
prohibited.
a
file
that
is
connected
but
does
Backspacing oyer records written using I ist-directed
prohibited.
exist
is
formatting
is
not
of an ENDFILE statement writes an endfi 1e record as the
next record of th~ fi Ie. The "fi I~ is then po.sitionl~d after the
endfi Ie reCDrd.
If the fIle may 31so be connected for direct
access, only those records before the endfile record are considered
to have been written. Thus} only those records may be read during
subsequent direct access connections to the file.
~xecutlon
After execution of nn ENDFILE statement..- a BACKSPACE or REWIND
statement must be used to reposition the file prior to execution of
nny data tran~fer input/output statem~nt.
Execution o? an ENDFILE statement for a flle that Is
does not exist creates the ftle.
Execution of a REWIND
positioned;lt its initif11
pos'itloned
nt Its inltl:]1
effect on the position of
connected
but
statement causes the specified file to be
point. Note thf3t i f the filf.! is already
point, exr:~cutJon of this statement has no
the fi Ie.
execution of aRE WI I',l D s tat e men t f 0 r :J f i In t; hat
d 0 (; S not -a)( i s t i s per mit ted but has no (: fIf e ct.
is
connected
but
A function must not he referenced }llthin an expression appearing
In an Input/output statement if such a reference causes an
input/output statement to be executed. Note that a restriction in
t h t:~ e val un t ion 0 f 11)< P r ~) $ oS ion s (<>. 6 ) p r (.l h i bit s c 'e r t a j n sid e e f fee t s •
an~IHhere
CONTROL DATA PRIVATE
13-35
Control Data Corporation Standard FORTRAN
83/06/30
-------~---~--------------------------------------------------------
13.0 INPUT/OUTPUT STATErlF.NTS
1 3 • 1 2 RES TRIC TID N 01'\ I HP1.1 TID tJ TPUT S TAT Ef'i E NT S
_._--------------------_.
__
._-------------------------- -~----~---------
If a unit, or a file con,ected to a unit, does not have all of the
properties required for the execution of certain input/output
s tat em en t s , tho .s est ate men t s mus t no t ref e r to the un it.
NAMElIST provides formatted input/output
e d i t i no (14. 7) •
with
procEssor-determined
A tlAtl£LISI_g£QUll_Uamg provides the means of referring to a NAMELIST
input/output list. Usage of a group name is the means of specifYing
I~AHElIST
formBtt InD.
A NAr'1ElIST statement
NAMELIST group name and the input/output
list
associsted with that group
is used to speci fy a
to be subsequently
name.
1": I) r In H ttl n a i s est q b I J s 11 e d for a n I n put / 0 u t put d a tat ran s f er
by us i n 9 a itA I,' ELI ST 9 r 0 up n am e as the for mat j den t i fie r fin a R1: AD,
HRITE, PRINT, or PUnCH s"catement (13.4 (6)). The statement must not
include an input/output list.
1'-1 All ELI S T
The form of a
NAMELIST
where:
NAMELIST statement is:
/~LeDam~1
gLenam~
nlQlisl [/QLRnama/ ninllslJ •••
is a NAMELIST group name.
Only one appearance of a
Droup namB in all of the NAMELIST statements of a
proararJ unit Is permitted. A"group name of END is
prohibited.
niQl1~1
is a NAMELIST input/output list of one or more
Items, each of which must be one of the following:
(1) A vari able name
(Z) An array name
( 3) A v I r t u a I (I DEN TI F Y) a r r a ~' n am e
)
Each name in the list Dln!ls1 may be of any data type.
nlQll:::.t may not contain the n?'1e o"ran .Jssumeo slze array.
)
)
CONTROL DATA PRIVATE
Control
Dat~
13-36
Corporation Standard FORTRAN
83/06/30
13.0 INPUT/OUTPUT 5TATEnENTS
13.13.2 NAMElIST DATA TRANSFER
------------------------------------------------.---------------------
A UAtlELISI_hlnnk is one or more formatted records that consist of a
sequence of characters in NAMELIST format (14.7). Execution of an
input/output d<;lta transfor st~toment !;,ith tlAN::LIST formatting causes
one NAMELIST block to be transferred.
Execution of a WRITE, PRINT, or PUNCH statement with NAMElIST
for mat tin J C ~H.l S \~ son e t, \ AHE LIS T b 10 c k t 0 b e ~"r Itt en t 0 a 'f i , e •
Da t a
are trensferred from Internal storace in the order specified by the
input/output list associated with the NAMELIST group name that
app~ars in the output data transfer statement.
Execution
or
a
fl AHe LIS T b I 0 c k t
0
READ statement with NAMELIST formatting causes one
T he NAHE LIS T 9 r 0 u p n am e i n
b ere ad f r om a f I Ie.
must be the! $,3f1Hl
the block rnad
ss the group nam~: in the READ
statemont b3ing executed. Each variabJe or array name in the block
must appear in the input/output list associated with the group name.
I t em n am e sin the b 1 0 c k may 0 C cur ina ny
0 r derand
n u mbe r •
Not e
thJ'C
an
item
narne
may apP'1,ar more than once in ~l b.Jock, possibly
resulting in more than one definition of on entity.
The block is
transferred with NAMELIST editing (14.7) to internal storage in the
order of item name appearAnce.
Values ere transmitted to the
entities specified by the item. names. The definition status and
value of each entity whose name does not appear in the NAMELIST
block are unchanged upon completion of the transfer. Note that an
f.~ntity np.med in th:;J associ ~ted input/output Jist: but
not named In
thf~ NAflELIST b'ocI~ retains its prior de';:lnitJon status f)nd value.
On input, an error condition exists if the file is not positioned at
th,.! beoinnin:J of a HA:'lElIST bloc~(.
If the current NAf'lELIST bloch: Is
not t 11 e () n E: S pee I 'f i edt nth e P. EADs tilt e me n t J t he I n put f I lew i 11 b e
positioned forward to the NAMELIST block corresponding to the
.nAflELIST !jroup name in the READ statement. If the fila is inititlily
position£d precedin0 an endfilc record,
an end-oF-file conditIon
occurs and the actions specified in section 13.6 take place. If an
endfi Ie record is encountered Hhi Ie reading
or. "'hi Ie posi tioning
r- 0 r lHt r d s e .:;'l r chi n q for
a NAr1 Ell ST b I 0 c k , ~ n err 0 reo n d i t ion e xis t s
:, n <'j til':: act i Q n s s pe c i ~ I e ,'.I ins '3 c t Ion 1 3. 6 t~, k e p 1-'a C e •
The effect of executing a data transFer input/output statement
>,1 AnELI S T for 10 :.l t tin J i sot h !: n'" i s ~! as des c r i ~H~ din Sec t ion 1 3 • 9 •
Th~!
!":lltCODf:
.::tatemnnt
is
thf~
ext~nd~d
with
internel file (13.2.5) de-ttl
ls ·the extended
The forms of the
transfer out?ut statement.
The DECODE statement
internal
file data transfer
input statement.
statements are:
CONTROL DATA PRIVATE
Control Data Corporation
stan~ard
13-37
FQRTRAN
83/06/30
~-*-~~~~--~-~~--~------------------------------------- ---------------
'13.0 INPUT/OUTPUT STATEMENTS
13.14 ENC8D£ AND DECODE STATEMENTS
-------------------------------------------------------------------ENCODE (k, f, y)
wh er e:
[lQl1~iJ
k
is an unsigned integer constant or intuger variable
havino
a
positive,
nonzero value.
The value
specifies the number of characters to be transferred
to or from each record of the file identified by u.
f.
isa format specifier (13.14) which is specified
onia of the follot-iing:
(1)
as
The statement
labe1 of a FORMAT statement
that appears in the same program unit as
the format identifi~r
character array name or character array
section (14.1.2)
(2) A
!J
is an
i n t f.: rna I
f I 113
i
extended internal file
Inli~i
is an input/output list (13.8.2) specifying the data
to be transferred
d(~n
1: if i e r
( 13. 3. 3 )
for
an
Execution of an ENCODE statement causes values to be·transferred to
an extended internal file from the entities specified by the output
list lnl1st (if any) and the ~ormat Identifier f.
The execution
sequence,
restrictions and error conditions are as described in
Section 13.9 for a form~tted WRITE statoment that transfers data to
r~ n I n t ern a I f i Ie.
Execution of a DECODE statement causes values to be transferred from
'ln ext·'3nd€.1d i ntf;:!rnal fi Ie to the entities
SP(!cifl eel
by
the
input
1 1st lQ!ls~ (if any). Execution proce~ds as described In Scctlon
13. q for a formatted READ statement that transfers data from an
i ntE!rn'J I f i 1 e.
The
length of each record of an extended internal file is
established by the ~NCnDE statement that causes the file to exist by
~)f.!fining
or rfldef'ining it.
t~ot~
that the rncord length may he
c ha n g .~ d b ;~ sub seq ue n t r e :.J e fin I t Ion.
The r e cor dIe n Dt h i s
mea sur e d
in characters and
is the number of characters transferred. It is
.u*«~+7)/:J) characters, ",here II is the maximum numb 3r of
characters
that, can be represented by the processor in one numeric storage
un it.
t
Action is unspecified if t he to t: a I lcnJth of all records read or
written exceeds the number of numeric storage units of the file
(13.2.5.3).
CONTROL DATA
PRIVAT~
13-38
Control Data Corporation Standard FORTRAN
83/06/30
~~~~-~----~~~~-~-------------------------------------- --.------------
13.0 INPUT/OUTPUT STATEMENTS
13.14 ENCODE AND DECODE STATEMENTS
Action Is unspecified if any element of
"1ssociated (18.1) Hith the file.
IDllst is in the file or
is
f]n
output, a 'rOfFlat specification (14.1) that is in the fi Ie or is
associated (18.1) wlth the file must not be specified.
thqt an extended internal file may be definnd or redefined by
means other then an ENCODE statement~ such as a Boolean assignment
statement. Such means must ensure that the record length is
established as provided above and in Section 13.2.5.3.
Not~
The BUFFER IN anrl DUFFER OUT stat~ments initiate unformatted data
transfer. Program execution may continue 1mmedlately while the
transfer proceeds,
The forms of
!J
2
th~
is an external unit identifier (13.3.3) which is not an
asterisk
is el'l
v~lue
~l
statements are:
Inteaer constant or an Integer variable name.
~ is not significant
The
of
is a variable name or an array element name of type other
than character, bit or half precision. ~l specifies the
first entity of 3 storage sequence (In.1.1)
to be
transferred.
!in i s a v a ria b len nme 0 ran H r r :~1 y ':'~H e Hl e n t n n me 0 f t y p e 0 the r
thun
ch1ract(~r, bIt or half pr,ecJsion.
s.n specifies the
last, or possibly only, entity of a storage
sequence
to
b';! transflnrrcd.
of a BUFFER IN stetement Initiates the transfer of values
From one record of an unformatted external file to the storage
sequence sl,t.so. EX3cution of a BUFFER OUT stotemant initiates the
transfer of values From the storage sequence ~l.,.~n to one record
of an unforHlatti~d ,~~ 99Q.
ThH scale factor!:! contrc.ds th0 declpl1?1
-rl
.
(2-1), n( 'h')
•
•
•
+-----------------------+---------------------------+
where: h
is a blnnk
o
t h~! S C fi 1 '~1 fa c tor h as non f r e C tun I ~ ~ s the ma fJ nit \J d e 0 r the
to b8 edlt':.~d is outsld~; of the range that permits effective
use of F editing.
~ lot:;: t
d~tU\l1
it a t
A complex datum consists of a pair of separate rcal data; therefore,
the editlng is specified by two successivcly interpreted F, e,· 0, or
G crlit descriptors. The first of the e~it ~~scriptors specifies the
real rart;
the second specifies the imaginary pert. The two edit
descriptors may be diFferent.
Note that
nonrepeatable
edit
descriptors may appear between the two .successive F, E, D, or G odlt
CONTROL DATA PRIVATE
\
Control
Dat~
Corporation
stanrl~rd
FORTRAN
14-14
83/06/30
---------------------------------~---------------------------------ll~ • 0
F 0 Ri1 AT S ? EC IF I CAT I ,IN
14.5.Q.2.4 CDilPLEX EDITING
descriptors,
The Ltl edit descriptor indicates that the field occupies
~
positions.
The specified input/output 11st item must be of type
I (J DIe a I • 0 n J n put .' the lis tit·e m H ill bee 0 me d e fin edt' i t h '8 log i c a I
datum.
On output, the specifled list item must be defined with a
IOJlc.~1
dntutl.
Tho input fi~~ld consists of optional b)an}(s, optionally followed by
a
decimal point, followed by a T for true or F for false. The T or
F milY be fol tOHod hy r:lddition~1 characters ·in tho field. Note that
the logical constants .TRUE.
and .FALSE. are acceptable lnput
forms.
The output field consists of ~-1 blanks followed by 8.T or F, as the
value of the internal datum is true or false, respective1y.
The A[e] edit clescriptor may be us~d ~ili th en input/output I istltem
of type character C14.5.11.1), ~nd the A~ edit descriptor may be
used with ")f) input/output I i:.;t item o·r any nonch,qractor type except
bit (14.5.11.2).
I f a field ~'dth ~ 1s specified with
the
A edit
descrlptorl the
fieJd consists of ~ characters.
If a field width ~ is not specified
Hlth the A e'1lt descriptor, th·~ number of characters In tht:! fl€:ld Is
the len g tho f the c h a r act e r i n put / 0 u t pu t lis t i t em.
Let
be
the
lenoth
of the input/output list item. If the
sp~clfi~d Field width tl ~(.'Ir A Input 15 £lr~ater than or equal to li!D'
the rightmost lEn characters wi 11 be taken from the input field. If
t h (1 S pe c if i ,e :If t e 'd wid t his 1C 5 S than litn., the !:! c h:3 r ~ c t e r s will
appear
left-justified with 19D-;:! trailing blanJ{s in the internal
rE~prescntat ion.
19n
If the specified field width H for A output is greater than l~n, the
rut fie t d u i 1 l e o n sis t 0 f ::i-Ie 0 b 1~ n l~ s f 0 1 I 0 H e d by the l!!D
characters from the internal representation. If the specified field
tJiJth ~ is loss thJn or equal to len, the output field ~i I I consist
of the leftmost ~ characters from the internal representation.
o t.I t
)
When used with an input/output 1 ist item of noricharacter· type}. the
2:dit d':!scriptor indice.tes ch~ractr.;:r code conversion (Appendix A)
A'.:J.
cnNTROL DATA. PRIVATE
14-15
Control Dnt:l Corporation StBndard FfJRTRAf;;
83106/30
14.0 FQRt1AT SPECIFICATION
14.5.11.2 A Ed1tlnJ of Noncharacter Data
-------------------------------------------------------------------of 1:1 charqct8rs, Hith left justification and
The
field
this
U!:;
a lJ e •
trailing blank f i t l .
width specifier H must be a positive nonzero integer for
I nth :; f
0
I I 0 H i n &I, ·lU i s the Inn x i mum n tJ mb ere f
c hB rae t e r s
that can be stored in the datum at one time, and h is the number of
bits in a sinJle character storage unit.
On input ... If u Is Jess thunor equal to a~ the n(~xt 11 characters
from the record are converted to ~*b bits of character code, and are
suffixed with (a-H) character code blanks.
The
result
Is
transmitted to the noncharacter datum corresponding to the next
i np utI 0 u t put J i s t i t em. . 1ft: i s g r e nt :.;) r t h d n 2~
( l:! - .!l ) . c h a rue t € r s
from the input record are skipped;
the next 3 characters are
converted nnd tr!";nsmi tt;ed to the datiJm.
equ~:'ll
to,S.1 the
leftrtost
(most
IF!! i 51 ess th an or
item datum are converted and
significant) ~*h hits of the list
transmitted to the output record. I f ~ i s g r r;! at u r t han a.1 ,l:!-.a
leading blanks are transmitted, followed by a characters converted
from the rjattun.
On output}
Th~ R~ 0 and Z edit descriptors are used~ and theA edIt
descriptor
may be used, to specify processor-dependent editing for the physical
contents of numeric storage units. The editing consists of direct
octal~
hexadecimal or ch~rqcter code convarsion between internal
storaJe and ohuracter strings 0'( a rec()rd. ConversIon proceeds on a
hit-by-bit basis; no numeric or 109ical significance is attached to
the data. Any dnta type except typos
bit and character may he
edited wIth the R edit descriptor. Any data type, except bit~ may
be edited with the A, 0, and Z edit descriptors.
The number of bits corresponding to
the ~di~ doscriptor.
an
external
character
varies
Hith
The R~ edit descriptor indicates character code conversion (Appendix
A) of U chBracters~ with right Justification ~nd teeding zero bit
fill.
In the following, 3 is the maxlmum number of characters that
C3n b.·:! stor;;-!d in th.~ datum ~t one time, and.b is tho number of
bits
in a single character storage unit.
On input, i f ~ is tess than or equal to 2' (s-H)*b leading zero fi II
bits ara transmitted to the
leftmost (most significant)
bit
positions of the I ist item datum, fot loyted by the next l1 characters
of the input reGorJ conv(~rted ,to Chr1rrlct~1r code. If l! is gr~ater
CONTROL DATA PRIVATE
Control Data
Corpor~tion
14-16
Standard FORTRAN
83/06/30
-------------------------------------------------------------------14.0 FORjlAT
SP~CIFICATIDN
14.5.12.1 R EditinJ
(,!1-n) i nput chnrdct~:!rs are sId pp cd; the
next E char ecters
are converted to character code and transmitted to the datum.
th3n .,DJ
nn output, if ~ is less than or equal to n, the rightmost (least
significant) ~*b bits of the list item storage unit are extracted
8nd, b!Qinning with the
leftmost extracted hit, converted to ~
chJracters and transmitted to the output record. If ~ is greater
than B' H-3 l~adinJ blank characters are transmitted, followed by ~
characters conv~rtnd from the storage unit.
The OH and O~.m edit descriptors indicate
only
on
c h a rae t c r S •
ill
I s s I g n i fie a nt
corresponds to 3 physical bits. The acta I
nr i.!:
octal
conversion of H
Each character
digits and bit values
QUtpUt9
+--------------+-----------+
: Octol Digit
Bit Value:
+--------------+-----------+
o
000
1
001
2
3
.4
5
6
7
010
011
100
101
110
111
+--------------+-----------+
On input, the input fi€fd consists of Z,3ro or more I~ading blBnks
'f 0 I J 0 \!l e d by a s t r I n J of 0 eta 1 d i t1 Its.
0 p t Ion a J I !'
t h a s t r I n!J
may
contain e In bed d e d b I an ks; . each b I a n k is s i 9 n i f i cant and i seq u i va J e n t
to an 0 c t Cl I dig i t z e r 0 • The string may contain a maximum of Q.
churEcters inctudlnJ embedded blanks, but excluding leading blanks.
= (h+2) 13 Hhere his the number of bits in the 'i st i tern datum.
If
Q'~3
i::i
gr(;!att~r
than 11 thnn the leftmost (n*3-.td hits
corresponding to the input field must be zero. For a string of n
c h ":) r act e r s ,
( Q - D ) :~ 3 - 2 I cad i n!J z e r 0 f i 'I I b i 1: S Are t r s n 5 mit ted tot h e
leftmost (most signifIcant) bit posItions of the list Item storage
tj nit,
-f 0 I I 0 He d by the n c h a r:a c t e r 5 of the i n put. r e cor d con v e r t e dt 0
!l
0*3 bits.
If the input field contains no characters except the character
b 1:1 n k, the 'F i ~.:~ 1dis i n t J~ r pre t ,~ d f.'!. ::; e q1I i " die n t t 0 Z e r 0 (0).
CONTROL DATA PRIVATE
14-17
Control
Datt:i Corporation St8.ndard FORTRAH
83/06/30
-------------------------------------------------------------------14.0 FORMAT SPECIFICATION
14.5.12.2 0 EdltinJ
nn outputJ if ~ is less than or equal to b/3J the rightmost ~*3 bits
of the list item storage unit are converted to octal digit
characters and transmitted to the output record. If H is greater
than
Q., tl-Q le:ddinJ blank characters are tr,3nsmittad, followed by Q
octal digi ts converted from the storage uni t.
If li is equal
to
QJ
all the bits of the list Item datum a~e converted to octel dtglt
characters and transmitted.
If ill is specified on output, the value of m must not exceed
value of ~ and the following additional editing applies:
th~
A ma~imum of ~-ID leading octal zero characters are replaced with
blank characters, proceeding from left ·to right. A minimum of m
octal digit characters are not replaced.
If the number of octal digit charActers produced exceeds the fleJd
Hidth i;l, the entire field is filled \Ali th asterisks.
The
and Z~.m edit descriptors indicate hexadecimal conversion of
~
characters.
m is significant only on output. 2ach character
corresponds to 4 physioo1 bits.
Th~
haxadecim21
diaits and bit
values ere:
Z~
+-------------------+-----------+
: :lexadecimal Digit; Bit Value:
+-------------------+-~---------+
o
1
2
3
4
5
6
7
8
9
A
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
B
1010
1011
C
1100
E
1101
1110.
o
F
1111
I
I
.
1
•
+-------------------+-----------+
1"
input,
th~
input field consists of zero or more leading blanks
CONTROL DATA PRIVATE
14-18
Control Data Corporation Standard FORTRAN
83/06/30
14.0
FORMAT SPECIFICATION
14.5.12.3 Z !:ditinJ
followed by a strinJ of hexadecimat digits. Optionally the string
may contain embedded blanks;
each blank is significant and is
equivalent to an hexadecimal dlJit zero.
The string may contaIn
a
maximum of Z characters including embedded blanks, but excluding
leadina blanks. Z = (b+3)/4 where b is the number of bits in the
list item datum. If Z*4 is greater than ~ then the leftmost Cz*4-h)
bits corresponding to th~ input flaJd must be zero.
For a string of
.a chc::racters.J (Z-n>*4IeadlnJ zero fi J I bits ~re tr&nsmitted to the
leftmost (most significant) bit positions of the list item .datum,
f 0 I 1o!-, £! d
by
the
n c h are. c t e r S 0 f t h ,~j n p 11 t r e cor d con ve r ted ton 4
bits.
*
If tha input flald contnlns no characters except the character
hlnnk, the field Is jnt~rprat2d as equivalent to zero (0).
nn output, if 11 is Jess th an or equa I to b/4, the rightmost l:l*3 bits
of tha list item storaJe unit are converted to hexGdecimaJ digIt
characters and transmitted to the output record.
If ti is greater
than z~ !!-z. J,(~,ndin:J blanl, characters are transmitted, follo~led by
Z
hexadecimal
dlJits converted from the storage unit. If ti is equal
to z, all th~ bits of th~ list item storege unit are converted to
he}~adeclf!lal digit characters and transmitted.
If
ill
is
\' ~ I u 8 of
specified
1::1
an J the f
on
0
II
0H )
output, the value of
n9
tHJ d
I t I on a I
t!
m must not exceed the
d 1tin gnp p I I e s :
maximum of kl-m
le~djn:J
hexFH1Bcirnrd
zerO chnrCicters are
r e r J E\ C e d ~J i t h b I ~ nIt c h ~ rae t e r s, pro c e ed' n g "f rom I e ·:f t tor I 9 h t •
A minimum of ill hexadecimal digit characters are not replaced.
A
:.:1 i t c h a r 8 c t B r 5 produced
e )( c e e d s
the entire field is filled with asterisl2!
is
:eithBr
a
constant, a null value, or of one of the
fnrms:
where r. is an unsigned_. nonZero, integer constant. The I.*~ form is
f!CJlJi'/alent to L slJccesslve appeqrBnCeS of the constant~, and the!.*
form is equivalent to ~ successive nul I values.
Neither of these
,~ 0 r r.1S ii\ aye 0 n t a I n em be d de db) 9 n 1-\ s .' ex c €: p t rJ h (, r ~ per mit ted wit h 1 nth e .
constant ~.
A
~3!ll~ snu~~ztQL
(1)
is one of the following:
comma optionally preceded by one or more contiguous blanks
and optionally followed by one or more contiDuous blsnks
A
(2) A slash optionally preceded by one or more contiguous blanks
and optionally followed by one or more contiguous blanks
or mora contirJuous blanks
folJoHin:J the lust constant
(3) On·~
bctH~en
t:h/O
constants
Of.
Input forns 8cceptable to format specifications for a DJv~n type are
.;:, c (; e pta b J e for lis t - d ire c ted for mat tin g, e.x c e pta s not e d below. The
form of the input value must be acceptable for the type of the input
I ist item. Blanks arc never used 3S zeros, And ambedd~d blanks are
not permitted In constantsJ except withIn character constants and
complex constants as specified beJol.,.
Note that the end of a record
has the effect of a b1ank, except when it appears within A character
constant. A Boole:)n constant milY be used ns an inputPorm only if
the corresponding input IJst ttem is of type Boolean.
Hhen
the
prnGision~.
corresponding input
list item is of type realJ double
or half precision, the input form is that of a numerIc
, CONTROL DATA PRIVATE
14-20
Control Data CorporatIon Standard FORTRAN
83/06/30
-------------------------------------------------------------------14.0 FnR;1AT SP£CIFICATION
14.6.1 LIST-DIRECTED INPUT
~-~~-~-~-~---~-----~-~~---~~~~~------~-~~----~~-~-~-----~-~-~-~-----
input fiald.
A oUmBt!C lOQUi fi~lti is a field suitable for F
editing <14.5.9.2) which is assumed to have no fractional digits
unless a decimal point appears within the field.
Whon the corrosponding list Item is of type complex, the input form
consists of a left parenthesis followed by an ordered pair of
. numeric input fields separated by a comma, anrl followed by a right
parenthesis.
The first numeric input field is the real part of the
c 0 L1 P 1!~ X con s tan t ::1 n d the sec on () i s t h '9 i mQ:J 1 n ~ r y par t.
Eac h 0 f
the
numeric input fields may be preceded or fol lowed by blanks. The end
of a record may occur between the real part and the comma or bctHeen
the comma and the imagi~ary part.
When
the
corresponding list item is of type bit, the input form is
the
S i1nl e
as a Bin put f i
0
I d.
When the corrosponding input !ist item Is of type Boolean, the input
form is one of the following:
(2) a hexadecimal
constant {4.9.1.3},
(3)
a :-t 0 I J e r i the 0 n s tan t
(4)
an integerlnput
0
f
fl(~ld,
the for m " i " (4. 9 • 1 • 1 ) ,
or
(5) a nUmeric input field.
Whrln the corrospondinu Jist item i~ of type toglcal, the lnput form
Must not include either slashes or commas among the optional
characters permitted for L editing (14.5.10).
the corresponding list item is of type character, the Input
form consists of a nonempty string of characters enclosed In
apostrophes.
Each apostrophe within a character constant must be
represented b~ t~o consecutive npostrophe~ without an intervening
bt!lnl~
or end o'f rncord. Ch~r\:ict~r constants rr,3~1 be continued 'from
the end of one record to the beginning of the next record. The end
of the record does not cause ~ blank or any other charActer to
h~coma part or the constnnt.
The constant may be continued on as
many records as needed. The characters blank, comma, and slash may
appear in character constants.
Wh~n
L f.! t 1 i! U b fJ
t h (!
the 1 i s t. I 1'; e fiU n n die t g h e the 1 eng t h o f
I flED i s I es s t han 0 r e qua 1 to ,11, 1 he
I eftl10st 150 ch:.3r::~cters of tht: constr:.nt are transmitted to the
list
item.
If 19n is Jreater than H, the constant is transmitted to the
Jeftmost U charactars of the list item and the remcining len-H
characters of the fist item are filJed with blanks. Note that the
the
I 1; n J tho f
c h a r act e r e 0 n s tan t.
CONTROL DATA PRIVATE
14-21
Control Data Corporation Standard FORTRAN
83/06/30
... _..- .... ........... - .... - ................ - .... -----------------------------------------------.---..-:
14.0 FORMAT SP2CIFICATION
14.6.1 LIST-DIRECTED INPUT
effect Is as though the constant were assigned to the list item in a
character Rssignment statement (10.4).
A nul I value is specified by having no characters between successive
value separatorsft no characters preceding the first value separator
in the first record read by each execution of a list-directed input
si:n1;ement, or th9 r.* form. A null v:\I He has no effect on the
definition status of the corresponding input list item. If the
input list item is defined, i t retains its previous value; if it is
~J n d:-! fin e d.1
it
r e HI 8 ins \l n d ·e fin e d • A nul I val u e may not b 13 use d as
either the real or imajlnary part of a complex constant, but a
single nul I value may represent an entire complex constant. Note
that the end of a record following any other separator, with or
wlthout s8paratinJ blanks, does not specify a null value.
A slash encountered as a value separator during execution of a
list-directed input statement causes t3rmination of execution of
that input statement nfter th~ assignment of the previous value. If
there 'are additional items in the input list, the effect is as if
nuJ I values had been suppJ ied for them.
Notf]
to
bf~
thatal 1 blanks in
B I ist-d j rected
input record are considered
part of some value separator except for the following:
(1) Blanks embedded in a
char~cter
constant
(2) Embedded blanl,~ d U iii my a r J u m(:! n t sIn the FUN CTID N s t fl t e men tor SUB ROUT I NE
statement and other EHTRY statements
in the same subprogram.
I) 0 H eve r ,
each reference to PlF un c t ion or sub r 0 'J tin e must tI s e an
;\ c t ~J (l I u r iJ I.Hil CHl t lis t t h:!\ t ~1 q r c e 5 I nor de r., n U f11 b e r, ~l n d. t y p e wi t h the
dummy argument list in the corresponrJj ng
FUNCTION,
SUBROUTINE,
or
CONTROL DATA PRIVATE
16-17
Co,trol Data Corporation Standard FORTRAN
... __ .... .,.. ............. .-_ .................... _ ............. _ ......... _f.......... __ ..........-................. _ ...
83/06/30
_~
.. _ ... ____ ... _____ .... .-......._ ........... _________________ ...
16.0 FUNCTIONS AND SUBROUTINES
16.7.2 REFcRC:I'lCING AN EXTERNAL PROCEDltRE OY AN ENTRY NAME
;:;NTRY statef!l>~nt.·
The use of
a
return specifier as an actual
requiring agreement of type.
subroutine nAme or an alternate
argument 1s an exception to the rule
within a functi.on subprogram, al I variables whose names are also the
names of antries ~ro assoclated ~ith ench ot~er and with the
vArltdJle, iF any, ",hose n~me 1s also the name of the 'function
subproDr~m
(18.1.3).
Therefore, any such variable that becomes
defined causes all associated variables of the same type to become
~efined
ani al J associated v8riphlas of different type to become
undefined. Such variabl~s are not required to be of the same type
unless the type is character, but the variable whose name is used to
r f! -Fe r .~ nee t 11 e fun c t ion mu s 1: b ;9 ina d eF i ned s tat e .-) hen n RET URN 0 r
END s t:::1 t e fli~ n t j sex t: c ut e din t h ~ sub pro J r a Til.
An 3 s soc I ate d va r I a b I e
of a different type must not become defined during the execution of
the function reference.
Within ·s subprogram, An entry name must not appear both as an entry
name in an EMTRY st~tement and 35 a dummy argument in a FUNCTION,
SUBROUTINE, or ENTRY statement and must not appear in an EXTERNAL
statement.
In a function subprogram} a variable name that is the same as an
~;! n try
n 11 nJ e
HI \J S t
not
0 p P e 2. r
I nan y
s t ~ te men t t hat pre c e des the
appearance of the entry name in an ENTRY statement, except in a
type-statement.
If an untry nnme in 3 fUnction subprogram Is of type cher8cter~ each
entry name and the name of the function subprogram must be of type
character.
If the name of the function subprogram or any entry in
thJ subprogr3m has a l~nDth of (*) declar€d, all such antities must
hAVe;)
Jet'ICJth
of (~~) decll1r'Dd; otherHlse, nIl such entities must
h~ve a length specification of the s~me integer value.
In a subproaram, a name that appears as a ~umrny argument in an ENTRY
statemant must not appear In an executable st~tement preceding that
ENTRY statement unless it also appears in a FUNCTION, SUBROUTINE, or
ENT P. Y s tat em c n t t hat pre c e des the e x e'c uta b 1est ate men t •
n EN TRY
functlon
statement unless the name is also a dummy aryument of. the statement
" un c t ion, a p p .:;! a r s t n ::1 FUN CTI I) Nor StI BR11 UTI NEst ate men t, 0 rap pea r s
in
an
ENTRY statenent that pr~ccdes the st~tement function
statement.
rna sub pro Ur
stdte~ent
If
a
:~t m,
n, n B met h eta p pea r~;
f-!
sad 1I mMy}) r gum e n t i n
3
Rust not appear in the expression of a statement
dummy
argument
appears
in
an
executable
statement,
tho
CONTROL DATA PRIVATE
Control
DRt~
16-18
Corporation Standard FORTRAN
83/06/30
16.0
FUNCTIONS AND SUBROUTINES
16.7.4 E:i"4TRY STAT!:NENT RESTRICTIONS.
-------------------------------------------------------------------execution of
·fJxcclJtion
or
the
a
executable
rr)i~cnrcnce
statement
is
permitted
during
the
to ,the fUnction or subroutine only If the
dummy 3rgument appears in the dummy argument list of the procedure
name referenced. Note that the association of dummy arguments with
actual arDUm0nts is not retained hetMeen references to a function or
subroutio0.
1\ n
EN TR Y
s tat erne n t
mus t
not
a p pea r
in an array-valued function
subpro£jram.
A RETURN statement in a fUnction subprogram or suhroutine subprogram
t: a iJ S e s ret urn 0 'F con t r 0 Ito the r e 'f e r 9 n c ina p r ('I g ram u n i. t •
Ex e cut jon
of a RETURN statement in a main program terminates the execution of
the executable program.
The form of
progr;;lm is:
a RETURN statement in a function subprogram or a main
RETURN
The form of a RETURN statement in a subroutine subprogram is:
RETURN
where
~
of tYPd
r~]
is a scalar arithmetic or Boolean expression.
intr)Jer~
If
~
is
not
the value of INT(!l) is used.
Ex.;:!cutlon oi!) RETURN statement ter minates the reference of a
function or subroutine subprogram,
Such subproorams may contain
more
than
ont!
RETURn st2t(~m::')nt; hOHeVf!rJ ~ suhproQram need not
Gontain a R::;TURj\l stHtcment. Ex~cution of an END statement
In a
function or subroutine subprogram has the same effect as executing a
RETURN statement in the subprogram.
In the exec~tion of an eXEcutable program, a function or subroutine
subproaram must not be refp.renced a second time without the prior
~xecution of a RETURN or END statement in that procedure.
Exocution of a RETURN statement
in a function subprogram causes
return of control
to the currently referencing program unit. The
value of the function (16,5) must be defined and is available to the
raf~rcncina prcJram unit.
Executlon or a RETURN statement in a subroutine subprogram causes
return of control to the currently referencino program unit. Return
CONTROL DATA PRIVATE
16-19
Control Data Corporation Standard FORTRAN
83/06/30
16.0
FUNCTIONS AND SUCROUTINES
16 • f:I • 2 (; XECUT I
on
OF ARE T URN STAT Ei1 ENT.
~-~~~-~~-~-~~-~-~--~--~~~-~~-------------~---~~-~--~------~---------
of control to the referencing program unit
the CALL statement.
completes
execution
of
0 ·r
a R:: T URn s ta t em~ n t t e r mJ nat e s the ass 0 c i at i on bet 14 ·e e n
the dummy arguments of the external procedure in the subprogram and
the current actual arguments.
Ex';.! cut i (l n
If ~ is not specified in a RETURN statementJ or if the value of g is
less than one or Jraater than the number of asterisks in the
SUBROUTINE
or
subroutine ENTRY statement that specifies the
currently referenced name, control returns to the CALL statement
that initiated the subprogram
execution of the CALL statement.
reference
and
this completes the
If l~. g ~ n, where D is the number of asterisks in the SUBROUTINE
or
subroutine
ENTRY
statement that specifies the currently
r ef ere nee dna me... the Vi1 I u e of g ide n t i fie s the .e t h ::\ S t e ri s k i n
the
dummy . :lr:HJm'ant
'1st.
Control
is
returned to the statement
identified by the 31ternate return specifier In the
CALL stat~3ment
that is associated with the gth asterisk in the dummy argument list
o "f t hB cur r (1 n t I'y r 8'f (; r .J nee dna m2! •
This corn pie t est h e ex e cut ion
0 f
the CALL statement.
of a RETURN statement (or END statement) wJthin a
causes all entities within the subprogram to become
undefined, except for the following:
~xccution
subpro~ram
(1) Entities specified
(2) Entities
by
SAVE statements
in blank common
(3)
Initially defined entities that have neither been redefinod
nor become undefined
(4)
Entities in a named common block that appears in the
subprogram and appears
in at l~ast one other proQrgm unit
that is raf;t.:.rcncinq, either directly Or
indlre.ctly,
the
subpr t)gr Rm
Note
that
f~ n i; i t i .t:~ sin
!JX~cut ion
or
if a named common block appears in the main program,
COin m0 n b I 0 c 1< don 0 t b e com e
tJ. n d e fin e d
at
any RETURn st atement in the executab Ie progr am.
t IH! n rlIl1 e d
the
the
ArJumE:nts
and CO:JF10n bloch's provide means of communication between
the referencing prooram unit a~j the referenced procedure.
CONTROL DATA PRIVATE
16-20
Control Data Corporation Standard FORTRAN
__
..... -.-.-..- ................ .... .................... ------------------------------_.
16.0
16.()
83/06/30
__._-----------------
FUNCTIONS AND SUBROUTINES
AND CONi'10!\BlOCKS
ARGUnEf\~TS
Data may be
statement function or intrinsic
Data may be communicated to and from
an external procedure hy an argu~ent list or common blocks.
Procedure nHl!leS may be communicated to an external procedure only by
an argument list.
A dummy
:JC'f.;Ua
I
communicated
to
a
by an ar:)lJment 1 ist.
function
ar gu men t
6.r
au :']2;Ot
flppears in the ergumcnt list of a procedure.
An
arrBars
In the
arjument list of a procedure
reference.
The' number of actuat
argumants must be th~:; snme
dummy arguments in tha procedure refnrenced.
as
the
number
of
fUnctions,
functIon
subprograms,
and
subroutine
us e dum m'y a r ;] u men t s t 0 i n die ate t he t y pes 0 f act u a 1
arauments and whether each argument
is a sing1e value, array of
vHI U~~S ... proc{~dure.,
or
statement
I abel.
Note
that a statement
function dum~y argu~ent ~ay be only a varl3ble.
statement
sub pro :J r
arl S
Each dummy argument is classified as a variable) array, dummy
procedure, or asterisk. Dummy argumont names may appear wherever an
actual n:~me of the SClme CI::iSS (Section 19) and type may appear,
except Hhere they are expJ icitly prohi bi ted.
Dummy
argulllent
names
must. not
Bppf;:1ar
in
EQUIVALENCE,
DATA,
PARAi''lr:TER,...
SAVE .• INTRII'~SIC, or COr'HEJN statements, except as common
block names. A dummy argument name must not be the same as the
pro c e d LI r e
n a mea p p ear i n gin
a
FtJ N CT I ON,
SUB R0 UTI ~J E.,
EN TRY, 0 r
statement function statement in the
A j U 11 !il !' a r D11 men t
statement.
Ii1 u s
t
sam~
progrAm unit.
not a p pea r as the h 0 s tar r a'y
ina n
IDE NT I F Y
Actual aruuments specify the entities that are, to be associated with
the dummy arJumants for ~ particular reference of Q subroutine or
PunctJon.
An actuaJ argument must not be the name of ~ st&tement
function in the program unit containing the reference.
Actual
arguments may be constants, symbolic names of constants, function
references, scalar or Brrsy expressions
involving
operators,
vector-vaJu8d section selectors, and scalar or array expressions
8nclosed in parentheses if and only if the associated dummy argument
is
not
1afined rlurlna e~ccutlon of the referenced external
proc,~durc.
The type of each actual argument must agree with the type of its
ass o.C i ate d
dummY 3 r 9UIn Co: n t , 3 ,< c e. p t :·f h ~~ n the act u a I a r gum e nt i s a
subroutine narn~ (16.9.3.~) or ~n alternBte
return
specifier
CONTROL DATA PRIVATE
16-21
Control Data CorporatIon Standard FORTRAN
83/06/30
-------------------------------------------------------------------16.0 FUNCTlflHS AND
SUBRDUTIN~S
16.Q.2 ACTUAL ARGUMENTS
---------~---------------------~------------------------------------
At th9 ox~cution of 3 function or subroutine reference,
an
associ3tion Is estabJ1shed between the corresponding dummy and
actu~1 arguments.
The first dummy argument becomes associated with
tho first Jctual
arJumcnt,
the second dummy argument becomes
:]S50C j ated }'1! Ith th'd second actual ar!Jurqent~ etc.
appearances within a. fUnction or subroutine subprogram of a
:a r ~ u mf! n t who s e, n ~ mea p P~H\ r sin the dum fa y a r gum en t lis tor the
pro c e d t.I r e n:l ;;1 e re fer en IJ e d bee ('I mC 3 S soc t ::\ te d wit h t h t3 act UBI a r gum € n t
when a reference to the function or subroutine is executed.
AI)
d u min y
A valid association occurs only if the type of the actua1 argument
is the Same as the typa of the corresponding dummy argument.
A
subroutine name has no type and must be associated with a dummy
procedure name. An alternate r~turn specifier has no type and must
be aS50ciate1 with an asterisk.
If an actual argument Is an expression, it is evaluated Just before
the association of arauments takes place.
If an ilctual,lfJument is an flrr1Y element natTH1,
its subscript Is
evaluated just bafor0 the ~ssociatJon of arguments takes place.
Note that the subscript value remains constant as long as that
8ssQciation of 8rJUm~nts persists, even if thQ subscript contains
variables that ~re redefined during the dssoctntlon.
If an actual argument is a character substring name,
its substring
d ra
e v ~1 I u ate d j lJ S t b e for t"'! t he L1 S soc i H t ion 0 far $) u men t s
Not ~
that
the v a J u e o r e :n c h of the substring
expressions
remains constant as long as that association of
arguments persists~ even if the substring expression contains
Y n ria b 1est h ':\ -t are r e rl e fin 0 d c1 11 r i n g the r.: s SOC i a t ion.
ex pre s s ion s
t ~ Ie e s P I ;~l C f.:! •
If
!\l U s
an.
t
actu~1
argument is an external procedure name, the procedure
the tim e ~l ref ere n c e t 0 1 t i s e x e cut e d •
be a v ai 1 a b I eat
A d l! mm~' a r Uu mfm t i s un d e or i ned i f i t i s not cur r en t 1y ass 0 cia ted \'4 i t h
an actuaJ argument. An adJustahle array Is undefined if the dummy
araument array is not currently ~ssociated with an actual
argument
array
or
if
any variable lppe~rina
in the adjustable array
declarator Is not currently <\ssociated Hlth tH) actual
argur.ent and
is not in a common block.
ArJument
association m:ay be cnrrif!r! thr()'JDh moro than ont'! level of
r roc ~! d u r e r !;:!r- ~ r f~ nee. A v~:.'J ltd ;.1 S soc i at ion e x j s t s at t h 8 I 3 S t i c vel
on I ;' i f
a val i d ;:) S $ 0 cia t ion ex j s t s a t a I lin t e r me d i ate I eve Is.
Araument
association
within
a
program
unit
terminates
at
the
CONTROL DATA PRIVATE
16-22
Control Data Corporation Standard FORTRAN
83/06/30
~-~~~~~~~--~---~--------------------------------------- -------------
16.0 FUNCTIONS AND SUBROUTINES
16.().3 ASSDCIATION flF OU:ltiY AND ACTUAL ARGUNEHTS.
-------------------------------------~------------------------------
execution of a RETURN or END statement in the program unit.
Note
that. there is no retention of argument association between one
r ~ f £! ra nee o"'f~ a sub pro aram :? n d the n t3 :..: t r a for fa nee 0 f the
sub pro 9 rem.
If an eJeMental Intrinsic function Is referenced with an array name,
nrray section name, or array expression as an actual
argument~
the
i~tJnction
ldi II
be impl ioltl," fafE,;rencBd D times Hhere !l is ·the size
of the actual argument array name, array sectlon name, or array
expression. Each implicit reference wi) I associate one of the array
nlomants of the array, dfrsy saction, or array expression actual
arJument wi.th the corresponding variable dummy argument. Every
array el ement of the actual argument will be associated during the n
implicit references.
The order in which the cssociations are made
is not specified. If there is more than one array,
array section,
or array expression as an actual argument} each imp1 icit reference
Hill associate the same relative array element of each array,
arraY
S8 c t. i on,
or a r r a y~ >: pre s s i on. For ex amp I +3, i n the reference to the
D I ement~) I intr i ns Ie functIon ATAN2
INTEG~R
ACIO), B{-5:4)
n = ATAN2 ( AJ B )
one of the Im?J Jclt references to ATAN2 will
associate A(l) and
with the corresponding dummy arguments,
another implicit
ref ere n c e wi J I ass 0 cia teA ( 6 ) and B ( 0 ) \., i t h the COr res P 0 n din 9 dum my
Sf-5)
Xl
r :J um ~!n t
s,~
tc•
If a dummr argument is of type character, the associated actual
Jr'JufOi.'!nt must be of type char::lcter and the 'ength of the dummy
arLJument must be less than or equal to the length of the actual
~;lr Jum.Jnt.
I f the '~~n!Jth l!lo. o·p ;~ dummy argument of
type cheracter
is
less than the length of an associated ~ctual argument, the
leftmost l~D characters of the actual argument are associated with
the dUMmy arJument.
If
a. dummy argument of type character is an array name, the
restriotion on lenJth is for th~ entire array and not for each array
~2! I i~nle n t •
T h (~ 1eng tho ·r :;1 n a r r ::3 y e lent e n tin the dum my n r gum e n tar ray
maybe different from the length of an array element in an
~ssociated
actual
argument array, arr~y element, or array element
subs·tring, but the nummy argumnnt arre~' must not extend heyond the
end o'r the (};ssociat;3d actur.ll argument arra.y.
If
an actual
:lci;ual arjUi'l(!nt
~)r ]umf.-!nt is thH
the sum of the
argument is a.character substring, the length of the
is th!,'! length of the substrino.
If an ~lctual
CnnG-atdnat 1 on ()r tHO 0 r more op€.rnnds, its I ~ngth Is
lengths of the operands.
CONTROL DATA PRIVATE
16-23
Control Data Corporatlon Standard FORTRAN
83/06/30
~~-~~-~--~-~---~--------------------------------------- -------------
16.0 FUNCTIONS AND SUBROUTINES
16.9.3.2 Variables as Dummy Arguments.
A dummy 8rnumnnt that is ovarieble mAY be associatad wIth an actual
substring, or
ar Jumcnt
til at
is
a variable, array element,
expression.
If 'the ;3CtU::t1 nrgur"cnt is. a vnriabl€ ntime, array
elemont
name} or
substring name; the associated dummy argument may be defined or
redefined within the subprogram.
If
the actual
argument is a
const8nt, a symbolic nome of n constant, a function reference, an
expression
involving
operators,
parenthesesl
the associated
within the subprogram.
or
dummy
an
\;:.xpresslon
enclosed
In
argument must not be redefined
Within a proJram unit, the
provid:~s
all
arraY declarator given for an array
array declarator information n~~eded for the arrflY In an
execution of the program unit. The number and size of dimensions in
an actual argument array declarator may be different from the number
nnd size of the dimensions in an associ ated dummy &rgument array
declarator
vnl;'
If tht1 actual argument is an arraY name or array
element name.
size of dimensions in an actual
argument array
section or Jrray expression Involving operators or parentheses must
agree with the number and size of the dimensions in an associated
dummy argument array declarator.
The number and
PArmittad associations between actual and dummy arguments
by the folloHinJ table:
conTROL DA TA
~re
shown
PRI VATE.
16-24
Control
FORTRAN
Data Corporation Standard
83/06/30
-------------------------------------------------------------~------
16.0
FUNCTIONS AND SUBROUTINES
16.Q~3.3
Arrays
RS
Dummy Arguments
+----------_.+------+-----------,+---------+-----------+--.---------+
ACTUAL
ARGUMENT
ARRAYl ARRAY
NAME
SECTION!
ARRAY
ELEMENT
EXPRESSION:
•,
•
t
,
I
I
•
: DUNNY
: ARGUMENT
ASSUMED
ASSUMED
SIZE
SHAPE
ARRAY NAME: ARRAY NAME
:
:
t
I
+-----------+------+-----------+---------~-----------+------------+
: cnNST ANT
: YeS
: ARRAY
:
YE S
: YE S
: Same
ShapE2
2
DIM
101M
Integer
Integer
o
if
al~.a2
: Lxtendr:d Prt'!cision : .al*.a2
:
Product
~
l DPROD: Rea)
2
: : : RPROD
:
Hal f
Double
Half
:
:
Double
Real
:
Real
Double
Half
..
+--------------------+-----------------+---------+---------+---------+-----------+----------+
ChoosinD Lnrgest
max(al,a2, ••• )
MAX
MAXO
Integer
Integer
~2
Value
AMAXI
DMAXI
HMAXI
,,
t
•
Real
Double
Half
I
1
1
+---------+---------+-----------+----------+
: AMAXO
: Integer
: Real
•
I
: MAXl
: Real
: IntegEr
.,.-.. . _-----------------+-----------------+--------+---------+--------+-----------+----------+
CONTROL DATA PRIVATE
16-31
Control Data Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------16.0 FUNCTIONS AND SUBROUTINES
16.10 TABLE 5
INTRINSIC FUNCTIONS
TabJe 5 (continued)
Ele~ental Intrinsic Functions
+--------------------+-----------------+---------+---------+---------+-----------+----------~
of: Generi.c : Specific:
Type of
~
:Arouments: Heme
: Name
: Argument : Function:
~11umber
: Intrinsic Function: Dafinition
+--------------------+-----------------+---------+---------+---------+-----------+----------+
Choosing Smallest
••• )
MIN
MINO
Integer
Integer
min(~1,a2,
~2
Value
AMINI
DMINI
HMINl
Real
Double
Real
Double
Hnlf
Half
+---------+---------+-----------+----------+
: AMINO
: Integer
: Real
:
:
~
MINI
: Real
~
Integer
:
+--------------------+-----------------~---------+---------+---------+------~----+----------+
: Length
: Length or
:
: Character Entity:
1
: LEN
: Character ; Integer
+----------~---------+-----------------+---------+---------+---------+-----------+----------+
Integer
ChGracter
INDEX
Loc~tion of
2
Index of
a Substring
Substring a2
in StrinJ al
See Note 10
+--------------------+-----------------+---------+---------+---------+-----------+----------+
: ImaQinRry Part of : 21
1
: AIMAG
: Complex
Real
~
:
Comp1ex Argument
: See Note 6 :
Complex Argument
: See Note 6
;
:
:
~
:
+--------------------+-----------------+---------+---------+---------+-----------+----------+
: Complex
: Complex
: CONJG
: Conjugate of a
1
:
(~t,-£l)
+--------------------+-----------------+---------+---------+---------+-----------+----------+
Square Root
:
1
SQRT
SQRT
Real
Real
(~)**1/2
:
:
;
:
DSQRT
HSQRT
• CSQRT
Double
Half
Complex
Double
Half
Complex
+--------------------------------------+---------+---------+---------+-----------+----------+
CONTROL DATA PRIVATE
16-32
Control Data Corporation Standard FORTRAN
83/06/30
---------------~~~~--~~----~~-~~~--~~-~---~--~~~-~--~~~-~-~~-~~---~~
16.0 FUNCTIONS AND SUBROUTINES
16.10 TABLE 5 INTRINSIC FUNCTIONS
Table 5 (continued)
Elemental Intrinsic Functions
+--------------------+-----------------+---------+---------+---------+-----------+----------+
:.
:.
:Number of: Generic: Specific:
TYpe of
:
: Intrinsic Function: Definition
:Argumcntsl name
: Name
: Argument
~
Function:
+--------------------+-----------------+---------+---------+---------+-----------+----------+
Exponential
e**B
1
EXP
EX?
Real
Real
DEXP
HEXP
CEXP
Double
Half
Complex
Double
Half
Complex
+------------------~-+-----------------+---------+---------+---------+-----------+----------+
Natural LOJnrlthm
log (a)
I
lOG
AlOG
Real
Real
+_4100..................... __._ ............... ____ ......... _+ .... __ ... ____.., .... __________ +.-.-___ . ___ .... +______ ... __
COlOmon Lo]arithm
loglOLa}
I
LOGIO
DLOG
HLOG
CLOG
~_+_-_
Double
Half
Complex
Double
Half
. . __---+ __Complex
-___ --_-_+ __ ---------+
: ALOGIO
: DLOGIO
: HlOGIO
: Real
: Double
: Half
Real
: Double
: Half
+--------------------+-----------------+--~------+---------+---------+-----------+----------+
Sine
I
sin(~)
SIN
SIN
DSIN
HSIN
CSIN
Real
DoubJe
Half
Complex:
DeOS
HCOS
Double
Double
Half
Half
Complex. Complex
Real
Double
Half
Complex
+--------------------+-----------------+---------+---------+---------+-----------+----------+
Cosine
cos(al
I
COS
eos
Real
Real
:
:
:
:
:
ecos
+--------------------+-----------------+---------+---------+---------+---~-------+----------+
Tangent
tan { a ) :
1
TAN
: DTAn
: HTAN
: TAN
:
Real
DoubJe
= Half
Real
: Double
: Half
: HCOTAN
: Half
=
••
+--------------------+-----------------+---------+---------+---------+-----------+----------+
: Cotangent
: cotan(.a)
1 : CDT.6.N
: COTAN
: Rcal
: Real
:
Hal f
+--------------------+-----------------+---------+---------+---------+-----------+----------+
conTROL DATA PRIVATE
16-33
Control Data Corporation Standard FORTRAN
83/06/30
--~-------------.---~~~~~~~------~-~---~-~-~--~-~~-~-~~~-~-~---~~----
16.0 FUNCTIONS AND SUBROUTINES
16.10 TABLE 5 INTRINSIC FUNCTIONS
--------------------.----------------------------.---------------------
Table 5 (continued)
Elemental Intrinsic Functions
+--------------------+-----------------+---------+---------+---------+-----------+----------+
:Wumber
Generic
Specific:
TYpe of
:
of~
: Intrinsic Function: Definition
~
:Arauments1 Name
: Name
: Argument
: Function:
: DASIN
: HASIN
: Double
: Half
: Double
: Half
+--------------------+-----------------+---------+---------+---------+-----------+----------+
Arcsine
1
ASIN
ASIN
Real
Real
arcsint~}
+--------------------+-----------------+---------+-------~-+---------+-----------+----------+
'ACOS
; Rea I
: Real
1 Arccosin~
arccosCa)
1
: ACOS
•
•
: DACOS
: HAC()S
I
1
: Double
: Double
: Ha I f
; Half
+--------------~------+-----------------+---------+---------+---------+-----------+----------+
arctnn(3)
1
:
:
:
I
ATAN: AT AN
: DATAN
:
HA TAN
Real
: Double
: Hal f
Real
: Double
: Ha I f .
+----------------.-+---------+---------+---------+.-----------+----------+
2
: ATAN2
ATAN2: Real
Real
arctan(B1/~2)
1
:
Double
Half
: Double
: Half
: DSINH
: HSINH
: Double
: Half
: Double
: Half
: DCOSH
: HCOSH
: Double
: Half
; Double
: Half
: DTANH
: HTAN H
: Double
: H? If
: Double
: Half
:
DATAN2
HATAN2
:
:
+--------------------+-----------------+---------+---------+---------+-----------+----------+
Hyperbolic Sine
1
SINH: SINH
: Rcal
: Real
sinh(~)
+--------------------+-----------------+---------+---------+---------+-----------+----------+
COSH
: Real
Real
H;'p r b I ic Cos i ne
: COSH
coshes)
1
~3
0
+--------------------+-----------------+---------+---------+---------+-----------+----------+
Hyperbolic Tangent
tanh(.a}
1
TANH
TANH
Real
: Real
+--------------------------------------+---------+---------+---------+-----------+----------+
CONTROL DATA PRIVATE
Con t r 0
J
0 ~t t
~£i
,16-34
Cor p 0 rat ion S t fa ndar d FnRTRAH
83/06/30
I·,
16.0 FUNCTIONS AND SUBRDUTINES
16.10 TABLE 5 INTRINSIC FUNCTIONS
--------------------------------------------------------.-----------..TabJe 5 (continued)
Elemental Intrinsic Functions
+--------------------+-----------------+---------+---------+---------+-----------+----------+
of; Generic
Specific:
Type of
1
~Number
;ArJuments~
: Intrinsic Function: DefinitIon
~
Name
: Name
: Argument
: Function
~
+-------------------+----------------.-+--------+~--------+---------+-----------+----------+
: LexicallY Greater
:.31 ~ .a2
2
: LGE
: Character: Logical,
Than'or Equal
: See Note 12
Than
;
•
+--------------------+-----------------+---------+---------+---------+-----------+----------+
; Lex i c a I Iy G rea t e r
:.a 1 > .a 2
2
L GT
.: C h a r act e r : Log i co J
~
:
See Note 12
: : :
+--------------------+----------------~+---------+---------+---------+-----------+----------+
:
Lex i c a I I y L e s s
Than or Equal
~
.a 1
~ .Q 2
2
: LLE
: C h a rae t e r
; Lo 9 ie a I
; See Note 12
:
+--------------------+-----------------+---------+---------+---------+-----------+----------+
! Lexically Less
: 31 <.a2
2
: LLT
: Character: Logice'l
:
Than
;
12
+-_______________
----+----__________
+ _________ +_________ +_________ + ___________ +__________ +
S{~e
Not~3
"W _ _
I
Random number
Random Number
Generator
in
r~nge
:
RANF
0 or 1
Real
(0.,1.);
See Note 13.
+--------------------+-----------------+---------+---------+---------+-----------+----------+
Shift
Boolean result
2
SHIFT
but: Boolean
:~1:
~ny
of 31 shifted
:char,bit,or:
B2 bit positions:
: ha I f
:..62: i
ntoge.r:
See Note 15
+--------------------+-----------------+---------+---------+---------+-----------+----------+
Boolean result
1
MASK
Integer
OooJesn
~ask
of
B
Jeft-
:
justified 1 bits~
• Sae Not,;! 1 6 :
:.
:
:
. :
, .
+--------------------+-----------------+---------+---------+---------+-----------+----------+
: =rror Function
: erfCE)
1
: ERF
: Real
: Real
~--------------------+-----------------+---------+---------+---------+-----------+----------+
: Complement:]ry
: Error Function
: erfcC.a)
: See Note 17 ,
1
: ERFC
: Real
: Real
+--------------------+-----------------+---------+---------+---------+-----------+----------+
: H:' p r b lie
at n h
1
: AT AN H
: Rea I
: Rea I
8
0
~
~
(.a)
: Arctangent
:
:
+--------------------+-----------------+---------+---------+---------+-----------+----------+
: Sine
:
where :
1
: SIND
: Real
: Real
~
sind(~l,
~ ls in
degrees
~
+---------------------+-----------------+---------+---------+---------+-----------+----------+
: Cosine
: cosdC..al.r where
1
: COSO
: Real
: Real
: .E
is
in degrees:
: l!
Is
in degrees;
:
+--------------------+-----------------+---------+---------+---------+-----------+----------+
: Tangent
; tand(B), where :
1
; TAND
: Rear
: Rea)
+--------------------+-----------------+---------+---------+---------+-----------+----------+
CONTROL DATA PRIVATE
16-35
Control. Data Corporation Standard FORTRAN
83/06/30
-~~~--~~~~~~~~-~--------------------------.----------- ---------------
16.0 FUNCTIOt-lSAND SlJBRnUTIN~S
16.10 TABLE 5 INTRINSIC FUNCTlnNS
-------------------------------------------------------------------Table 5 (continued)
Elemental Intrinsic Functions
+---------------------+-----------------+--------+--------+---------+-----------+-----.-----+
:
:Number of: Generic: Specific=
Type of
:
:
Int~insic
~Arguments:
Function: Definition
Name
: Name
: Argument
: Function I
+--------------------+----------------~+---------+---------+---------+-----------+----------+
Boolean
Pr~duct
;Bootean result of:
.AND. operator
See Nota 33
AND
:any but bit: Boolean
: or char
I : Bit
Bit
any)=2
:
t
+------------~-------+---------------~-+-----~-~-+---------+----------+-----------+----------+
Doolean sum
;Boolean result of:
: .DR.
OR
any)=2
oper~tor
See Note 33
:any but bit; Boolean
: or char
: Bit
Bit
+--------------------+-----------------+---------+---------+---------+-----------+----------+
Dr
:noolean result of: any)=2
XOR
:any but bit: Boolean :
~xclusive
: .XDR. oporator
:
:
Se~ Note
33:
:
: Of char
: Bit
:
• Bit
:
:
+--------------------+-----------------+---------+---------+---------+--~--------+--~~------+
f'loncqu i va I ;~nc':J
:
Sam'1 as
: cnY>=2
NEaV: any but bit: Boo I enn
:
: 2xcluslve Or
: or char
See Note 33
: Bit
Bit
+----~-----~---~~----+~-~~----~~----~-.-+--------~+-~----~--+~~~-~----+--~--------+~------~--+
Eqyiv~lence
~Boolean
r~sult
o~:
: .EQV. operator
:
See No t e 33
EQV
any>=2
:
:any but bit; Boolean
: or char
:
: Bit
: Bit
:
+--------------------+-----------------+---------+---------+---------+-----------+----------+
Complement
result of:
1
COMPL
but bitl Booleen :
;Boole~n
~ .NOT. operator
:
See Note 33
~any
:
•
; or char
: Bit
: Bit
:
:
+-----------.---------+-----------------+---------+---------+---------+-----------+----------+
>: t r c t Bit s e x t b
1, 1 )
3
EXT B
La : See
Boo I e a n
£::
::l
La~.
See Note 18
:
Note 18
:1: Integer
Lj:
integer
+--------------------+-----------------+---------+---------+---------+-----------+----------+
Insert Bits
insb(3,1,J,b)
4
INSB
;B and h:See; BooJean
See Note 19
Note 19
:
:1: Integer :
:j:
integer:
+--------------------+-----------------+---------+---------+---------+-----------+----------+
Merge under mask
See Note 20
3
MERGE
B1,B2 int
Integer
.al,.a2 Real
E1,,a2 Obi
~1'32
Half
~1JB2
CpJx
~1'D2
~1,~2
Loo
Char
Rca I
Oouble
Half
Complex ~.
Logical
:
Character:
.a1,.a2 Bit
nit
+------.--------------+-----------------+---------+---------+-------:'--+--.---~-----+-------~~-+
CONTROL DATA PRIVATE
16-36
Control Data Corporatlon Standard FORTRAN
83/06/30
-------------------------------------------------------------------16.0 FUNCTIDNS AND SUBROUTINES
16.10 TABLE 5
INTRINSIC FUNCTIONS
-------------------------------------------------------------------Table 5 (continued)
Array-valued Intrinsic Functions
:Number of: Generic
: Arguments~ Name
t
I
1
•
: Intrinsic Function; Definition
: Specific:
:
Name
:
Type of
Argument
:
:
Function:
+--------------------+-----------------+---------+----------+---------+-----------+-----~----+
Dot ProdlJct
:surn(conJo(a1)*32):
See Note 21
2
;DOTPRODUCT:
Integer
Real
Double
Half
Complex
Integer
Real
Double
Half.
Complex
+--------------------+-------------~---+---------+----------+---------+-----------+----------+
Matrix Transpose
Ro~'{
1
and col umn
;TRANSPOSE
1
interchange of
.a
S;J€ Note 22
Integer
Real
Double
Half
Complex
LOQicat
Character
Bi t
S ~j m of :) I 1
: 1, 2, 0 r 3 ~ SUN
the eloments of :
Bl along dimen-'
sion ~2
See Note 32
Sum mat ion
I n t e 9e r
Reaf
Double
Half
Complex
Integer
Real
Double
Half
Complex
Logical
Chtiracterl
Bit
I nt eQ e r
Real
Double
Half
Complex
+--------------------+-----------------+---------+----------+---------+-----------+----------+
Product
Product of all
2,or 3: PRODUCT
Integer
Integer
11~
the elements of
~
31 along d i m e n - :
sian a2
;
:
See Note
Real
Double
:
Complex:
Real
Double
Half
Real
Double
Half
Half
:
32
Real
Double
Half
Complex
.:
:
+--------------------+-----------------+---------+----------+---------+-----------+----------+
Va J u
rna x i rl u m : Ma x i mu 0 f . 1 I : 1 2 ,or 3: f'l AXVAL I n t e 9 e r
I n t e9er
~~
0
r:'l
~
~
Element of an array: elements of 31
along dImension
a2. See Note 32
+-~~----~~--~~~--~-~~+--~~----~~~--~~-~+---~-~---+~-~-~-----+---------+-----------+----------+
V r1 I I.H~ o'f J1 i n i HI U m
: "1 i n i m1..1 m 0 f 3 I I
: 1 ~ 2, 0 r 3: f'1 I NV Al I n t e 9 e r
I nt eg e r
Element o? an array: elements of a1
Real
Real
along dimension
Double
Half
a2. Seg Mote 32
Double
Half
+--------------------+-----------------+---------+----------+---------+-~---------+----------+
Co un t n u mb e r 0 f
C0 u n t 0 f the
lor 2
C0 Ul'l T
l 0 ~n c a I
I n t e SJ e r
true valu·::s
numherof trlJ.;~··
elements of 31
along dimension
.32.
Se{~
t.lotn 23
+------------------~-+-----~-----------+---------+----------+---------+-----------+-----~----+
C~NTRDL
DATA PRIVATE
16-37
Control Data Corporation Standard FORTRAN
------,... .......
"...-..-..-
..........
83/06/30
~------------.----.-------'--------.---- ---------------.---
16.0 FUNCTIONS AND SUBROUTINES
16.10 TABLE 5 INTRINSIC FUNCTI1NS
-------------------------------------------------------------------Table 5 (continued)
Array-valued Intrinsic Functions
+--------------------+----------------.-+---------+---------+---------+-----------+----------+
:Number of; Generic: Specific:
Type of
:
.: .
:
; Intrinsi c Function·: Deflnition
:
Arguments~
nema
: Name
: Argument
: Function:
+------~-------------+-----------------+---------+---------+---------+-----------+----------+
Find ony true va1ue: .TRUE. If any
: 1 or 2
ANY
Logical
Logical
eJement of a1 is~
true nlonfJ
dimension .a2,
.FALSE. if no
elements of 1:11
are true along
dimension ,!l2
See Note 23
••
•
I
+--------------------+-----------------+---------+---------+---------+---~-------+----------+
Find 311 true
ALL
• TR UE. i f a I 1
logical
1 or 2
logical
v11ues
elements of .a1
are true along
dimension .a2,
.FALSE .• if any
element of al
is
false along
dimension 32
•• SJe Note 23
+--------------------+-----------------+---------+---------+---------+-----------+----------+
Matrix Multiply
Matrix Multiply
2
MATMUL
Integer
Integer
•
•
.al by 032
Real
See Note 24
Double
Double
Half
Half
Complex
logical
Complex
Logical
Real
Double
Half
Complex
Integer:
Integer
Integer
Integer
Integer
Integer
Integer
Integer
I
:
Real
+--------------------+-----------------+---------+---------+---------+-----------+----------+
Number of
See Note 25
1
RANK
Integer
Integer' :
dimensions of an
~rray
logical
Character
Bit
BooleAn
+------~---~---------+-----------------+---------+---------+---------+-----------+----------+
CONTROL DATA PRIVATE
. 16-38
Control Data Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------16.0 FUNCTIONS AND SUBRJUTINES
16.10 TABLE 5
InTRINSIC FUNCTIONS
Table 5 (continueo)
Array-valued Intrinsic Functions
+--------------------+---------------.-+---------+-------...;-i----------+-----------+----------+
: Intrinsic F'.lnction
~
:Number of: Generic: Specific:
Type of
:
:Ar9umcnts; Name
: Name
: Argument: Function:
Definition
+--------------------+--------------.---+-----.---+---------+-~-------+..;..---.-:'------+----------+
Pack ArraY into
See Note 30
2 or 3
PACK
:~1,~3
Int
1111,.a3 Real
V<-;ctor
:al,~3
:al,~3
Dble
Integer
Real
Double
Half
:al,B3 Cplx
Half
Cplx
Log
Char
:al,s3 Bit
:a1,a3 Baal
Logical
t
Character;
Bit
Boolean
:B1,~3
:~1,~3
+--------------------+---------------~-+---------+---------+---------+-----------+----------+
Unpack Vector Into
Array
See Note 31
UNPACK
3
:~1,~3 lnt
~al,~3 Real
:Bl~~3 Dble
Integer
Real
Double
Half
Cplx : complex
Lop : Logical
Char
Character
lal,a3 Half
:~1,~3
1~1,~3
~Bl'B3
:al,~3
;El,~3
Bit
Baal
Bit
Boolean
nl,a3 lnt
1l1,.a3 Real
Integer
Real
a1,~3
~1,~3
Double
+--------------------+-----------------+---------+---------+---------+-----------+----------+
S,~e N (I t e
Array
34
.
.,
2
:OIAGONAL
I
I
Half
Complex
a1,a3 Log
logical
tn1,~3 Char
Character
:~1,~3 Bit·: Bit
:Bl,s3 Bool ~ Boolean
~1'E3
:
:
Oble
Half
Cplx
+--------------------+-----------------+---------+---------+---------+-----------+----------+
:
of
: Sue Noto 35
:2 or 3 : SEQ
J Integer
I Integer
:
Sequt!nc<~
Int~1Ders
:
+--------------------+-----------------+---------+---------+---------+-----------+----------+
: Log i c a I AI t ern a t ion: See
t e 36
3 : Al T
: I nt e ge r
I Log i
I
r~ 0
C2
+--------------------+-----------------+---------+---------+---------+-----------+----------+
CONTROL DATA PRIVATE
16-39
Control Data Corporation Staniard FORTRAN
83/06/30
16.0 FUNCTIONS AND SUBROUTINSS
16.10 TABLE 5 INTRINSIC FUNCTIONS
-------------------------------------------------------------------~
,
.
,
Table 5 (continued)
Array-vnlued Intrinsic Functions
+--------------------+-----------------+---------+---------+---------+-----------+----------+
:Number of: Generic: Specific:
Type of
:
:
I n t r ins i c Fun c t i on
: 0 ofi nit ion
: A r 9 LJ men t $
1 f' \ am e
A r gum en t
: N am e
:
•
:~l
:~1
:~I
~sl
:
F un c t I
on
~
+--------------------+-----------------+---------+---------+---------+-----------+----------+
Size of Array
See Note 26
1 or 2
EXTENT
Integer
Integer
Dimensions
1
:
Real
Double
Half
:al Compl'ex
:£1 Logical
:al Char
:31 Bit
:~1 Boolean
Integer
Integer
Integer
Integer
Integer
Integer
Integer
Integer
:
+--------------------+------------~----+---------+---------+--------~+-----------+----------+
See Note 27
Integer
Integer
Size of Array
SIZE
1
Real
Double
Half
Complex
Logical
Character
Bit
Boolean
Integer
Integer
Integer
Integer
Integer
Integer
Integer
Integer
+--------------------+-----------------+---------+---------+---------+-----------+----------+
LBOUND
:El Integer
Integer
LOHer 80und
Sce Note 28
1 or 2
of an Array
Integer
Integer
:~1 Half
~ Integer
:~1 Complex: Integer
:~1 Logical
Integer
:£1 Char
Integer
:~1 Bit
Integer
Lnl Bool ean • Integer
:~1
Real
:B1 Double
:
~
I
•
+--------------------+-----------------+---------+---------+---------+-----------+----------+
Upper Bound
Note 29
1 or 2
UBOUND
Integer
Inteoer
Se~
:~1
of an Array
:31 Real
:~1 Double
:31 Half
:~l Complex
:~1 Logical
J~1 Char
:~I Bit
~E1 Boolean
Integer
Integer
Integer
Integer
Integer
Integer
Integer'
Integer
+--------------------+-----------------+---------+-----~---+--~------+-----------+----------+
CONTROL DATA PRIVATE
,16-40
Control Odta Corporation Standard FORTRAN
83/06/30
16.0
FUNCT I (]!'IS
16.10 TABLE 5
A NO SU8 RDUTINE S
INTRINSIC FUNCTIONS
---------------------------_._-----------------------------------.----..-.,
"
Table 5 (continued)
Array-valued Intrinsic FunctIons
+--------------------+-----------------+---------+----------+---------+-----------+----------+
lNumber of:
: Specific:
Type of
:
Gen~ric
: Intrinsic Function
: Name
: Argument: Function:
+--------------------+-----------------+---------+----------+---------+-----------~----------+
Convert
ROHwise Array into
:. CoJumn~,Jise ArreY
~
De'finition
:ArJuments: f.lRme
See Note 37
1
:
•
,,
'f
:ROWWISE:
:
:
:.
:
I
1
1
I
I
•.
•
•
s
,•
·
Integer
Real
Double
Half
Complex
Logical
Character
Bit
BooJean
Integer
Real
Double
Half
Compl~x
Logical
Character
Bit
Boolep.n
+--------------------+-----------------+---------+-------~--+---------+-----------+----------+
Convert
See Note 38
1
:COLUMNWISe:
Array
into Rowwise Arr3Y
Columnwis~
Integer
Rent
Double
Integer
Real
Doub)e
Half
Half
Complex
Logical
Character
Bit
Boolean
Complex
Logical:
character:
Bit
Boolean
+--------------------+-----------------+---------+----------+---------+-----------+----------+
Increase Rank
See Note 39
3
SPREAD
Integer: Integer
~l
of an arraY
.a1 Real
••
al logical
~l Char
a1 Bit
.a1 Bool
Integer
~1
~1
·
1
.
Dble
Half
Complex
: Integer
Integer
Integer
Integer
Integer
Integer
Integer
~1
+--~--~-----~~-~--~~~+~-~----~~-~---~--+~--~-~--~+----~~---+-----~~--~-~---------+----~-----+
RiJP II cate :1n
See Note 40'
3
:REPLICATE
array dimension
:
:
Integer: Integer
Integer
BI Oble
Integer
~I Half
Integer
~1 Complex: Integer
~l Logical: Integer
~1 Char
Integer
.al Bit
Integer
.al Bool
Integer
~l
..al Real
:
+--------------------+-----------------+---------+---------+---------+-----------+----------+
CONTROL DATA PRIVATE
.
16-41
Control Data Corporation Stendard FORTRAN
83106/30
-------------------------------------------------------------------16.0 FUNCTIJnS AND SUBRDUTINES
16.10 TABLE 5
INTRINSIC FUNCTIONS
----------------------------------------------~--------------------~
i n t ( 3. ) :: a • For 3 of
type
rea I ,
ha , f
precision, or double precisioh, there are two cases: If :B: <
1,
i nt Ca) =OJ
if
La: ~ 1,
intC.a)
is the
integer
whose
fl'lH]nitude
is
th;e
largest inte!.gcr that does not exceed the
mannitude of El and whose sign is the same as the sign of 3-
( 1 ) For .a of type 1n t e 9 e r ,
For';! Y. amp f e ~
int(-3.7) =-3
For B of type complex, int(~) is the value obtained
by applying thH above rule to the real part of .a.
For oS of type .reaJ, IFIXf.a)
For .:l of type Boo lean,
the bit string aFor 3 of type half,
is the same as INTCa).
INTC,a} t s the integer represented by
INT(a)=INT(REAL(A».
is.a. For .9 of type inteoer,
double precision) or half preclston, REAL{3)
is as much
procision or the significant part of a as a real
datum cnn
contain.
For.8 of type complex .., REAL(.a) is the real part of
(2) For .il of type real, REAl(.e)
3,.
For 3 of tYrq~
REAL(.]).
jnte!J~r,
FLOATCB) Is the same as
For .:l o:f typ':! Boolean, REAL(,a)
by the bit string a.
~
Is the real datum
tYPe double pr<-~clslon"
represented
Is £1.
For.a of type
os much precision of tho
part
double preCISion datum can
contain.
For 3 or type complel<~ OBLE(,3) is as much precision
of the significant part of the real part of a as a double
pr~cision rlatum can ~ontain.
(3) For
0'(
or
signi ficant
inte~8r
raal~
OBLEC.a)
DBLE(a) is
of E.l as a
For 3 of tYre half or Boolean, DBLE(B)=OBLECREALCa».
(4) CMPlX may have one or two nrauments.
If there is one
aruumant, it may be of. type tntcDcr, real, doubl~ precision,
o r COin pie x •
1 f t he rea r e t lol 0 a r 9 u men t.s , the y mus t bot h b e 0 f
the same type and may be of type integer, real, or double
pr·3cision.
For
~
of type complex, CMPLX(a)
Is
3-
For
E
of type integer,
conTROL DATA PRIVATE
16-42
Control Data Corporation stanrlard FORTRAN
--
83/06/30
..~
............. --..,...-- .............. -.... ----------------------------.-------- ---------------
16.0 FUNCTIONS AND SUBROUTINES
16.10 TABLE 5 INTRINSIC FUNCTIONS
-------------------------------------------------------------------real, or double precision, CMPLX(~)
is the complex value
whose real
part is REAL(~) and whose imaginary part is zero.
cr·, PL X ( .a 1 J .a2 )
i s the com pie x val u e who s ere a I par t i s REA L ( ..a 1 )
and whose imaginary part Is REAL(~2).
For 3 of type half or Roolean, CMPLX(B);CMPLX(REAl(a».
(5) ICHAR
provides n meens of converting from a character to an
integer, based on collating weight of the character
in the
col lutinG HBight tablG used hy thn processor. The first
ch8racter In the collating sequence corresponds to posItion 0
and the
last to pas; tion 0-1, where n is the number of
char3cters in the collating sequence.
ICHAR(a)
Is
an
lnteDer
In
the
range:
where
~
is
an
argumeht
of
type
character
o ~ ICHAR La) ~
ot': 1enoth one.
The vaJue of a nust be 8 character capabJe of
representation in the processor.
The collating weight of
thot char ;?'ct11r is the value of ICHAR.
v;~due
The
of
0-11
For any characters
( I C H;.\ R ( .G 1)
i fan don
~l and C2 capable of representation in the
.LE. C2)
is
true
if
ana
only
if
• L E. I CH AR (~2»
i s t rue ~ and ( £! 1 • E Q. ~ 2 ) i s
t rue
i f (I CHAR ( .G 1) • E(l • I C HAR ( ~ 2»
i 5 t r i.t ~ •
(~1
PrOC\3SS0r,
'y
CHARel)
returns a character having collating weight ~ In the
col luting Height table used by the processor
(3.1.5).
If
more than one character has collating Height 1, the choice of
chJr~oter raturnad is made by the processor.
The valu~ is of
typ:
char;':lcter
of
I(;!ngth
one.
1 must b'3 en Integer
expression whose value must be in the range 0 ~ 1 ~ 0-1.
= 1 for 0
ICHARfCHAR(l»
CHAR(ICHAR(~»-
~
for
~
1
~
1"1-1.
character
any
capable
of
representatIon in the processor.
(6) A
complex
(~L'Jl),
value is expressed as an ordered pair of r~als,
at is th0 real pert 1nd 31 ls the imaginary
~hDre
par t.
(7)
All
ara oxpr(-!sserl in radians.
an:JIt.~s
(8) The
result
value.
(9)
Allar~lume.nt$
t h .~
(IO)
of
S ~·1 met
a
in an
function of type complex js the principal
in·~rinsic
func·cion reference must
be
of
y p e.
INDEX(al,32) returns an integer value lndicating the starting
CONTROL DATA PRIVATE
16-43
Control Data Corporation Standard FORTRAN
83/06/30
-~-----------------------------------------------~-----------------16.0
FUNCTlnNS AND SUt3RDUTlt\!ES
16.10 TABLE 5
INTRINSIC FUNCTIONS
position within
j
dent i ca I' to
the
character
s tr J n~l :.a2.
string
31
of
a
sUbstring
If 02 occurs more than once in .a1,
the starting postion of the first occurence is returned.
If 52 do~s not occur in 31, the value zero Is returned.
t h at z e r 0 i s ret urn e d if lEN La 1) < lEN ( 11 2) •
Note
(11) The
v~lue
of the argument of the L~N function need ndt be
defined at the time the function reference is executed.
(12) LGE(nl,.a2) returns the value true if .al=.a2 or jf .a1
follows
s2 in the co!latlng sequence described in American Natlonal
Standqrd Code for Informat ion I nterchanae,
ANSI X3.4-1977
(ASCII), and otherwise returns the value false.
LGT(alJ32) returns the value true ifBl folloHs ~2 in the
col latinJ se~uence described in ANSI X3.4-1977 (ASCII), and
otherwise r3turns the v31ue false.
or if ~1 precedes
ANSI X3.4-1977
(ASCII), and otherwise returns the value false.
LLE(Bl~a2)
returns the value true if
,:1.2 in th8 collating
sequence
31=~2
descrlb,~d'
in
LLT(alJa2) returns the vAlue true if al precedes ~2 in the
collating sequence described 1n ANSI X3.4-1977 (ASCII), and
otherwise returns the value false,
If the operands "for LGEJ LGT, LLE, and LlT are of unequal
length, the shorter operand is
considered as if it were
extended on the right with blanks to the length of the longer
op8ranJ.
If either of the ch8racter entities being compared contains a
character that is not in the ASCII character set, the resu1t
is processor-dependent •.
(13) The values are uniformly dIstributed
in the range (0.,1.).
If one argument is present, it determines the shape of the
result returned.
For cxamplq~ RANF(B) where B has shape
(4,3) Hi 11 r~turn an zrray o·f random numbers \-lith shape (4,3)
and RANF(X) Hhere X is .~ scalar Hi 1·1 return a scal are
(14)
For .5 of type integer, real, or Boolean, BDDLLs) is the bit
string constituting the datum.
For 3 of type
double
precision,
h81f precision, or comple>c. BODL(~) = BOOl
(REAL(3»). For.a of type character" BOOL(.a) is the Boolean
.:12'tUf:l h::-:vinJ the ,/rJluc 01' the Yo) I.erith const~nt
CONTROL
DATA PRIVATE
16-44
Control Data Corporation Standard FORTRAN
83/06/30
........................ - ....... ..., ................. ---------------_._-----------------_.----------------
16.0 FUNCTIONS AND SUBROUTINES
16.10 TABLE 5 INTRINSIC FUNCTIONS
where:
n
is the integer having the value of MIN(~, LENCa»,
!l
is the maximum number of characters
representable in internal processor code in a
>lh~re
Bool-aan d.atum
f
(15)
Th',~
.:ihlft
is the string of the leftmost 0 characters of E.
Ls
loft
circular
i f
.a2~O,
and right \odth sign
extension and end off if a2<0. For 31 of type integer, real,
loUic:~d
or nool~:!an, the bit strlna constitutino the datum is
shifted. For 31 of type double precision or complex, the bit
strinJ .constituting REAL (al) is shifted.
strlng of a 1 bits occupies the leftmost 3 bIt positions
where g is the number
of bit positions in one
numeric storaae unit.
The f i l l Is u string o'f 0 bits. If
3=0, all bits In the result are 0 bits.
(16) The
jf
o<~~£,
(18) EXTB extracts bi ts from its first
argument, as indicated by
its second and third arvuments.
The first argument may be of
any data type except chnrscter or bit. For a half preclslcn,
double preclsion, or complex first argument, the argument Is
converted to REAL(a).
j
~ust
be of
type
integer.
Argument 1
the first bit to be extracted, numbering from bit
zer 0 on the I eft. Argument J ; nd I cates the number of bits to
be extracted.
Ar~uments
1 and
indicates
(19) INSB
its
araument.
fir s t
as indicated by
of its fourth
argument itself is not altered. The
inserts bits
from its first araument,
and third arguments, into a
copy
s'~cclnd
~\ n (I
The
fourth
four t h ::: r gum'} n t s
illS!'
h ;~ of
nn y
d:) t a t y pee Y. c e p t
character or bit. For a hAlf precision, double precisIon, or
complex first or fourth argument, the argument is converted
to R~AL(a) or R[AL(h) respectivelY.
A r J U nH~ n t s 1 G n d .J In us t b e 0 f t y pel n t e !J e r.
The res u I tis the
value of argument II except th::lt 1 bits beginning with bit 1
are repJaced wlth the rtuhtmost J bits from argument B.
Bits
are numbered from the left beginning with zero.
(20)
proriuc(!S r., result Hhich contair'lS the value from £.1 when
corresponding value in a3 is true) otherwise it contains
v~'u~ from 32.
33 Must be a scalar or
3rrBY expression
of type logical •
.al and . .a2 must be of the same type and they
must be conformabJe with E3. If 33 is a scaJar) 21 and S2
must be scalars.
al and a2 may be scalars or array
~1ERG;:
the
the
CONTROL DATA PRIVATE
16-45
Control Oats Corporation Standard FORTRAN
83/06/30
16.0 FUNCTIDNS AND SUBR1UTINf:S
16.10 TABLE 5 INTRINSIC FUNCTIONS
----------------------~---------~--------------------- -_._----_._-----
expressions, The result of r·1ERGE is of the Same type
and ~2 and has the same shape as B3.
ns
.61
and 32 must be one dimensional array expressions end must
have the same shape.
(21) 31
(22)
B
must be a two dimensional array expression.
If
the
shape
t h {? $ hap e 0 f t h .~: res u I t of T R AN S P 0 SE \., i I I b ,e
(n,m) with the yow and column values interchanged.
of
.B
is
( 1i1, n ) ...
0 mit t,~ 0.
CONTROL DATA PRIVATE
16-50
Control Data Corporation Standard FORTRAN
83/06/30.
-------------------------------------------------------------------16.0 FUNCTIONS AND SUBROUTINES
16.10 TABLE 5 INTRINSIC FUNCTIONS
.... -.......... -.........
............. - .... -,-- .... ............... ---- .................. ------ ........ ---- .... -----...... __ ... _------_ .... _---.-~-
-. ...-
--~
The result type of SPREAD is the same as the type of sl. If al Is a
scalar, .3.2 must equal 1. The result is a one dimensional array of
S12~ ~3 alJ of Hhose elements have the value ~1.
If ~1 is an array
Hith shape C.dl,.d2" ••• ,.do} then the result of SPREAOLal,1,.a3) is an
array, call
i
t
~E.J
:·Jith the shape of (.dl",!j2, ••• ,.dD) y.ihcre the
number of dimensions
value of array s~ction
al.
se(*,*,
total
and til is the added dimension. The
••• ,si, •••
where l~sj~! is given by
n+l
is
,,*>
(40) REPLICATE
produces
an
array
with the same number of
dimensions as 31 and the s~me type as Bl.
Bl must be an
array with dimension U where 1~n~7.~2 must be an integer
value such that 1~a2~D. a3 must be an integer value such
that
a3)O.
If ~l is an array expression with shape
(dl,d2, ••• ,~i, ... ~dn) then tha result of REPlICATE(~IJI'B3)
isan array Hith shape <.11,d2,.; •• ,.a3*,di, ••• !1n).
The value of
the result array Js 33 copIes of ~1 concatenated to form the
new lth dimension.
Restrictions
on thf: rnnge of nrQu'l1(2!ntz and results for intrinslc
TUi1ctions wl}'a!) feFf;renced ,by th(!ir specific names are as follows:
( 1) Rem a i n d e r i nrJ: The res u J t for ~1 0 DJ Ai'1 0 0" Hno D,
and 0 f1 0 0
und~rin~rl Hh~n tha valun of th! second ar0umcnt is zero.
(2) Transfer
of
is
If the value of the first argument of
r DS I GN i s .Z c r 0 ,
the
res u I t i s z e r 0,
which is neither positive nor neaative (4.1.3).
I S I GIl" S I GNJ
Sign:
HS I Gn,
0
(3) Square Root: The value of the argument of SQRT, HSQRT, and
DSQRT must be greater than or equal to zero. The result of
CSqRT is the principal value ~ith the renl part greater thnn
Or t!quf:I.1 to ,zero.
Wh€:n the rdaJ part of the result is zero,
the imaginary part is greater than or equal to zero.
(4)
Logar i thrns: The val ue of the ar JUITlBnt of ALOG, OlOG, HLOG,
ALOGIO, HLOGIO, 'and DLOGI0 must be greater than zero.
The
value of the argument of CLOG must not be (0.,0.1. The range
of the imaginary part of
the
result
of
CLOG
is:
-pi < imaginary part ~ pl. The imaginary part of the result
is pi only Hhen the real part of the argument is less than
zero and the imaginary part of the argument is zero.
(5) Sine, Cosino,
andTang~nt:
The absolutG value
or
of SIN, DSIN,., HSIN, CoS.:a DCoS., HeoS" TAN, HTAN,
the argument
and
DIAN
is
not restricted to be less than 2 pi •
. ( 6) Ar (: sin ~ :
T: H!
a b sol u t
and DASIN must be
va' u e 0 'f the a r gum e n t
less than or equal to one.
\~
0
-r
ASIN.. HAS IN,
The
range
of
CONTROL DATA PRIVATE
16-51
Control Data Corporation Standard FORTRAN
83/06/30
-------------~---~--------------------~---------~-------------------
16.0 FUNCTIONS AND SUBROUTINES
16.10.1 RESTRICTIONS or,,\ RANGE OF
ARGU~1ENTS
AND RESULTS.
-----------------------------------------~-------------------------~
the result Is: -pi/2 ! result
~.
pi/2.
(7) Arccosine: The absolute value of the argument of ACOS, HACOS,
and DACOS must be less than or equal to one. The range of
the resul.t Is: 0 ~ result! pi.
(8) Arctanuent: The range of the
result
for
ATANJ
HATAN,
and
is: -pI/2!. result! pi/2.
If the value of the first
a r J t.J fiI :~~ n t of AT A j\12.J HAT AtI2 , or 0 ATAN 2 i s p 0 sit i v o,t h e r e sui t
DATAN
is positive. If the value of the first argument is zero, the
result is zero if the second argument is positive and pi
if
the second argument is negative. If the vaJu~ of the first
araument is negative, the result is negative. If the v~lue
of the second argument is zero~ the absolute value of the
result is pi/2. The arguments must not both have the value·
zero.
The ranao of thf;! result for ATAN2J HATAN2, and OATAN2
Is: -pi < result ~ pi.
(9) Shift: The result for SHIFT is undefined when
the absolute
va)uD of the s3cond argument Is Jreater than the number of
bit positions in one numeric storage unit.
(10) Mask: The result for MASK is undefined when the 3rgument is
neJative or is greater than the number of bit positIons In
one nUMeric storage unit.
(11) Hyberbolic ArctanDent: The absolute value of the argument
ATANH must ba 1!:.1SS than one.
of
The above restrictions on argument~ and results also apply to the
intrinsic functions when referenced by their generic names.
The followino functions are· processor supplied but are not intrinsic
fUnctions.
As such, they may be freely replaced by user functions
o r sub r 0 uti n ,;~ S 0 f the sa fll e n a Me·,
T h I;;f () r In
I)
'f
,'1
r .:rf ere nee toO AT r;
Is:
DATE()
Ttl e 0 ATE fUn ~ t ion r iJ t urn s the Cl.J r r en t d 11 t tJ ;:! .s (l c h q, r ~ c t € r s t r i n 0
in
t h ~ 'f 0 r m ' J .:' Y y - mn-· d d • H h p r €' '! Yyy rep r~ sen t s the f 0 U r dig its of the
year, mm represents the number of the month (01,02, ••• ,12), and dd
the number of the day of the month. DATE must be declored to be of
t y pee h ,~ r 8 C t:H 1'1 i t h I!~ n ;:rt h 10 i n t he c ,:\1 lin g pro :J r a:n •
CONTROL DATA PRIVATE
16-52
Control Oat;;! Corp'oratlon StHndard FORTRAH
83/06/30
-------------------------------------------------------------------16.0 FUNC Trl];\lS AND SUB ROUTINES
16.11.2 TIr'1E
-~~~-~--~-~~-~~----~-~----~-~-~~---~-~~------~-~---~-------~-~~---~-
16.11.2 IIL1f.
The for m
0
f a r e fer en c e toT
I',' E
i
5 :
TInE ( )
The time function returns the current reading of the system clock in
the form 'hh:mm:ss'~ where hh is the hours from 00 to 23, mm is
minutes from 00 to 59, and 5S is seconds from 00 to 59.
TIME must
be d~clared character of length 8 in the call ing program.
Tho form of u
r~fer~nce
to SECOND is:
SECOND()
The SECOND function returns the number of CPU seconds used since the
heJinning of execution of the program as a value of type retl.
16.11.4 lO!:LAS.
Tha form of a raference to IOCLAS is:
IOCLAS(lQs>
where:
lQ~
is an error code returned by IOSTAT=.
Th.7;! IOCLAS function tal.) t h ':J t ,1 S SOC i ~ t ion b C~ tHe ~ n
3 c tuaI
ann d U!11 my a r gum e n t s
does not imply association of storage sequences except when the
actual argument is the name of a variab1e, array element, array
section, array, or substring.
In a function sUbproJf3m, an ENTRY statement causes the entry name
to become associated wi th ,the name of the function subprogram which
appears in the FUNCTION statement.
P Hr
t
ia I
ass 0
C
i:3 t, i on rn a y
~;:
i s t be t,~ e ~~ n en t i t i ~ s of d iff ere n t
types.
Except
for character entities, partia1 association may occur only
t h r 0 u !J h the use 0 f Cq ru'i 0 N, EO UI VA LEHe E, 0 r EN TRY s t F,I t em en t s •
Partial
association must not occur through ar~ument association,
except for arguments of type ch~racter.
I nth e e x am pie:
R:'=AL A(4),B
COflPLEX C (2)
nOUBLE PRECISION 0
EQUI V AL r: i't CE ( C ( 2) , A ( 2 ) , B ) ,
( A, 0 )
the third storage unit of C, the second storage unit of A, the
storaDe unit of B,and·the second storage unit of D are ,specified as
the sarno. TM2 storag9 sequenc~s may he i IlustrBted as:
CO I,t T R0 LOA TA ? RI VATE
Control
D~ta
18-3
Corporation Standard FORTRAN
83/06/30
--------------------------------------------------------------------
18.0 ASSOCIATION AND DEFINITION
18.1.3 ASSOCIATION OF ENTITIES.
storage unit
1
2:
3
4
5
:----C(1)---~----C{2)---:
: A(l):. A(2): A(3)~
1--B--:
A(4):
.: -----0-----:
A{2) and Bare total Iy
9ssociated: A{l)
A(l) and D,A(2)
associated.
The
following
are
partially
and C(l), A(2) and C(2), A(3) and C(2}, Band C(2),
an:! D, Band 0, eel) and 0, and C(2) and D.
Note
that although C(l) and C(2) are each associated with 0, CIl) and
C(2) are not assoclated with each other.
P .., r t I a I as s (1 C i r~ t jon of c h a r act 0 r e n tit 1e soc cur s whe n S 0 ffi e, but not
all~
of the storage units of the entities are the same. In the
example:
CHARACTER A*4,B*4,C*3
EQUIVALENCE (A(2:3),B,C)
A, B, and Care parti aJ Jy associ ated.
Variables, arrays, array sections, array
heco~e derin~d as fo1lows:
(1) Execution
character
elements,
and
substrings
bit, or
of,~n
arIthmetic,
logical, Boolean,
assignment statement causes each entity
that
P r !.! C c"1 0 S the
e q 1.1 a I s to t"l e com e d e fin {) d •
(2) As 8xecutlon of an lnput statement proceeds, each entity that
is assigned a value of lts corresponding type from the input
marlium bocomns ieFined nt the time of such assi]nment.
(3)
Ex~cutton
or
a DO
st2te~ent
caUses the DO-variable to become
defined.
(4) nCJinninC of
list
In
of Action specified by
'nput/output
statement
to become defined.
ex~cution
an
impl1ed-DO-v~rlabte
an
impl ied-DO
cnuses
the
(5) A DATA statement causes entitios to become Initislly defined
at tht! beginnina of execution of an exncutable program.
(6) Execution of an ASSIGN statement causes the variable 1n the
s tat em e n t to - be c 0 III e de fin e d VI i t has tat e me n t I ~1 h e I v al u c •
(7) Hhen :an entIty or (?i qivcn type becomes defined, 311
totallY
associated entities of the same type become defined except
that entities tota·lly associc:lted with the variable in an
ASSIGH .st~ltnm?nt becotll€~ und~;!fin~:!d~h,~n the ASSIGN statement
CONTROL DATA PRIVATE
18-4
Control Dat3 Corporation Standard FORTRAN
83/06/30
1a.0 ASSnCIATICJN AHD Dr;FINITIDN
18.2 t-:VENTS Tl·1AT CAUSE EnTITIES TO BECotlc DeFINED
is executed.
(8) A ref~rence to a subprogram causes a dummy srguMent to become
defined if the corresponding actual argument is defined with
a value that is not a statement label value. Note that .there
must be a!Jr~ernenl: betHcen the 3,CtU~11 f'rgl1m<;!nt and the dummy
arDurn~nt
(lb.9.3).
(9) Execution of an input/output
statement
containing
an
input/output status specifier
cnuses thn specified intf!ger
var1able or array element to become defined.
(IO) Execution of an INQUIRE statement causes any entity
assiGned
a
value
beG 0 ::.1 e d ef i n -':} d
during the execution of tho
I f n 0 err 0 reo n di t I on e x 1s t s •
that
state~ent
is
to
(II) When a complex entity becomes defined..
all
partial.ly
assoclated real or Boolean entitles become defined.
(12) Whon both parts of a complex entIty become defined as a
result of part} ally associated re~1 or complex entities
becoming defined, the complex entity becomes defined.
(13) Hhen "~Il
ch3r'acters of
'3
ch~racter
entity becomt~ defined,
the
character entity becomes defined.
(14) When all elements of
hecomes defined.
~n
array
becomB
defined,
the
array
(15) When
a I I elements
of
an arr ay sect i on become def i ned, the
Rrray section becomes defined.
(16) When
~ Booloan entity hecomes defined, aJI associated Integer
real
entities become defined. Hhen an integer or real
enti ty
becomes
defined,
al J associated Bool ean entities
("Ir
beGoli1('~
(17)
d:~f in~d.
.~ doubJo precision entity becomes defined, all partially
associated Boolean entities become defined.
~ll1en
(18) If both parts of ~ douhle precision entity become defined as
a r~suJt or PQrtlally associated Boolean entities becoming
defined, the double precision entity becomes defined.
(19) Zero-sized
defined.
Qrrays~
array sections and substrings
CQNTROl
are
DATA
always
PRIVATE
18-5
Control Datn Corporation stanrlArd FORTRAN
83/06/30
------------------~~-~~-~-~-~~~----~~~~~----~~-----~-------~~-------
18.0
ASSnCIATION AND DEFINITION
1 n • 3 ;:: VENTS T l·1 ATe AlJ SEE r'\ TIT IE S TO BEe 0 NE UN 0 EFIN ED
--------------------------------------------------------.--.----------
Variables} arrays, array sections, array
become undefined as fol Jows:
elements,
and
substrings
(1) All
entities ~re undafined at the beginninJ of execution of
an executable program except zero-sized arrays or those
entities ini ticllly defined by DATA statements.
(2) Wh8n
an
entity of a aiYentype becomes defined, al I totally
a~sociated
entIties of different. type become undefined.
However, when an entity of type Doolean is associated with an
entity of type integer or real, the Boo1ean ~ntity does not
bee 0 n e tJ n d 8 ? i n f} d H hen the i n ta :J 8 r 0 r rea 1 c n tit y i s d e fin e d
and the integer or real entity docs not become undefined when
the Boolean entity is defined.
(3) Execution of nn ASSIGN statement CBuses the variable in the
statement to become unrlefined as an integer.
Entlties that
are associated with the variable become undefined.
(4) When
an entity of type other than character becomes defined,
al) partiallY assocIated entities become undefined, with the
following exceptions:
( H)
!l h'J n
'3 n
<.1SS0Ci3t~~()
ity
0 f
t y P ,9 reG lor 13 0 0 I e an i spa r t 1.01 I y
!'lIth an entity of type complex, the
complex
t~ n t.
entity does not become undefined when the real or
Boole3n 3ntlty becomes 1efinod and the real or Boolean
entity does not become undefined when the complex
entity becomes defined
(b)
when an entity of type double precision and
OjC
t;'pe
Boote9n
£lre partially
assocl~ted,
on
entity
the double
Precision entity does not become undefined when the
Boolean entity is defined and the noolean entity does
not bccom~ undefined Hhen tho double precision entity
b€com':!s def i ned
(c) when an entity of type complex is partially associated
with another entity of tYP3 complex, d,finition of one
~ntity does not cause the other to become undefined.
(5) When the evaluation of a function causes an ,argument of the
function or 1n entity in common to become deFin8d and if a
rCrerDnco to th0 function n?pears In an expression )n which
the value of the function is
not needed to determine the
value of. the expression, then the aruument or the entity in
common bDcom~s unrlefinn~ ~hen the express10n is evaluated
(6.6.1).
CONTROL DATA PRIVATE
18-6
Control Data Corporation Standard FORTRAN
83/06/30
-~--------------------------------------------------~---------------
1H.O ASSOCIATION AND DEFINITION
13.3 EVENTS THAT CAUSE ENTITIES TO BECOME UNDEFINED
---~----------------------------------~-----------------------------
(6) The execution or u RETURN statement or an END statement
within a subprogram causes all entities within the subprogram
to become unc1efi n!:1d except for the rollo~ing:
(f:ll En tl ti e sin h I a n k com III 0 n
( b) I nit i a I I y
d e f f ned
en tit i es t hat
redefined nor become undefinad
(0)
ha v e
n e i the r
been
Entitles specified by SAVE statements
Cd) Entities in a named common block that appears in the
subproJr9m and nppaars in at
least one other program
unit that Is, either directly or indirectly, referencing
the subproo ram
(7) When an
error condition or end-at-file condition occurs
durinD execution of an Input statement, ai' of the entitles
specifled by the input list of the
statement
become
undefined.
(8) Execution of e direct access input statement that specifIes a
record that has not been previously written causes all of the
entities specified by the input I ist of the statement to
become undefined.
(9) Execution or an INQUIRE statem~nt
become undefined (13.10.3).
(10) Whan
~ny
may
cause
entities
to
character of a character entity becomes undefined,
the chart':icter entity becomes undeoflned.
(II) When an entity becomes undefined as a result of conditions
described
in (5) through (10), afl totally 2ssociatnd
entities
becom~J
unde'fined tindalJ partially
associated
entities of type other than character become undefined.
(12) When any array element becomes underlnad, the orray end any
array ~ections containIng that array become undefined.
This
does not imply that the undefinitlon of one array element
causes any other array element to become undefined.
CONTROL DATA PRIVATE
19-1
Control Data Corporation Standard FORTRAN
83/06/30
~-~~~---~~-~~--~--------------------------------------- -------------
19.0
SCOPf. AND CLASSES OF SYMSnLIC tlAi'lES
19.0
SCOPE AND CLASSES OF SYMBOLIC NAMES
A symbolic name consists of from one to thirtY-one alphanumeric
characters,
the first of which must be a letter. Some sequences of
characters, such as format edit descriptors and keywords that
uniquely identify certain statements,
for example~ GO TO, READ,
FORMAT, etc.J are not symbolic names in such occurrences nor do they
forn the first characters of symbolic names In such occurrences.
symbolic name is an executable program, a program
a statement function statement, or an
implied-DO list in a DATA statement.
The
scopa
unit, a.
of
a
PROGRAM statement,
The . nami~ of thn mnin pro£)ram and th~! nanes of block data
suGproJrams, externAl functions~ subroutines, and common blocks have
a scope of an executable program.
The names of variables, arrays, constants, statement functions,
intrinsic functions, NAMELIST groUp names, and dummy procedures have
a scope of a program unit.
The names or variables thst appaar BS dummy arguments in a statement
function statement have a scope of that state~ent.
The names of
implisd-DD in
variables that appear
as the DO-variable of an
a DATA statement have n scope of. the implied-DO list.
A symbolic unit name (15.1.1) or alternate unit name (15.1.2) has
scope of the PROGRAM statement in which it appears.
a
The
main
program,
common blocksJ
subprograms,
and external
procedures ar3 Dlobal entities of an executable program. A symbol.le
name th~t identifies D glob~1 entit~ must not be used to identify
any other global entity in the same executable program, except that
a common block name may be a program name or a subprogram name.
A symbolic name in one of the following classes is a global entity
in an ~xeoutahlc program:
.(1) Common block
(2) Extern81
(3)
fUnction
SUbr(l·utine
CONTROL DATA PRIVATE
19-2
Control Data Corporation Standard FORTRAN
83/06/30
-------------------------------------------------------------------19.0 SCDPE AdD CLASSES OF SYNBDlIC NAHES
19.1.1.1 Classes of Global Entities.
-------------~------------------------------------------------------
(5) Block data subprogram
The symbolic name of a local entity identifies that entity in a
single proaram untt. Within a prOgrBm un1t, a symbolic name that is
in ona class o'f entlttus lacet to the program unit must not also be
in another class of entities local to the program unit. However, a
symbolic name that identifies a local entity may_,
in a different
prO]rHf!J unit}
identify nnentity or any class that is either local
to that proJrnm unit or global to the executable program.
A
symbolic name that identifies a global entity in a program unit must
not 03 US·;! d to i d \~ n t i f ~/ a I 0 c a len t i t yin t h ;d: pro f.I r e n; lJ nit, e xc e p t
for
a C 0 Jilin 0 n b I 0 C }< n 8 m~ , 8 n fj x t ern a I fun c t I I) n n £'\ ma (1 9 • 2. 2 ), and a
.symbolic unit name or alternate unit name (19.2.13).
A
symbolic
name
in one of the followina classes is a local entity in
a program unit.
(Z)
Variable
(3)
Constant
(4) Statement function
(5) Intrinsic function
(6)
DU[iJm~'
procr;durl~
(7) NAMELIST group name
A symbolic name
Cl3ssified as a
that is a dummy argument of a proc~dure is
variable, array, or
dUMmy
procedure.
The
s p'3 C Jf i c at 1 on and us age mu s t no t v i 0 tat e the res pee t i vee 1 as s r u I e s •
In
program unit, a symbolic name must not be in more than one
except as noterl in the fol lowing paragraphs of this section.
·Th~re are no r~strictions on the appearances of
the same symbolic
na~e
in different proJrcm unlts of an executnble program oth~r than
those noted in this section.
d
class
CONTROL DATA PRIVATE
)
19-3
Control Data Corporation Standard FORTRAN
83/06/30
19 • 0
sCOP cAN 0
CLAS SES :) F SYnB() L I C NA('1 E S
19.2.1 COMMON BLOCK
A symbolic n3me is the name of a common block If rind
lPpears as a block name in a COMMON statement (8.3).
only
if
it
A common h10ck name is global to the executable program.
A common block name in a proJrsm unit may also be the name of any
local entity other than a constant, intrinsic function;t or a local
variable that is also an external function in a function subprogram,
If 3 name is used for both a common block ~nd a I~cal entity, the
aprp~arance
of that naHle In 'any context other than as a common block
name in a Cnf'Hl0r~ or S""E statement identifies only the local entity,
note that an intrinsic function name moy be a common block name in a
proJram unit that does not reference the intrinsic function.
A symbolic nlme is th~ name of an external function if It meets
of the following conditions:
any
(1) The name appears immediately following the word FUNCTION in a
FUNCTION stntement or th9 ~ord ENTRY in an ENTRY statement
within a function subprogram.
is not an array name, character variable name, statement
function nama, intrinsic function name, dummy ergument, or
subroutine name and every appearance is immediately followed
by a left parenthesis
except in a type-statement,
in an
eXTERnAL st'~ltemDnt, or as an actual argument.
(2) It
(3) The n:lme aPf'enrs ImmedIately follwing the word FUNCTION in a
FUNCTION statement in a procedure interface information
bloc~\,
In 3 function subprogram, the name of a function that appears
immediately after the word FUNCTION in a FUNCTION statement or
immediatelY after the Hord EnTRY In an ENTRY st:('\tement may also b~
the name Of ~ varlabla In that subprogr9m (16.5.1).
At
least one
such (unction name must be the name of a variable in a function
subproDram,
An
nxtcrn~1
runctlon name is global to the executable progrsm.
A symbolic nnme Is thf! name of n subrolJtlneiflt
t h ,~ f () J t 0 H i n £J c Q n d i t ion s :
meets
either
of
(1) The name appears immediatelY following the word SUBROUTINE in
:3
SUBROUTINE statement or
the ~tord ENTRY In an ENTRY
CONTROL DATA PRIVATE
19-4
Control Dsta CorporatIon Standard FORTRAN
83/06/30
-------------------------------------------------------------------19 • 0
SCOP 2 A!'l 0 CLAS SES 0 F SYn B;] LIe tlA HE S
19.2.3 SUBRDUTINE
~~~~~-~----~~--~~-~~~---~------~---~--~~~---~---~~~---~-~-------~~--
.s t d t d men t
!,'
i t h in;)
5 lJ h r 0
u t f n e S tl b pro 9 ram.
(2) The name appears ImmediatelY following the word
CALL statement and is not a dummy argument.
CALL
in
a
A subroutinu name is global to the executable program.
A symbolic name is the name of n main program i f und only if it
appears in a PROGRAM statement In the ruuin program.
A main program name is global to the executable program.
A symbol Ie n18E is tha n~me of a block data subprogram if
i f it appears in a BLOCK DATA statement.
and
only
A block data subprogram name Is global to the executable program.
19.2.6 ARRAY
A symbolic
name is the n~me of'gn array if it appears as the array
name in an drrz.y declarator (S.2) in a DIHENSION, ROH\
?
E
F
G
H
I
J
K
74
P
75
76
77
71;
79
80
Q
Dl
49
R
B2
50
S
03
84
35
86
51
L
r1
N
0
,T
U
V
H
X
Y
87
88
80
5
16
2
46
47
48
52
53
54
55
56
.57
12
19
54
55
56
57
51:1
59
60
61
62
63
53
14
24
22
9
n
1
25
26
27
28
2q
30
31
32
33
35
36
37
38
39
40
41
42
43
45
46
47
48
49
50
51
C]~'TROl
48
43
51
55
56
41
42
39
37
46
38
47
40
27
28
29
30
31
32
33
34
35
36
0
63
58
44
59
57
60
1
2
3
4
5
6
7
8
q
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
DATA
PRIVATE
CONTROL DATA PRIVATE
Control Data Corporation
Standar~
31
FORTRAN - Addenda
83/06/30
APPl:NDIX B
SUMMARY OF LANGUAGE EXTENSIONS
Below is a list of Control Data Common FORTRAN
that constitJte extensions to ANSI FORTRAN, 77.
1. S}mbotic names can be
include an underscore.
up
2. Bit d a tat y pea n d mac h i new 0 r d
typas hit and Bool~an)
1. The
charac-bsrs
language
features
to 31 characters In length and may
0
r i en ted
bit
rnn nip u I a t ion
( for .
"(quote) ;3nd underscore are added to character
set
2. Collation control (for character relationals)
3. C$-dlrectiv8S
2. Bit type
3. Half Precision type
4.
Hollerith~
octol, and hexadecimal constBnts
5. Symbolic constants as reat and
imaginary
parts
of
a
complex
const~\nt.
1. Boolean entities can appear in dimension bound expressions.
hJ~f
precision, double precision, complex, and Boolean
expressions as subscript or substring expressions.
2. Real,
3. Array sections
It.
Assulned sh:t!pe dummy ·'Jr r
8YS
5. Allocatable arrays
6. E,:tend :,'~ljlJst~bll~ diTt1f-nsion bounds t~Kpr;~ssion.s to allox at I
entities except external function references and array element
referenGcs
7. ALLQCATE and FR2E statements
CONTROL DATA PRIVATE
02
Control Dqta CorpOfEttion st:Jn r hlrd FORTRAn - Addenda
83/06/30
APPENDIX D - SUMMARY OF
LAN~UAGE
EXTENSIONS
8. Rowwise arrays
1. Boolean expressions
2. Boolean entjties In arIthmetIc expressions
3. Double precision and complex operands can be combined using
+.. -, ~~J and I ·operators.
the
4. A double precision operAnd can be roisad to a complex power.
5. Boolean entities in relational eXpressions
6 •• XDR.
operator
7. Bit expressions
8. Bit entities in relational expressions
1. BOOLEAN type st3toment
2. BIT type stntement
3. HALF PRECISION type statement
4. INTE:RFAC1; and
:::no
INTERFACe stBtements
5. ROWWISE statement
6. Entities
in n C1:f1~ d common blocJE OF SY;'H30LIC NAi;1ES AnD STATENEJ,lT lABELS.
,2.11 LIST
• • • • • ••
••
• ••••••
2.12 DEFINITION STATUS • • • • • • • • • •
• ••
2.13 REFEREHC;:.
• • • • • • • ••
••
•
2.14 STORAG~ •
•••••••••
•••••
•
2.15 ASSOCIATION . . . . . ~..
....
• .......
2.16 SHA.PE • • •
•••
•••••••
•
••
2.17 CONFlJR;-tABILITY • • • • • • • • • ••
• •••
Z.ln ALLOCATABLE .. • • • •
........
• ••
11
• • •
•
·· . .
• •
'.
• •
.
• • • • •
•
• • •
• • • • •
· .
• • • •
. · '•. .•
• •
• •
•
•
..
..
•
• • •
•
• • • • •
• •
·• ..• .•
• •
• • •
• • ..
• • •
• • •
• • •
.• •
..
• •
• •
• •
.
.
• •
. ·• .•• ••
..
'
..
..
,
• •
CHARACTERS) LInES, AND EXECUTION .seqUENCE: • • •
3.1 FDRTRAN CHARACTER SET • • • • • • • • • • •
• •
J.1.1 l[TTERS
••••
..
••••
• •
•
..
3.1.2 DIGITS.
• • • • • ••
• •••• • •
•
3.1.3 AL?'IAnUllERIC CHARACTERS. • • ••
• • •
•
3.1.4 SPECIAL CHARACTERS.
••
•
••• • • • •
3.1.5 COLLATING SEQUENCE AND GRAPHICS. •• •
•
3.1.6 BLAHI< CHARACTER. • • • • •
•
• • • • •
3.2 LINES • ••
•
•
• • • • • • • • • • • "
•
3 • 2 • 1 CO fH'1 E:1 T LIN E • • .• •
• •
• • • • • • •
3.2.2 InITIAL LIN::.
• • • • • • • •
• • • • •
J.2. 3 Cr)NTINUATI~);'l LI Nt: ..
• • • •
•
• • • • • •
·3.3 STATEnENTS
•
• •• •
•
• • • • • • • • • •
3 .. 4 STAT E;'1 EHT LAB ELS
• • • • • • • •
.
• •
3.5 ORDER OF STATEM~NTS AND LINES
•
• • • •'.
3.6 NORMAL ~XECUTION SEOUENCE AND TRANSFER OF CONTROL
3.7 C~-DIRECTIVES ••
...........
. . ..
3.7.1 LISTING CONTROL. • • •
•••••••
3.0
·
., .
."
..
• • • •
• • • ,•
• ..
• • • •
• • • •
• • • •
• • • •
.
1-2
1-3
2-1
2-1
2-1
2-2
2-2
2-2
2-2
2-3
2-3
2-3
2-3
2-4
2-4
2-4
2-4
2-5
2-5
2-5
2-6
2-6
2-7
2-7
2-8
2-8
3-1
3-1
3-1
3-1
3-2
3-2
3-2
..
• • •
3-4
• •
• • • •
• • • •
• • •
• • • •
• • • •
'.
1-1
3-3
3-3
3-3
• • • •
• • •
"
1-1
• •
'•. ..
3-4
3-4
3-4
3-5
3-6
3-7
3-8
CONTROL DATA PRIVATE
2
Control Data Corporation Standard FORTRAN
83106/30
TABLE OF COnTENTS
3.7.1.1 List Option Switches
3.7.2 CONDITIONAL COMPILATION •
3.7.2.1 Processor Control. •
3.7.3 COLLATION CONTROL • • • •
3.7.4 DO-LOOP CONTROL • • • • •
• • • • • •
• • • •
• •
• • •
• • • • • •
• • •
• • • • •
• • • • • • • •
·• •
..
•
.
• •
..
•
.•
..
• • • • •
3-q
3-9
3-11
3-11
• • • • • • • • •
3-12
4.0
DATA TY?ES AND C;:)t'lSTANTS • • • • • • • • • • • • • • ••
•• • • • .. • .. .. • .. .. • .. • .. • • • • • ....
4.1.1 DATA TYPE OF A NAME. •
....
............
4.1.2 TYP~ RULES FOR DATA AND PROCEDURE IDEilTIFIERS. . . . .
4.1.3 DATA TYPE PROPCRTIES.
•••••••••••••••
4.2 CONSTANTS.. .. .. • • • ...
.. . . . . . . . . . . . . . . . . . . ~
4.2.1 DATA TYPE OF A CONSTANT. • • • • • • • • • • • • • •
4 • 2 • 2 B l An}( SIN C D N S T A 1,1 TS •
••••••••••••••••
4.2.3 ARITHMETIC CONSTANTS.
...
..................
4.2.3.1 Signs of Constants.
.........
•••••
4 • 3 I ',1 TE GER TYPE
.. • • • •• • • • • ...
••••••••
4.3.1 II1T:::GER cor:STANT.
..............,.
4.4 REAL TYPE • .. .. • • .. • • • .. • ...
.............
4.4.1 BASIC REAL CONSTANT. • • •
•••
••••••••
4.4.2 ReAL EXPONEnT. • • • • •
4.4.3 REAL COnSTANT.
•••
........
••
•••
4.5 DOUBLE PR~CISION TYPE
••
•••
••••••••••
4.5.1 DOUBLE PRECISION EXPONENT. • • • • •
• • • ••
4.5.2 DOUBli PRECISION CONSTANT.
••
4.6 COMPLEX TYPE • ••
••••••••
•
••••••
4.6.1 CfH1 P Lt X CONS TAn T • • • • • • • • • • • • • • • • •
4.7 LOGICAL TYPE
•••••••
4.7.1 lOGICAL conSTANT.
•
................
4.3 CHA~ACT~R TYPE • • • • •
••••
••••••••••
4-1
4.1 DATA TYPES
4-1
4-1
I
4 • B • 1 C H A RAe T ERe n N ST A !\\ T •
•
•
I
•••••••••
I
•
•
•
•
•
•
•
•
••
•
•
•
••
I
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
••
4-1
4-2
4-2
4-2
4- 3
4-3
4-3
4- 3
4-3
4-3
4-3
4-4
4-4
4-4
4-4
4-4
4-5
4-5
4-5
4-5
4-5
•••
4- 6
• • • • ••
•••
............
4.9.1 BOOl~AN CONSTANT • • •
• • • • • • ••
4.0.1.1 ~ol lerith Constant • • •
............
4.9.1.2 Octal Constant •• • • • ••
•••••
••
4.9.1.3 Hexsdecimnl Constant
•••••••••••••
4.10 HALF PRECISION TYPE •
4.10.1 {)ALF PRECISIOn :;XPONEtiT
••
••••••••••
4-6
4-6
4-6
4-7
4-8
4-8
4-8
4.9 BOOLEAN TYPE
I
I.
(tt
1 0 • 2 :·IA l F PRE CIS I
on
CON S T AHT
4.11 BIT TYPe •
• • • • • ••
4 • 11 • 1 BIT COl ,1 STAIl T .. .• .. • ••
...
•••
I.
•
I......
• • • • • • • • • ••
4- 8
•••••••••••••
••
•
••••••••
4-9
4- 9
·
~j.O
ARRAYS AnD SU(3STRINGS • • •
• ••••
•
..
5.1 ARRAYS AND ARRAY S2CTIONS • • • •
•
5.1.1 ARRAY NAME AND ARRAY S~CTlaN R~F~RENCE • •
5.2 ARRAY DECLARATOR • • • • • • ••
••
• • •
5.2 .. 1 FORM OF AN ARRAY DECLARATOR.
• • .. .. •
5.2.1.1 Form of a Dimension Declarator
•
• •
5.2.1.2 Value of Dimension Bounds
•
5.2.2 KINDS AnD OCCURRENCES OF ARRAY DECLARATORS
5.2.2.1 Actual Array Declarator.
• ••• •
5.2.2.2 Dummy Array Declarator
•
•
••• •
5 • 2 • 2 • 3 )\ I I 0 cat .:1 h 1(! A r ray D f! C I ~ r ntor
••
•
5.3 PROPERTIES OF AN ARRAY
•
5.3.1 OATh TYPE OF AN ARRAY AND AN ARRAY ELEMENT
I
•••••
I
I .••
'I..... .. . .
...
..
5-1
• • • • •
5-1
. .• • •
..
5-2
5-2
•
5-:- 3.
5-3
5-3
• ••
•
• • • • •
5-4
5-4
• • • •
• • • • •
..
..
• •
• ••
• • • • •
• • • • •
..
•
..
••
..
5-1
5-1
4
5-4
•
5-4
CONTROL DATA PRIVATE
3
Control Data Corporation Standard FORTRAN
83/06/30
TABLt OF CONTCNTS
·· .. .. ..' .. .. .. .'.
.. .. .. ... ..
5.3.2 DIMENSIONS OF AN ARRAY
• • • • • • • • • • •
• • •
5.3.3 SIZ[ OF AN ARRAY • • •
• •
5.3.4 AR RAY ELEN2f'·1 T ORDER ING
• •
5.3.5 ARRAY STORAGE SEqUENCE
..
..
..
5.4 ARRAY ELEMENT NAME • • • • • • • • • • • • • • • • • • •
5.5 SUBSCRIPT • • • • • • • • • • • • • • • • • • • • • • • •
:).5.1 FDRf'1 OF A SUBSCRIPT ••
5.5.2 .SUBSCRIPT EXPRESSION • • • •
• • • • • • • • • • •
5.5.3 SUBSCRIPT VALUE • • • • • • • • • • • • • • • • • • •
5.6 ARRA Y SECTION t·\Af1ES. • •• • • • •
,.
.
5.6.1 SECTION SUBSCRIPT • • • ..
.. .. ..
5.6.1.1 Form of a Section Subscript • • • • • • • • • ,. •
5.6.1.2 Section Suhscript Expression • • • • • • • • • •
5.7 ARRAY SECTION. • • • • .. • • ••
• .......... .
.5.a DUf1 MY AIt D ACTUAL ARRAYS • • • ••
•••••••••••
5.8.1 ADJUSTABLE ARRAYS AND ADJUSTABLE Dlf·)ENSIONS • • • • •
::;. '9 USE OF J\RRA Y NArtE S • • • • • • • • • • • • • • • • • • •
5.9.1 APPEARANCE OF ARRAY SECTION NAMES • • • • • • • • • •
5.10 CiIARACT::R SUBSTRING. • • • ••
• ••••••••••
5 • 1 0 • 1 SUB 5 TP. I NG ·~··l A~., t; • . . . . . . . . . . . . . . , . . . .
5.10.2 SUBSTRING EXPRESSION.
• .............. .
· . ·.. ..... .
•
'9
.
•
•
•
•
•
•
•
•
'9
•
•
..
..
·· .. . . . .. . .. .. .. ..
6.0 EXPRESSIONS
•••••••••••••••••••• • •
6.1 ARITHHETIC EXPRESSIOnS • • • • • • • • • • • • • • • • •
6.1.1 ARITHnETIC opERATORS.. . . . . . . . . . . . • • • ..
6.1.2 FDRH AND ItlTERPR2TATION OF ARITHHETIC EXPRESSIONS • •
6.1.2.1 Primaries • • • • • • • • • • • • • • • • • • • •
6.1.2.2 Factor.
••••••••
• ••••••••••
6.1.2.3 Term.
••
• ••.•••••••••••••••
6.1.2.4 Arithmetic Expression. • • • • • • • • • • • • •
6 • 1 • 3 ARI T l.J It ETIC C 0 ;\1 S TAn T E Xr RES S I f) ~ •
••••••••••
6.1.3.1 Integer Constant Expression.
• •••••••••
6 • 1. 4 T Y PEA NDIN T E RPRE TAT 10 t,t 0 FAR IT! -H1 ETIC E XPRE S SID NS • •
6.1.4.1 Boolean Operands and Arithmetic Operators •• ,. •
6.1.5 INTEGER DIVISION.
• ••••••••••••••••
6.2 CHARACTER EXPRESSIONS • • • • • • • • • • • • • • • • • •
6,2.1 CHARACTER OPERATOR.
• •••••••••••••••
().2.2 FflRl"l AND Ii\lTER? RET ATIOt·l OF CHARA CTE REX pRE SS IONS.
•
6.2.2.1 Ch2ractar Primaries. • . . . . . . . . . . . . ..
6.2.2.2 Character Expresslon.
• •••••••••••
6.2.3 CHARACTER CDNSTANT EXi>RESSIDN.
• ••••••••••
6 • 3 Rc L ATID I'l ALE XPRE SSIOn S • • • • • • • • • • • • • ••
•
6.3.1 RELATIONAL OPERATORS.
• ••••••••••••••
6.3.2 J..\P.ITH1'lETIC RELATIONAL EXPRESSlor,~.
..,. ••••••
6.3.3 IHT~rtPRETATION OF ARITHt·1ETIC RELATIONAL ~XPRESSIONS •
6.3.4CHARhCTER RELATIONAL EXPRESSION • • • • • • • • • • •
6.3.5 INT~RPRETATION OF CHARACTER RELATIONAL EXPRESSIONS •
6.3.6 BIT RcLATIn/:AL eXPRESSION • • • • • • • • • • • • • •
6 • '3 • 7. . I NT;: RPRE T AT I Q tl 0 F f3 I T RE LAT T j] NALE XPRE SSI eN S. • • • •
6.4 LOGICAL EXPRESSIONS . . . . . . . . . . . . . . . . . . . .
6.4.1 LOGICAL OP:RATnRS. • • • • • • • • • • • • • • • • •
6.4.2 FDRn AND IHTERPRETATION OF LOGICAL EXPRESSIONS.
••
6.4.2.1 Logical PrImaries. • • •
......
• ••••
6.4.2.2 logical Factor.
• •••••••••••••••
6.4.2.3 logicli Term,
•••••••••••••••••
.
5-4
5-5
5-5
5-6
5-6
5-6
5-6
5-7
5-7
5-10
5-10
5-10
5-11
5-11
5-12
5-13
5-14
5-14
5-15
5-15
5-16
6-1
6-1
6-1
6-2
6-3
6-3
6-4
6-4
6-5
6-6
6-6
6-11
6-11
6-12
6~12
6-12
6-13
6-13
6-14
6-14
6-14
6-15
6-15
6-15
6-15
6-16
6-16
6-16
6-17
6-17
6-18
6-18
6-1H
CONTROL. DATA PRIVATE
4
Control Dqta Corporation Standard FORTRAN
83/06/30
TABLE OF CONTENTS
6.4.2.4 Logical Disjunct.
• •••••••••••• • •
6.4.2.5 LO~Ji cal E/~rrc!ssion.
• • • • • • • '• • • • • • •
6.4.3 VALUE OF LOGICAL FACTORS, TERMSI AND EXPRESSIONS • •
6.4.4 LnGICAL CONSTANT EXPRESSION.
• •••••••••••
6.5?RECEDEnCE OF D?ERATORS • • • • • • • • • • • • • • • • •
6 • 5 • 1 S1..1 NilA RY DFIN TERPRE TAT ION RULE S. . . . . . . . . , . .
6.6 EVALUATION OF EXPRESSIONS • • • • • • • • • • • • • • • •
6~6.1 EVALUATION OF OPERANDS.
• •••••••••••••
6.6.2 ·ORDER OF EVALUA TION OF FUNCTIOf,IS.
• ••••••••
6.6.3 INTEGRITY OF PARENTHESES.
• • • • • ,. • • • • • • •
6.6.4 RESTRICTIONS ON APPEARANCE OF ARRAY EXPRESSIONS • • •
6.6.5 eVALUATION OF ARITHMETIC EXPRESSIONS
••••••••
6.6.6 EVALUATION OF CHARACTER EXPRESSIONS • • • • • • • • •
6.6.7 EVALUATION OF RELATIONAL EXPRESS IONs • • • • • • • •
6.6.8 EVALUATION OF LOGICAL EXPRESSIONS • • • • • • • • • •
6.7 BOOLEAN :XPRESSIONS • • • • • • • • • • • • • • • • • • •
6.7.1 BOOLEAN OPERANDS • • • • • • • • • • • • • • • • • •
6.7.1.1 Boolean Primary • • • • • • • • • • • • • • • • •
6.7.1.2 Boolean Factor • • • • • • • • • • • • • • • • •
6.7.1.3 Boolean Term • • • • • • • • • • • • • • • •
6.7.1.4 Boolean Disjunct • • • • • • • • • • • • • • • •
6.7.1.5 Boolean Expression • • • • • • • • • • • • • • •
6.7.2 VALUE OF BOOLeAN FACTORS, TERMS, AND EXPRESSIONS
••
6.7.3 BOOLEAN CONSTANT EXPRESSION • • • • • • • • • • • • •
6.8 CONSTANT ~XPRESSIONS
••••••••••••••••••
6.9 BIT EXPRESSIONS • • • • • • • • • • • • • • • , • • • • •
6.9.1 BIT OPERATORS.
• ••••••••• , ••••••••
6.9.2 FORM AND INTERPRETATION OF BIT EXPRESSIONS.
• •••
6.9.2.1 3it Primaries • • • • • • • • • • • • • • • • • •
6.9.2.2 Bit Factor.
• •••••••••••••••••
6.9.2.3 nit Term.
• ••••••••••••••••••
6.9.2.4 Bit Disjunct.
• ••••••••••••••••
6.9.2.5 Bit Expression.
• •••••••••••••••
6.Q.3 VALUS OF BIT FACTORS, TERMS, AND EXPR~SSIONS
••••
6.9.4 BIT CONSTANT EXPRESSION. • • • • • • • • • • • • • •
8
•
6-19
6-19
6-19
6-20
6-21
6-21
6-22
6-24
6-24
6-24
6-25
6-25
6-27
6-27
6-28
6-28
6-28
6-28
6-29
6-29
6-29
6-30
6-30
6-32
6-32
6-33
6-33
6-34
6-34
6-35
6-35
6-35
6-35
6-36
6-37
7.0 STATEMENT CLASSIFICATION • • • • • • • • • • • • • • • •
7.1 EXeCUTABLE STAT2MENTS • • • • • • • • • • • • • • • • • •
7.2 NONEXECUTABLE STATEMENTS • • • • • • • • • • • • • • • •
7-1
7-1
7-2
SPECIFICATION STATEMENTS. • • • • • • • • • • • • • ••
8 • 1 0 I r' ENS I J ;'\ S TAT E r, E NT. • • • • • • • • • • • • • • • • ••
8.2 EQUIVALEMCE STATEMENT • • • • • • • • • • • • • • • • a ,
D• 2 • 1 FOR It OF AN EQUIVALENCE S TAT Et1 ENT. • • • • • • • ••
3.2.2 EqUIVALENC~ ASSOCIATlnrl.
• ••••••
D.2.3 EQUIVALENCE OF ENTITIES OF DIFFERENT TYPES • • • • •
8-1
8-1
8-2
8- 2
0.0
I
o•2 • 4
ARRAY NA t1 E SAN DAR RAY EL EMEN T
~ \ A N ES •
•
•
•
•
••
8-2
8-2
••••••••
8- 4
8.2.5 RESTRICTIONS ON EQUIVALENCE STATEMENTS.
••••••
8.3 CfH1NOH STAT~:i'!E!'lT
• • • • • • • • • • • • • • • • • • ••
8 • 3 ,. 1 FOR n n F A COM i'10 N STAT Erl ENT.
..,....,......
A.3.2 COMlF1N BLOCK STORAGE SFQU~:NCE.
•••••••••••
:.1.3.3 srz:.; !'IF A C:lf'\;Vlt.l BLOCK,
••••••••••••••
3.3.4 CDHiE)n ASSnCIATI[Ji~.
• • • • • • • • • • • • • • ,..
8.3.5 DIFFERENCES BETWEEN NAMED COMMON AND BLANK COMMON ••
0.3.6 RESTRICTIONS ON COMMON AND eqUIVALENCE.
••••••
8-4
8-4
8- 5
8-6
8-6
8-6
8-6
8-7
CDI1TROL DATA PRIVATE
Control Data Corporation
Stanrl~rd
5
FORTRAN
83/06/30
TABLE OF COnT:::NTS
B.4 TYPE-STATEMENTS • • • • • • • • • • • • • • • • • • • • •
.3 , 4 • 1 BIT.1 BOll L i: AH, AND ARIT H !t E TIC T YP E- STAT E r··, EnT S
• I • •
g • 4 • 2 CH ARAe T E R T Y PE- S TAT Er'H: n T •
••• I • I • • • • • • •
8.5 IMPLICIT STATEMENT • • • , • • • • • • • • • • • • • • •
R.6 PARAMETER STATEMENT • • I • I I • • • •
8.7 EXTERt,\AL STA Tf:HcNT • • • • • • • I • •
D.g INTRII,lSIC STATEIlENT • • • • • • • I • •
0.9 SAVE STATEMENT
• • . • • • • • • • I . ' .•
!1 • 1 0 ROyal I S~ STAT EH r.: NT
I
'.'
•
•
•
•
•
•
•
f).0
DATA
II
••••••
•
•
•
•
•
•
I
I
I
I
I
••••
•
•
•
• • • • • ...•••
I
•
•
•
•
••
I
•••••••
•••••••••••
I
• • • • • • •
B.11 PROCEDURE INTERFACE INFORnATION
8.12 VIRTUAL STATEMENT
•
•
I
•
•
•
•
•
STATEMENT • • • • • • • • , • • • • • • • • • • • •
8-9
8-10
8-11
8-12
B-13
8-14
8-14
8-15
9-1
9-1
0.1 FllR~\ OF A DATA STATEN£:NT • • • • • • • I I • • • • • • •
9.2 DATA STATEMENT RESTRICTIONS • • • • • • • • • • • • • • •
9-1
3 Ii1PLIED-OO IN A DATA STATEf1ENT
•••••••••••••
Cl.4 CHARACT E R CDN STANT IN A DATA STATE r'12 NT. I • • • 11 • • •
9-3
9-3
10.0 ASS I Gi·FH:: NT S TAT En 1: NT S • • • • • • • • • • • • • • • • •
10.1 ARITHMETIC ASSIGNNENT STJ\TEMENT
• • • • • • • ••• • • •
10.:2 LOG I CAL ASS I G1Hl EN T S TAT ErH2 nT • • • • • • • • I • • • • •
10.3 STAT L 1-1 t: H T LAB:: lAS SI GN~1 EN T (A SSI Gn ) STAT £: Mt HT • • • • I
10.4 CHARACTER ASSIGNMENT STATEMENT. ,. ... ~ •• ,.
.,.
10-1
10-1
10-2
10-2
10-3
.10-4
10-4
10-5
10-5
10-5
~).
1 0 • 5 N UL TIP L:: ASS I GnM[: 11 T S TAT EHEN T • •
10.6 BfJOLEAH ASSIGNf1ENT STATE~'ENT • • •
10. 7 BIT ASS I GN [,1 E NT S TAT E ;1 E NT. • • • •
10.a ARRAY ASSIGN11EHT STATEMENTS • • •
10.8.1 IDENTIFY STATEMENT • • • • • •
10.0.2 FORALl STATEMENT •• ,. • • • •
11.0
CONTROL
STATC:i1ENTS
•
I
•••
11.1 UNCONDITIONAL GO TO STATEMENT
11 • 2 CjJ ~1 PUT ED GOT 0 ST /\ TEN ENT. • •
11.3
ASSIGN~D
••
I F S T AT E tl E NT.
•
•
... .
• • • ••• • ••• • • •
·• .• .• .• ..• .• .• .• .• .• .•
• • • • • • • • • • •
·• .• ..• .• .• .• .• .• .• .• .•
,
••••••••••
•••••••••••••
•
•
GO TO STATEMENT • • • • •
11 • 4 AR I T ;,1 ,<,1 [; TIC
•
•
•
•
I
. . . . . . . . . .
•
,.
•
•
•
•
I
•
•
•
•
•
•
•
•
•
•
•
•
•
•
11.5 LOGICAL IF STATEMENT • • • • • • • • • • • • • • • •
11.6 BLOCK IF STATEMENT • • • • • • • • • • • • • • • • I
11.6.1 IF-LEVEL.
11.6.2 IF-8LOCK.
ELS~
..
•
••
• •• ,. • • • • • • • • • • • • • • ~ ••
• •••• , •••••••••••••••
11.6.3 EXECUTION OF A BLOCK IF STATEMENT.
11.7
IF STATEMENT
11.7.1 ELSE IF-BLOCK.
• •••••••
•••••••••••••••••••
• ................. .
11 • 7 • 2 E XE CUT ION 0 FAN E L S E I F S TAT E r" E NT.
11.8 ELSE STATEnENT
•••••••. ,
...,....
•••••••••••••
11.7,.1 ::LS,::=-BLOCl(.
•• • • • • • • I • • • • • • • • • • •
11.8.2 EXECUTION 8F AN ELSE STATEMENT.
• •••••••••
11 • 9 Et~ D I F S TAT Et" En T • • • • • • • • • • • • • • • • • • • •
11.10 DO STATEMENT
•• ~ • • • • • • • • • • • • •
11.10. 1 R Ai-j:.'E OF A DO- LOa P " , •
11.10.2 ACTIVE AnD InACTIVE Dn-LOOPS.
• •••••••••
11.10.3 ~XECUTING A DO STATEMENT.
• 0 •• e • • • • • I •
I
11.10.4 Lunp CONTROL PROCESSING.
11.10.5 EXECUTION OF TilE RANGE.
I.
5-7
8-7
8-8
•
•
•.
•
•
•
I
I
••••
•
•
•
••
• ••••••••••••
• ••••••••••••
11.10.6 TERf'illlAL STATi::li:HT EXECUTI~JN.
• •••••••••
11 • 1 0 • 7 I 1\ C REnE ~4 TAT I fl N PRO CES SIN G•
,...... I • • • •
10-8
11-1
11-2
11-2
11-2
11-3
11-3
11-4
11-4
11-4
11-4
11-5
11-5
11-5
11-5
11-5
11-6
11-6
11-6
11-7
11-7
11-8
11-8
11-9
11-9
11-9
CONTROL DATA PRIVATE
6
Control Data Corporat1on Standard FORTRAN
83/06/30
TABLE OF CONTENTS
11.10.8 TRAnSFER INTO THE RAnGE OF A DO-LOOP.
• •••••
11 • 11 CON TIl·t UE . STAT E,-, F. NT. • • • ••
•••••••••••
11,12 STOP .sTATEMEnT • • • • • • ••
•••••
•
11.13 PAUSE STATEM~NT.
• ••••••••••••••••
11.14 END STATEHENT
11.15 LOGICAL WHERE STATEMENT • • • • • • • • • • • • • • • •
11.16 BLOCK WHERE STATEMENT • • • • • • • • • • • • • • • • •
11.16.1 Wn::R~-LEV2L • • • • • • • • • • • •
11.16.2 WHERE-BLOCK . . . . . . . . . . . . . . . . . . . ..
11.16.3 ~XECUTION OF A BLOCK WHERE STATEMENT • • • • • • •
1.1.17 OTHERWISE STATEMENT • • • • • • • • • • • • • • • • • •
11.17.1 OTH[Rl·rrSE-BlOCK • • • •
, 11.17.2 EXECUTION OF An OTHERHISE STATEMENT • • • • • • • •
11.1B END W:I=RE STI\TEilENT • • • • • • • • • • • • • • • • • •
I
•••
I
I
I
•
I
. . . . . . . . . . . . . . .
I
t
12.0 ARRAY STORAG: ALLOCATION
12.1 ALLOCATE. STATEMENT • • • •
12.2 FREE STATEMENT..
• ••
..
•••••••
•••••••••
II
••
·.. . . ... . . . . . .
11-10
11-10
11-10
11-10
11-11·
11-11
11-12
11-12
11-12
11-12
11-13
11-13
11-13
11-14
•
•
•
•
•
•
•
•
•
•
•
•
•
I
•
12-1
12-1
•
I
•
•
•
•
I
•
•
•
•
•
•
•
•
12,-2
..
13.0 INPTJT JOUTPUT 3TATE:lENTS • • •
13.1 RECORDS • • • • • "
•••••••••••••••••
.13.1.1 FORMATTED REcnRD.
•••••
• ••••••••••
13.1.2 UNFDRNATT:':O RECORD • • • • • • • •
13.1.3 ENOFILE RECORD. • • • • • •
• ••••••••••
13.2 FILES • • • • • • • • • • • • • t • • • • • • • • • • •
13.2.1 FIL: EXISTENCE. • • • • • •
• ••••••••
13.2.2 FILE PROP~RTI[S • • • • • • • • • • • • • • • • • •
13.2.3 FILE POSITION.. • • • • • • • • • • • • • • • • •
13.2.4 FILE ACCESS.
• ••••••••••••••••••
13.2.4.1 sequential Access.
• •••••••••••••
13.2.4.2 Direct Access.
• ••••••••••••
13.2.5 INTERNAL FILES • • • • • • • • • • • • • • • • • • •
13.2.5.1 Standard Internel Fila Propartius.
• •••••
13.2.5.2 Standard Internal File Restrictions.
•
13.2.5.3 Exten~ed Internal File Properties • • • • • • •
13.2.5.4 Extended Internal File Restrictions • •
13 3 UllI TS • • • • • • • • • • • • • • • • • • • • • • • • •
1 3 • 3 • 1 t JNIT EXISTENCE.
• • • . • ••
•••••••••••
13.3.2 COn~lCCTIOr~ OF A UNIT. • • • • • • • • • • • • • • •
13.3.3 UNIT SPECIFIER AND IDENTIFIER.
• •••••••••
13.4 FORMAT SPECIFI[R AND IDENTIFIER • • • • • • • • • • • •
13.5 RECORD SPECIFIER. • • • • • ••
• ••••••••••
13.6 £:RROR AND END-OF-FILE COHDITI(JNS • • • • • • • • • • • •
13.7 110 ST;\TUS .., ERROR, AND [NO-OF-FIL[ SPECIFIERS
•••••
13.7.1 ERROR SPECIFIER.
• ••••••••••••••••
13.7.2 END-OF-FILE SPECIFIER.
••••••••
• ••••
13. n READJ HR ITE, 'pRINT, ,\ND ?UnCH STA TI: l'lENTS • • • • • • • •
13.H.l COIITROL IHFORnATION LIST • • • • • • • • • • • • • •
13.8.2 INPUT/OUTPUT LIST • • • •
13.B.2.1 Input List Items. . . , • • • • • • • • • • • •
13.8.2.2 Output List Items.
• •••••••••••••
13.8.2.3 Imp' lad-DO List.
• ••••••••••••••
1 3 • 9 EX ECUT I nH 0 FAD ATAT PAN SFeR I NPUT J 0 UTPUT STJ.\ Tt: f1 r: NT. •
13.9.1 DIRECTION qF D.t\TA TRAnSFER • • • • •
1 3. 9 • 2 I D~: i I T I F Yr ;I G A UH IT. • • ••
........,..
I
.,
••.••••••••
I
••••••••
I
I
•
••
I
•••
I
•••
I
t
•••.••••••••
\I
•••••••
13-1
13-2
13-2
13-2
13-2
13-3
13-3
13-3
13-3
13-4
13-4
13-5
13-6
13-6
13-7
13-7
13-8
13-8
13-8
13-8
13-9
13-11
13-11
13-12
13-12
13-13
13-13
13-14
13-15
13-16
13-16
13'-16
13-17
13-17
13-18
13-18
CONTROL DATA PRIVATE
7
Control Data CorporatIon Standard FORTRAN
83/06/30
TAaLE. DF CONTeNTS
•••••.•••••• ••••
13-18
13.9.4 FILE POSITION ?RIOR TO DATA TRANSFER • • • • • • • •
13.Q.4.1 Sequential Access
•••••••••••••••
13.9.4.2 Direct Access
•••••••••••••••••
13.9.5 DATA TRANSfER • • • • • • • I • • • • • • • • • • •
13.9.5.1 Unformatted Data Transfer
•••••••••••
13.9.5.2 Formatted Data Transfer
••••••••••••
13 • 9 I ~ • 2 • 1 US In G A FOR t·, AT SPEe I FI CAT I aN I • . • • • • • • •
13.9.5.2.2 LIST-DIRECTED FORMATTING • • • • • • • • • • •
13-19
13-1q
Il.C).3
:::ST.~nLISHI~lG
/\ FORNAT
13.9.5.2.3 PRINTING OF FORMATTED RECORDS
•••••••
I
13.9.6 FILE POSITION AFTER DATA TRANSFER • • • • • • • • •
1 3 • \} • 7 I NPUT IOU TPUT S TAT USSP £ elF I ZROc F IN IT I m~ • • • • • •
13.10 AUXILIARY INPUT/OUTPUT STATEMENTS • • • • • • • • • • •
13.10.1 OPEN STAT2MENT • • • • • • • • • • • • • • • • • •
13.10.1.1 OPEN of a Connect~d Unit.
I
••
I
••••••
13.10.2 CLOSE STATEMENT.
• •• ~ • • • • • • • • • • • • •
I... . . . . . . . . . . . .
13.10.2.1 Imp' ieit Close at Termination of Execution.
1 3 • 1 0 • 3 I 1,\ qUI RES TAT E r·j ENT.
•
13.10.3.1 ItlQUIRE by File • • • • • • • • • • • • ,. • • •
13.10.3.2 INQUIRE by Unit.
• ••••••••••••••
13.10.3.3 Inquiry Specifiers.
• ••••••••••••
13 • 10 • 4 F I LE PO SIT I ot'l I HG S TAT E t1 [N T S •
•••••••••••
13.10.4.1 BACKSPACE Statement.
• ••••••••••••
13.10.4.2 ENDFILE Statement.
• •••••••••••••
13-33
13-34
13-34
13-34
13-34
13-35
13-35
13.14 ENCODE AND DECODE STATEMENTS
•••••••••••••
13 • 15 BUF FER I NAN D BUF F ;: R 0 UT S TAT EI1 E HT S • • • • • • • • • •
13-36
14.0 FORMAT SPECIFICATION
••••••••••••••• • •
14.1 FORMAT SPECIFICATION METHODS • • • • • • • • • • • • • •
14.1.1 FORMAT STATEMENT.
• •••••••••••••• • •
.• • •
14.1.2 CHARACTER FOR/1AT SPECIFICATION.
• • • • •
14.2 FnRM OF A FORMAT SPECIFICATION • • • • • • • • • • • • •
14.2.1 EDIT DESCRIPTORS • • • • • • • • • • • • • • • • • •
1 4 • '3 In T ERA C TID N B~ T vi E~ N I NPUT / 0 UT PUT LIS TAN D FOR r'l AT. • • •
14.4 POSITIONING BY FORMAT CONTROL • • • • • • • • • • • • •
14 •.5 £ DIT ING
••• • • • • • • • • • • • • • • • • • • • • •
14.5.1 APOSTROPHe AND QUOTE EDITIN~ • • • • • • • • • • • •
14.5.2 H EDITING • • • • • • • • • • • • • • • • • • • • •
14.5.3 POSITIONAL EDITING.
• •••••••••••••••
14.5.3.1 T, Tl, ~nd TR Editing.
•• I • • • • • • • • •
14.5.3.2 X Editing.
• •••••••••••••••••
14 • .5.4 SLASII EDITING.
• •••••••••••••••••
14.5.5 COLON :DITING.
.., .•••••••••••••••
14.5.6 S, Sp, AND SS EDITING.
• •••••••••••••
14.5.7 P EDITING.
• •••••••••••••••••••
14.5.7.1 Scale Factor.
• ••••••••••••••••
14.5.8 f3N J\HD BZ ::DITIt-iG.
• •••••••••••••••
14. 5. 9 t IU1·1 :: RIC [; 0 I TIN G • • • • • • • • • • • • • • • • • •
14.5.9.1 Integer Erliting • • • • • • • • • • • • • • • •
')
13-19
13-20
13-21
13-21
13-21
13-21
13-22
13-22
13-22
13-22
13-26
13-26
13-28
13-28
13-28
13-28
13-29
13.10.4.3 RE~/Il'lD St.atement.
• •••••••••••••
13.11 RESTRICTIONS ON FUI·ICTIOH REFERENCES AND lIST ITENS • •
1 3, 1 2 R:: S T RIC T ION 0 (,1 IN PUT / OUT rUT S TAT E,., E NT S • • • • • • • •
13.13 NAM2lIST IHPUT/OUTPUT • • • • • • • • • • • • • • • • •
13 • 13 • 1 NAj·l Ell S T S TAT EnE NT. • • • • • • • • • • • • • • •
13.13.2 NAMELIST DATA TRANSFER • • • • • • • • • • • • • •
..
I.
13-19
13-35
13-36
13-38
14-1
14-1
14-1
14-1
14-2
14-3
14-4
14-5
14-5
14-6
14-6
14-6
14-7
14-7
14-7
14-8
14-8
14-8
14-0
14-9
14-9
14-10
CONTROL DATA PRIVATE
8
Control Data Corporation Standard FORTRAN
83/06/30
TABLE DF COnTENTS
14.5.Q.2 Real, Double - , and Half - PrecIsion Editing •
14 .. 5.9.2.1 F EDITING • • • • • • • • • • • • • • • • • •
14.5.9.2.2 E AND 0 EDITING • • • • • • • • • • • • • • •
14.5.9.2.·3 G EDITlflG • • • • • • • • • • • • • • • • • •
14.5.9.2.4 COMPLEX EDITING . . . . . . .
14.5.10 L EDITING • • • • • • • • • • • • • • • • • • • • •
14.5.11 A SOITING • • • • • • • • • • • • • • • • • • • • •
14 • .5.11.1 A Editlno of Character Data • • • • • • • • , .
14.5.11.Z A Editing of Noncharacter Data
••••••••
14.5.12 PROCESSOR-DEPENDENT EDITING • • • • • • • • • • • •
14.5.12.1 R Editing • • • • • • • • • • • • • • • • • • • 14.5.12.2 0 Editln] . . . . . . . . . . . . . . . . . . .
14.5.12.3 Z Editing • • • • • • • • • • • • • • • • • • •
14.5.13 B EDITING • • • • • • • • • • • • • • • • • • • • •
14.6 LIST-DIRECTED FORilATTING • • • • • • • • • • • • • • • •
14.6.1 LIST-DIRECTED INPUT • • • • • • • • • • • • • •
14.6.2 LIST-DIRECTED OUTPUT • • • • • • • • • • • • • • • •
14.7 !,lAr;1ELIST FCJRNATTII·~G
••••••••••••••••••
14.7.1 NA1'1ELIST INPUT • • • • • • • • • • -• •.•
14.7.2 NAM~LIST OUTPUT
••••••••••••••••••
I
••
I
••••••
4
II
15•0
i1 A I tl ? RUG R A ~"
•••
•
•
15 • 1 PRO C; RA1'1 STAT E11 ENT
15.2 MAIN PROGRAM RESTRICTIONS
I
I
•
••
I
I
•
I
•
•
• • • • • • • • • • • • • • •
•
•
•
•
•
..
I
•
•
•
•
•
•
•
•
•
• • • • • • • • • • • • • • •
16 • 0 FUN CTI J II S AnD SUB R::J UTI NES • • • • • • • • • • • • • • •
16.1 CATEGORIES OF FUNCTIONS AnD SUBROUTINES
I
• • • • • • •
16.1.1 PROCEDURES. • • • • • • • • • • • • • • • • • • • •
16.1.2 EXTERNAL FUNCTIDNS. • • • • • • • • • • • • • • • •
16.1.3 SUBROUTINES.
• ••••••••••••••••••
16.1.4 DUMMY PROCEDURE.
• ••••••••••••••••
16.2 REFERENCING A FUNCTION • • • • • • • • • • • • • • • • •
16.2.1 FORi'l OF A FUtlCTIDN Ri?FERENCE • • • • • • • • • • • •
16. 2 • 2 i; X2 CUT I 0 i~ 0 F A FUN CTID N RF. FER Er,! cr:.
••••••••
16.3 INTRINSIC r:UNCTIONS
••••••••••••••••••
16. 3 • 1 SP£ CI FI C NAM ESAN D G;=. t1 ERIC ~'I A11 r: S • • • • • • • • • •
1 6. 3. 2 R t: F;.: REN CIf'1 G AN IN T R B-1 SIC FU!l C TID N •
••••••••
16.3.3 INTRINSIC FUNCTION ARGUMENTS AND RESULTS
1h.3.4 INTRINSIC FUNCTION RESTRICTIONS.
• ••••••••
16.3.5 ARRAY REDUCTInN INTRINSIC FUNCTIons • • • • • • • •
16.3.5.1 Array RedLJcti on to c. SC'?13r
••
I
I
I
••••
• • • • • • •
16.3 • .5.2 Array Reduction Along a Dimension
16.4
STATE~l::nT
1 ,c, • 4 • 1 FOR ;' 1
•••••••
FUNCTION • • • • • • • • • • • • • • • • • • •
aF
A STAT EnE N T F UN CT I ON STAT Ei'~E NT.
••••••
16.4.2 REFERENCING A STATEMENT FUNCTION.
• •
16.4.3 STATEMeNT FUNCTION RESTRICTIO!·IS.
• ••••••••
16.5 EXTERNAL FUNCTIONS . • • • • • • • • • • • • • • • • • • •
II
II
•••••
14-11
14-11
14-12
14-13
14-13
14-14
14-14
14-14
14-14
14-15
14-15
14-16
14-17
14~18
14-19
14-19
14-21
14-22
14-24
14-26
15-1
15-.1
15-1
16-1
16-1
16-1
16-1
16-1
16-1
16-1
16-2
16-2
16-3
16-3
16-4
16-4
16-5
16-5
16-5
16-5
16-6
16-6
16-7
16-8
16-9
16-9
16 • :; • 1 FUll CTION SUB PR[J GRAN Ar,1 0 FUN CT10 Ii S TAT E11 EnT • • •• •
16.5.2 REFERENCING AN EXTr.RNAL FUNCTION.
• ••••••••
16.5.2.1 Execution of an External· Function Reference.
•
16-10
16.5.2.2 Actual ArJuments for an External Function.
••
16.5.3 FUnCTION SUBPROGRAM RESTRICTIONS . . . . . . . . . . . .
16.5.4 US~R ARRAY-VALUED FUNCTION DECLARATION • • • • • • •
16-10
16-11
Arr~·y-Vp"!Jnc1 FunctIon
Arr~y-V~JuP~ Function Name Usage
16.5.4.1 Shape of n User
16.5.4.2 User
16-10
16-12
••
16-12
•••••
16-12
Result
conTROL DATA PRIVATE
C 0 frt r .)1 D ,j t
9
a C or po ra t ion S tan d ::~l r d FORT RAN
83/06/30
TABLE
OF CONTENTS
16.5.4.3 User Arr3y-Value1 Function Restrictions
••••
16,6 SUBROUTINES
•••••••••••••••••.
16 • 6 • 1 S U:H~ 0 UTI NE sun PRO GRAr1 AND SUB R0 UTI NEST ATE f1 E NT.
••
16.6.2 SUBROUTINe REFERENCE.
• ••••••••••••••
16.6.2.1 Form o·f 3 CAll st::!tem~~nt.
t.••••••••••
f
••••
16.6.2.2 Execution of a CALL statement.
• •••••••
16.6.2.3 ActuaJ ArQuments for a Subroutine.
• •• , ••
16.6.3 SUBROUTINE SUBPROGRAM RESTRICTIONS.
• •••••••
16. 7 Ell TRY S T AT Ei1 Et,l T
• • • • ••
• • • • • '. • • • • •
16 • 7 ,1 FOR r'l 0 FAN EN TRY S TAT ::: n ENT.
••••••••••••
16.7.2 REFcRENCliH; A!1 EXTERnAL PROCEDURE BY AN ENTRY NAHE.
16.7.3 CNTRY ASSOCIATION.
• •••••••••••••••
16.7.4 ENTRY STATEMENT RESTRICTIONS.
• ••••••••••
16.0 RETURN STATEMENT • • • • • • • • • • • • • • • • • • • •
16.H.1 FORti OF A RETURi,1 STATr;11Et,lT.
• ••••• , ••.•••
16.8.2 t::XECUTION OF A RETURN STATEnENT.
• ••••••••
16.8.3 ALTERNATE RETURN.
• ••••••••••••••••
16.8.4 DEFrr~ITIor'l STATUS.
• • • • • • • • • I •• I ••
16.Q ARGUilEI·ITS AND COnrHJtl BLOCKS
I. I
.1
•••••••••
16.9.1 DUrH1Y ARGUHENTS.
• ••••••••••••••••
16.Q.2 ACTUAL ARG1J~'f:;ITS • • • • • • • • • • • • • • • • • •
16 • q • 3 ASS 1:1 C I A T I f] it nF 0 U Mr" Y AND ACT U Al ARGU: 1EN T S •
••••
16.9.3.1 length of Character Dummy and Actual Arguments"
16.9.3.2 Variables as Dummy Arguments • • • • • • • • • •
16.9.3.3 ArraYS RS Dummy Ar]uments
•••••••••••
16.9.3.4 Procedures as Dummy Arguments.
• •••••••
16.9.3.5 Asterisks as Dummy Arguments. • • • • • • • • •
16.9.3.6 Restrictions on Association of Entities.
• ••
16.9.4
CDHi'IOt~
16.10 TABLE 5
BLOCKS.
• •••••••••••••••••
INTRINSIC FUNCTIONS
•••••••••••
16.10.1 RESTRICTIDNS ot! RANGE OF ARGU11ENTS AND R£SUL TS.
16.11 PROCESSOR-SUPPLIED FUNCTIONS
16 • ·11 • 1 DAT;:
16.11.2 TIME
•
,
•
•
I
••••••••••••
•
•
•••••
•
••
••••••••••••
••
• •
~
•
•
•
•
•
•
•
•
•
•
•
• ••••
16.11.3 SECOND
16.11.4 IDCLAS
••••••
16.11.5
••••••••••••••••••••••
NUMERR
I
••
I
••••••••••••••••••
16.11.6 UNIT
I
•••••••••••••••
••••••••••
16.12 PROCESSOR-SLJ?PLIED SUBRaUTINr:s • • • • • • • • • • • •
16.12.1 REMARK • • •
16.12.2 CONNEC • • •
••••••••••••••••••
16.12.3 DISCON • • • • • • • • • • • • • • • • • • • • • •
16.12.4 LIMCRR • • • •
16.12.5 RAMSET • • • • • • • • • • • • • • • • • • • • • •
16.12.6 RANGET
•••••••••• , •••••••••••
I
••••••••••••
I
•••••
I
•••••••••••
I
•••••••••••••••••
17.0 BLOCK DATA SUBPR1GRAM • • • • • • • • • • • • • • • • •
17.1 BLOCK Di\TA STATEi'1ENT • • • • • • • • • • • • • • • • .• .
17.2 BLOCK DATA. SUBPROGRAM.RESTRICTIJNS • • • • ••• •• • • • •
ASS:']CIJ\TILIN ArlO DEFINITIfHI
•••••••• • • • • • •
AND ASSOCIATIOH
•••
• • • ,.. • • • • • •
10.1.1 STOR~G~ SSaUENC[. • • • •
• •••• • • • • • •
1:"1.1.2 ASS:]CIATlnn ~]F STORAGE SEQUE'JC~S • • • • • • • • • •
1 :] • 1. 3 1\ S S ;] C I ATID il DF r: NTIT I E S •
•
••••• • • • • • •
16-13
16-13
16-13
16-13
16-13
16-14
16-14
16-15
16-15
16-16
16-16
16-17
16-17
16-18
16-18
16-18
16-19
16-19
16-19
16-20
16';"20
16-21
16-22
16-23
16-23
16-25
16-25
16-26
16-26
16-28
16-50
16-51
16-51
16-52
16-52
16-52
16-53
16-53
16-53
16-54
16-54
16~54
16-55
16-55
16-56
17-1
17-1
·17-1
18.0
18-1
18.1 STORAGE
18-1
18-1
18-1
18-2
CONTROL DATA PRIVATE
10
Control Data Corporation Standard FORTRAN
83/06/30
TABLE OF CONTENTS
CAUS2 EI'lTITIES TO RECDilL DEFINED • • • • • •
18 • 3 LV;; NTS THAT CAU SE En TIT I ES TO B[ Con E Uf·l DEFI r··1 ED. • • • •
18-3
18-5
19.0 SCOPE AND CLASSES OF SYMBOLIC NAMES • • • •
19.1 SCOPE OF SYMBOLIC NAMES • • ••
• ••••
19.1.1 GLOBAL ENTITI~S.
• ••••••••••
19.1.1.1 Classes of Global Entities.
• •••
10.1.2 LOCAL ENTITIES.
• •••••••••••
19.1.2.1 Classes of Local Entities.
• • • •
19-1
19-1
19-1
19-1
19-2
19-2
19-2
19-3
19-3
19-3
19-4
1q-4
19-4
1B.2 EVENTS THAT
• • • • • •
• • • • • •
• • • • • •
• • • • • •
• • • • • •
• • • • • •
• • • • • • • • • • •
1 9 • 2 CLA S Sr: S 0 F S YHB a LIe N Ar'1 E S • • •
19.2.1 COMMON BLOCK • • • • • • • • • • • • • • • • • • • •
la.2.2 EXTERNAL FUNCTION
•••••••••••••••••
.
10.2.3 sunRDUTINE • • • • • • • • • • • • • • • • • • • • •
.•
19.2.4 MAIN PROGRAM • • • • • • • •
• • • • • • • • •
lQ.2.5 BLOCK DATA SUBPROGRAM
•••••••••••••••
1'.2.6 ARRAY • • • • • • • • • • • • • • • • • • • • • • •
l Q .2.7 VARIABLE • • • • • • • • • • • • • • • • • • • • • •
1Q.2.8 CONSTANT • • • • • • • • • •
• • • • • • • • • • •
19.2.9 STATEMENT ~UNCTION • • • • • • • • • • • • • • • • •
1Q.2.10 I;'lTRINSIC FunCTION
••••••••••••••••
19.2.11 DUMMY PROCEDURE • • • • • • • • • • • • • • • • • •
19.2.12 NAM=LIST GROUP NAME • • • • • • • • • • • • • • • •
19-4 .
19-5
19-5
19-5.
19-6
19-6
A
A
CONTROL DATA PRIVATE
Control Data Corporation Standard FORTRAN
T A[\ L ::
[J F
COl ,1 TEN TS .
Table of Contents
CONl
Source Exif Data:
File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.3 Linearized : No XMP Toolkit : Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:56:37 Create Date : 2011:08:17 15:52:28-08:00 Modify Date : 2011:08:17 16:33:59-07:00 Metadata Date : 2011:08:17 16:33:59-07:00 Producer : Adobe Acrobat 9.45 Paper Capture Plug-in Format : application/pdf Document ID : uuid:db70b953-5f5b-4772-8e16-dae596ee3fdd Instance ID : uuid:199e6e2d-79a8-4883-ad61-6fb5acbfc259 Page Layout : SinglePage Page Mode : UseNone Page Count : 290EXIF Metadata provided by EXIF.tools