Burroughs A-Series ALGOL software Reference manual
PDF
Documento
Anuncio
Anuncio
473
.E}{PRESS IONS
~
EXPRESSIONS :.
CONCEPTS AND TYPES
An expression describes how a value can be obtained
specified operations to designated operands or primaries.
by
applying
Syntax
<expression>
----<arithmetic expression>----------I
!
I
I-<bit manipulation expression>-I
I
!
I-<Boolean expression>----------!
I
I
!-<case expression>------~~---~-I
I
!
I-<complex expression>----------!
I
I
I-<conditional expression>~-----!
I
I
I-<designa~ional expression>----I
I
I-<function expression>---------I
I
I
I-<pointer expression>----------!
I
I
I-<string expression>-----~-----I
Semantics
Evaluation of an arithmetic ~xpression returns a numerical value.
Evaluation of a Boolean expression returns a Boolean value (TRUE or
FALSE). Evaluation of a complei expression returns a complex value--a
value with a real numerical. part and an imaginary numerical part.
Evaluation of a designational ex'pression returns a label. Evaluation of
a pointer expression returns a value that can be used to reference a
character position in an array r~w. Evaluation of a string expression
returns a value that is an EBCDIC. ASCII, or hexadecimal string.
A bi t manipula tion expression op'erates on bi ts wi thin words and makes it
possible to "build'" the contents' of a word from groups of bits contained
in other words.
474
ALGOL REFERENCE MANUAL
Case expressions and conditional expressions allow one of several
alternative expressions to be chosen for evaluation based on a selection
value.
A function expression is a call on a typed procedure. The procedure can
be declared in the program or it can be an intrinsic--a typed procedure
that is a predefined part of the ALGOL language.
Intrinsic functions
exist that are predefined arithmetic expressions, predefined Boolean
expressions, predefined
complex
expressions,
predefined
pointer
expressions.
and
predefined
string
expressions.
For example,
SQRT«arithmetic expression» is a function expression that returns the
square root of the value of <arithmetic expression>. Because SQRT
returns a numeric value, it is an arithmetic function--a predefined
arithmetic expression.
NOTE
ExpreSSions that are very large or deeply
nested can cause the compiler to get a
stack overflow fault. The fault can be
avoided by breaking very large or deeply
nested expressions into several separate
expressions or by increasing the maximum
stack size by using the task attribute
STACKLIMIT.
Examples
X*y
A= B
CASE N OF (1,2,4,8)
SWLBL[SWXJ
SQRT(X)
IF BOOL THEN A ELSE B
POINTER(A)
Sl II
o
RSLT.[19:20]
CSIN(C)
82
& N [3:4J
475
ARITHMETIC
Expres:s ions
ARITHMETIC EXPRESSION
Arithmetic expressions are expressions that return numerical values
performing specified operations oh designated arithmetic primaries.
Syntax
<arithmetic expression>
-~--<simple
arithmetic expression>---------i
1
I
I-<conditional arithmetic expression>-I
<simple arithmetic expression>
1<- <arithmetic operator> -I
1
1
------------<arithmetic
1
1-
1
+
I
-I
1
1- - -I
<arithmetic operator>
---- +
1
--------1
1
1- - -----1
1
1_
1
I
1t
-----1
1
1- TIMES -I
1
1
1- MUX ---I
1
1
1- / -----1
1
1- DIV ---I
I
I
1- MOD - - - I
,I
I
1- ** ----I
I
primary>--~-~---I
by
47b
ARITHMETIC
ALGOL REFERENCE MANUAL
<arithmetic primary>
----<unsigned number>---------------------------------------!
I
I
I-<arithmetic concatenation expression>----------------/
1
I
I-<string literal>-------------------------------------I
I
1
I-<arithmetic variable>-- := --<arithmetic expression>-I
I
I
I-<arithmetic operand>---------------------------------/
I
/
I-<partial word part>-----------!
<arithmetic operand>
----<arithmetic variable>-----------------------/
/
L
I
I-<update symbols>-I
I
1
/
I-<arithmetic function designator>---------I
I
I
1- ( --<arithmetic expression>-- ) --------!
1
I
I-<arithmetic case expression>-------------I
1
/
I-<arithmetic attribute>-------------------I
<arithmetic case expression>
1<----------- . ----------1
I
/
--<case head>-- ( ---<arithmetic expression>--- ) --I
<conditional arithmetic expression>
--<if clause>--<arithmetic expression>-- ELSE ---------------------)
)-<arithmetic expression>------------------------------------------/
<constant arithmetic expression>
An <arithmetic expression> that can be fully
time.
evaluated
at
compile
477
Expressions
ARITHMETIC
See also
<arithmetic attribute> . . . . : . . . .
<arithmetic concatenation expression> . .
<arithmetic function designator> . .
<arithmetic variable> . . . . . .
<case head> .
<if clause> . . . .
. . - . . .
<partial word part> .
<update symbols>. . .
226
. 484
I
.:
.
515
225
263
.
319
. 489
227
Examples
Valid
Invalid
SUM/N
(A+B)/(C-D)
2*(X+Y)
(A+B)/(C-D)
COS(A+B)+C
Y*3
L*-A
*ENTIER(60)
4(AC)
X*-3
3X + 4Y + 2
A(X + 5)
A+X*(B:=X*(C+X(D+X*E»»
p*[x + Y + zJ
X + Y*-X + 2**2
+8
(-B+SQRT(D»/(A+A)
-T*3
A+X*(B:=X*(C+X*(D+X*E))
THETA
Semantics
The evaluation of a conditional arithmetic expression
"Conditional Expression."
is
described
in
Arithmetic Primaries
The items on
primaries.
which
arithmetic
operators
act
are
called
arithmetic
A variable or function designator used as an arithmetic primary in an
arithmetic expression must be of an arithmetic type--INTEGER. REAL, or
DOUBLE.
An attribute used as an arithmetif primary must have a type that is
INTEGER~
REAL. or DOUBLE. For information on file attribute and direct
array attribute types, see the "IjO Subsystem Reference Manual." The
arithmetic-valued
task attributes are described under "Arithmetic
Assignment. 't
478
ARITHMETIC
ALGOL REFERENCE MANUAL
The length-of a string literal used as an arithmetic primary must not
exceed 48 bits.
A string literal used as an arithmetic primary is
int~rpreted as either type REAL or type INTEGER, depending on its value.
The arithmetic concatenation expression is described
Expression."
in
"Concatenation
The partial word part is described in "Partial Word Expression."
The evaluation of an arithmetic case expression is
Expression."
described
in
"Case
See also
Arithmetic Assignment . . . . . . . . . . . . . . . . . . . . . 225
Examples
Valid
Invalid
5.678
X
X :=
11
+ 3
(14 + 3.142)
MABEL
R & 3 [1:2J
Y.[30:4J
"ABCD"
SQRT(X)
CASE I OF (5,15,17)
FYLE.MAXRECSIZE
.-
11
:= y
+ DC8
B - A
-(A + B)
TRUE
Arithmetic Operators
The operators +. -. *, and / have the conventional mathematical meanings
of addition. subtraction, multiplication. and division, respectively.
No two operators can be adjacent, and implied multiplication is not
allowed.
The TIMES and * operators denote multiplication.
47C;
.
'rhe DIV operator denotes
mathematical meaning:
Expr:essions
.
ARITHMETIC
!
integer'
division.
It
has
the
following
y DIV Z = SIGN(Y/Z). * ENTIER(A~S(Y/Z)
The MOD operator denotes remainder division.
equal to 1, MOD has the following ~eaning:
Y MOD Z = Y - (Z *
(y
For
Z
greater..
than
or
DIV Z»
For Z less than 1, the MOD operator prodtice$ undefined results.
I
The MUX operator multiplies eiiher
singleor
double-precision
arithmetic primaries, and yields a double-precision result.
The ** operator denotes· exponeritiation.
The
semantics
of
the
exponentiation operator depend on the types and values of the primaries
·involved. Table 6-1 e~xplains the y;ar1ous meanings of Y**Z.
I
Table 6-1. ~xponentiation
Meaning: of Y**Z
--------------------~----------~---------------------
I
I
Z:
Type Integer
I
Z: . Type Real
I
I
I--------------------~-----I--------------------------I
I
I
I Z > 0
I Z
=0
I
I
I Z < 0
I Z > 0
I Z = 0
I
I
I Z <0
I
I
I
I
. I
I
I
I
---------I--------I----~-~~I--~-----I--------I--------I--~-~---I
I
I
I
I
I
I
I
I y>o
I Note 1. I
1
I Npte 2 , Note 3 I
1
I Note 3
I Y<0
I . Note 1 I
1
I Not e 2 I Note 4 I
1
I Not~ 4
I Y=O
I
0
I Note 4 I Note 4
0
I Note 4 I Note 4
I
I
!
I
I
I
I
I
,-----------------.---------------------~-------------------~----I
I
I
Note
Note
Note
Note
1:
2:
3:
4:
Y**Z = y*y*y ... *~ (Z times)
Y**Z = Reciprocal of Y*Y*Y ... *Y (ABS(Z) times)
y* *Z = EXP( Z*LN( Y»)
Value of the expression is undefined.
I
I
I
I
I
--------------~-------------~------------------------------------------I
480
ARITHMETIC
ALGOL REFERENCE MANUAL
Precedence of Arithmetic Operators
The sequence in which the operations of an arithmetic expression are
performed is determined by the precedence of the operators involved.
The order of precedence is as follows:
1. **
(highest precedence)
2. *
/. MOD, DIV. MUX, TIMES
3. +. -
Operators with the same precedence are applied
appearance in an expression, from left to right.
in
their
order
of
operator
is
The precedence of the assignment operator (:=) i$ as follows:
1.
An expression ·to the right of
evaluated before the assignment.
2.
The~assignment
an
assignment
is done before the evaluation of an expression
involving the variable that is the target of the assignment.
Parentheses can be used in normal mathematical fashion to override the
defined order of precedence. An expression in parentheses is evaluated
by itself, and the resulting value is subsequently combined with the
other elements of the expression. For example, in the expression
(X+l)/Y
the addition is performed before
parentheses. In the expression
the
division
because
X+l/Y
1 is first divided by Y and then the result is added to X.
of
the
Expr~ssi'ons
481
ARITHMETIC
I
Table 6-2 illustrates how mathematibal notati'on can be translated to
ALGOL arithmetic expression.
Table 6-2.
an
Math~matical Notation
-------------------~-----------------------------------
I
Mathematical
Expression
Equivalent
ALGOL Expression
1
I
1
1
I===========================~===========================
A X B
1
AI * B
I-----------------------I-----------------~------~------
1
I
1
I
I
B
A + -
'
A + B/2
I
2
I
-----------------------l----------~-------------------X + 1
I
(X + l)/Y'
Y
1
I
-------------------~----I--------~----------------------I
I
I
2
I
(D + E**2)/(2 * A)
D + E
1
------
I
I
2A
1
I
1
------------------------1-------------------------------I
3
I
4(X + Y)
I '* * (X
Y) ** 3
-+-
-----------------------I-----------~-------------------I
M -N i l
-------------------
-6
P +
~)
X 10
1
I
I (~ - N)/(M + N) ** (P + 5@-6) I
1
(M + N)
I
1
--------------------------~--I
Precision of Art thmet:lc ExpressionJ
The value of an arithmetic expression can be expressed in single or
double precision, depending on th~ precision of its constituents or. in
the case of MUX. on the 'operator involved. The value of an arithmetic
expression is doublE~ precision if any variable. function, or number of
which it is composed 1s of type DO~BLE, or if two primaries are combined
by the double-precision operator MUX.
The MUX operator allows a
double-precision result to be obtained from the multiplication of two
single-precision arithmetic primaries.
482
ALGOL REFERENCE MANUAL
ARITHMETIC
The value of a case expression is double precision if any expression in
its arithmetic expression list is of type DOUBLE. Likewise, the value
of a conditional arithmetic expression is double precision if either
arithmetic
expression
is
double
precision.
In
either case.
single-precision arithmetic expressions are
converted
to
double
precision, when necessary.
~
of Resulting Values
The type of the value resulting from an arithmetic operation depends on
the arithmetic operator and the types of the primaries being combined.
except when the resulting value is undefined. Table 6-3 describes the
types of quantities that result from various combinations of arithmetic
primaries.
Table 6-3. Types of Values Resulting from Arithmetic Operations
+
IOperand
Ion Left
Operand 1
on Rightl
I
1<
I
I
I
I
/
1
DIV
1
MOD
MUX
**
I
1
I
1-------- --------1--------1--------1--------1-------- --------1-------1
I
I
!INTEGER
IINTEGER
IINTEGER
I REAL
I REAL
I REAL
DOUBLE
INTEGER
REAL
DOUBLE
INTEGER
REAL
DOUBLE
(any)
I Note 3
1 REAL
1 DOUBLE
I REAL
I REAL
I DOUBLE
I DOUBLE
I
I
I REAL
1 REAL
1 DOUBLE
I REAL
I REAL
I DOUBLE
I DOUBLE
I
I
IINTEGER
IINTEGER
IDOUBLE
IINTEGER
IINTEGER
IDOUBLE
IDOUBLE
1
1
IINTEGER
IREAL
IDOUBLE
IREAL
IREAL
1 DOUBLE
IDOUBLE
I
Note 1
Note 2
Note 2
Note 2
Note 2
DOUBLE
DOUBLE
IDOUBLE
IDOUBLE
IDOUBLE
IDOUBLE
IDOUBLE
IDOUBLE
IDOUBLE
I
I
1
1
I
I
I
I
I
I
-----------~----------------------------------------------------------1
1
Note 1: If the operand on the right is negative or the absolute
value of the result is greater than or equal to 2**39,
REAL~ otherwise. INTEGER
Note 2: If the operand on the right is zero. INTEGER; otherwise,
REAL
Note 3: If the absolute value of the result is less than 2**39,
INTEGER; otherwise. REAL
I
1
1
1
I
I
,
483
Expr~ssions
ARITHMETIC
The type of an arithmetic case expr~ssion o~ a conditional arithmetic
expression is DOUBLE if any of its constituent expressions are of type
DOUBLE. (For more information, ~efer to "Precision of Arithmetic
Expressi6ns"
above.) If the co~ditional arithmetic expression or
arithmetic case expression containi only expressions of type INTEGER and
REAL
its type is REAL.
A cdnditional arithmetic expression or
arithmetic case expression is df type INTEGER only if all
its
constituent expressions are of typ~ INTEGER.
9
484
BIT MANIPULATION
ALGOL REFERENCE MANUAL
BIT KANIPULATION EXPRESSION
Bit manipulation expressions provide a means of isolating a field of one
or more bits from a word, and allow words to be constructed from fields
of one or more bits from other words.
syntax
<bit manipulation expression>
----<concatenation expression>----I
!
I
i-<partial word expression>--I
Concatenation Expressiop
The concatenation expression forms a primary from selected parts of
or more primaries.
two
Syntax
<conc~tenation
expression>
----<arithmetic concatenation expression>----I
I
I
i~<Boolean concatenation expression>----I
<arithmetic concatenation expression>
--<arithmetic primary>-- & --<arithmetic expression)---------------)
>-<concatenation>--------------------------------------------------1
<Boolean concatenation expression>
--<Boolean primary>-- & --<Boolean expression>--<concatenation>--I
485
Exp'ressions
BIT MANIPULATION
<concatenation>
-- [
~-<left
bit to>--
-----------------------------~------------)
1
l-<left bit frpm>-- : -I
)-<number ofbits>-- ]
--------------------------------------------1
<left bit to>
--<arithmetic expression>--I
<left bit from>
--<arithmetic .expression>--I
<number of bits>
--<arithmetic expression>--I
See also
<arithmetic primary> . . . . . . .
<Boolean primary> . • . . • •
• 476
492
Semantics
A concatenation primary is formed1by taking a specified part of th~ bit
pattern of the value of an expre~sionand copying it into the specified
portion of a primary. The rest of the destination primary is not
changed by this operation~
Note that only ar:lthmetic expr~ssions can be
concatenated
with
arithmetic primaries. and only ~oolean expressions can be concatenated
with Boolean primaries,
486
BIT MANIPULATION
ALGOL REFERENCE MANUAL
Because the concatenation expression is a primary. and the syntax for
concatenation expression is of the form
<primary> &
<expressi~n>
a
<concatenation>
concatenation expressions of the following form are allowed:
<primary> & <expression> <concatenation>
& <expression> <concatenation>
& <expression> <concatenation>
If, as in the example above. more than one concatenation term is used in
a concatenation expression. then these terms are evaluated from left to
right.
<concatenation>
The <concatenation> construct describes the location in the expression
of the field to be copied and the location in the destination primary
where the field is to be copied.
The <left bit to> element defines the leftmost bit location of the field
in the destination word.
The <left bit from> element d~fines the
leftmost bit location of the field in the source word. The <number of
bits> element specifies the length of the field to be copi~d from the
source to the destination.
If the "[<left bit to>:<left bit from>: <number of bits>]" form is used,
the "field of bits to be copied starts at <left bit from> in the source
word and is <numbe~ of bits> long.
If the "[<left bit to>:<number of bits>]" form is used, then the field
of bits to be copied from the source word starts at bit number «number
of bits>-l) and extends through bit zero. That is. the source field is
assumed to be the low-order <number of bits> bits in the source word.
The values of <left bit to> and <left bit from> must lie within the
range 0 through 47. where bit 0 is the rightmost. or least significant.
bit in the word.
Expre,ssions
487
BIT MANIPULATION
The value of <number of bits> must lie within the range 0 through 48.
If the value of <number of bits> exceeds the number of bits to the right
of the starting bit in either the sdurce or destination words. these
fields wrap around and are continued at bit 47. the leftmost bit, of the
same word.
If, through the progrru~er's use of variables, the ranges fat <left bit
to>, <left bit from>, or <number of bits> are exceeded. then the program
is discontinued with a fault.
Because a concatenation expression· is a primary. when it appears as an
operand
in a larger expression, the concatenation expression is
evaluated before other any operation is executed.
For example, the
expression
2**4
1 [O:O:lJ
&
is evaluated as
2**(4 &
1
[O:O:lJ) = 2**5
32
and NOT as
(2**4)
& 1
[O:O:lJ = 16
&
1 [0:0:1] = 17
For the same reason, the Boolean .concatenation expression
3 < 7 & (5 > 8) [47:47:20J
is evaluated as.
3 < (7 & (5 > 8) [47:47:20])
which is equivalent to
3 < .(7 & FALSE [47:47:20J)
This results in an error. because the Boolean expression "FALSE"
be concatenated with the arithmetiC primary"7~.
cannot
488
BIT MANIPULATION
ALGOL REFERENCE MANUAL
ExaIlples
Given real variables X. Y, and Z with the following values:
x = 32767 = 4"000000007FFF"
Y
Z
=
=
1024
1
= 4"000000000400"
= 4"000000000001"
the following are examples of arithmetic
their values:
Expression
conc~tenation
expressions. and
Value
---------[47:11:4]
[47:12]
[39:20]
[46:1]
Y [11:11]
X [23:48J
Y [39:12] & Z [47:1]
X [19:15:8J
X & Y
X & Y
y & X
y & Z
Q &
0
&
X
&
y &
4"400000007FFF"
4"400000007FFF"
4"OO07FFF00400"
4"400000000400"
4"000000000800"
4"007FFFOOOOOO"
4"804000007FFF"
4"OOOOOOO7F400"
Assume the elements of the real array INFO contain information about the
data in a f ile. Each element of INFO co'ntains a record number in the
field [19:20], and the length of the data in that record is in field
[39:20].
That is, each element of INFO stores the location and length
of a record in the data file. Let N be a variable that contains a
record number and let L be a variable that contains the length of tnat
record. The following declarations and assignment statement could be
used to store a value into an element of INFO.
DEFINE
REC_NUMF = [19:20]#.
LENGTHF = [39:20]#:
INFO[I] := 0 & N REC_NUMF
& L LENGTHF;
Expr~ssions
489
BIT MANIPULATION
Partial Word Expressiol!
A partial word expression isolates the value of a field of one
bits of a specified .word.
or
more
Syntax
<partial word expression>
----<arithmetic operand>---<partial word part>--I
I
I
I-<Boolean operand>----I
<partial word part>
-- [ --<left bit>--
--<number of bits>-- ] --I
<left bit>
--<arithmetic expression>--I
See also
<arithmetic operand>.
<Boolean operand) . .
<number of bits> . . .
• 476
492
. . . 485
Semantics
The <partial word part> construct ~escrl0es the location in the operand
of the field to be isolated. T~e isolated field is copied to the low
order (rightmost) field of a word df all zeros.
The <left bit> element defines the leftmost bit location of the field in
the source word.
The value of <left bit> must lie within the range 0
through 47. where bit 0 is the rightmost. or least significant, bit in
the word.
The <number of bits> element speciiies the length of the field.
The
value of <number of bits> must iie within the range 0 through 48. If
the value of <number of bits) exce~ds the number of bits to the right of
<left bit> in the source word. the field wraps around and is continued
at bit 47, the leftmost bit. of the same word.
490
BIT MANIPULATION
ALGOL REFERENCE MANUAL
If. through the programmer's use of variables,
exceeded, the program is discontinued with a fault.
these
ranges
are
>1<,::
Examples
Given real variables X, Y, and 2 with the following values:
x
= 32767
= 4"000000007FFF"
Y
2
1024
2
= 4"000000000002"
=
=
4"000000000400"
the following are examples of arithmetic partial
their values:
Expression
X.[5:6J
Y.[11:4J
2.[19:48J
X.[23:24]
X.[23:20J
word
expressions
and
Value
4"00000000003F"
4"000000000004"
4"000040000000"
4"000000007FFF"
4"0000000007FF"
Using the INFO array example from "Concatenation Expression" above, the
following assignments could be used to extract information from INFO.
N := INFO[IJ.REC_NUMF;
L := INFO[IJ~LENGTHF:
491
I
EX17ressions
BOOLEAN
BOOLEAN EXPRESSION
Boolean expressions are expressions that return logical values
applying specified operations to ~esignated Boolean primaries.
Syntax
<Boolean expression>
----<simple Boolean expresslori>---------I
I
1
!-<conditional Boolean expression>-I
I
<simple Boolean expression>
1<- <Boolean operator> -I
I
1
----<Boolean
primary>--~-----I
<Boolean operator>
AND ----I
1
1
l- OR - - II
I
1- EQV -I
I
l- IMP
,I
-j
---I
•
by
492
ALGOL REFERENCE MANUAL
BOOLEAN
<Boolean primary>
--------------<Boolean
I
1
value)---~-----------------------------I
I
1
1- NOT -I I-<Boolean operand>----------------------------I
I
1 I
I
I
1-
A
---I I
I-<partial word part>------I
I
I
I-<Boolean variable>--- := --<Boolean primary>-I
1
1
1
\-<update symbols>--------I
I
\-<arithmetic relation>------------------------I
I
I
I-<Boolean concatenation expression>-----------\
I
\
1
\-<complex relation>---------------------------\
I
I
\-<string relation>----------------------------I
1
1
\-<pointer relation>---------------------------I
1
I-<string expression
1
relation>----------------~I
\
I
I-<arithmetic table rnernbership>----------------!
I
1
I-<pointer table
mernbership>---------~---------I
<Boolean value>
TRUE -----1
\
1
1- FALSE -I
<Boolean operand>
----<Boolean variable>----------------I
I
I-<Boolean function designator>--!
I
1
1- ( --<Boolean expression>-- ) -I
j
!
I-<Boolean case expression>------I
I
I
I-<Boolean attribute>------------I
493
Expressions
BOOLEAN
<Boolean case expression>
I<--------~ • ---------!
I
--<case head>-- ( ---<Boolean expression>--- ) --I
<arithmetic relation>
--<arithmetic expression>--<rEilational"operator>-----------------.:..->
>-<arithmetic expression>------------------------------------------I
<relational operator>
----<string relational operat~r>-~--~
,
1
1-
IS
1-
ISNT -----------~--------~--I
-----------------7----~--1
I
<string relational operator>
LEQ ----I
/
/
/- <= --I
1
1- LSS -/
/
I
1- < ---I
/
1
1- EQL -I
1
1
1- = ----I
I
1
1- NEQ -I
i
I
1- "= --I
1
i
\- GTR -I
1
1
1-> ---I
I
/
1- GEQ -/
/
!- >= --I
494
BOOLEAN
ALGOL REFERENCE MANUAL
<complex relation>
--<complex expression>--<complex equality operator>---------------->
>-<complex
expression>-----------------------~----~----------------I
<complex equality operator>
EQL ----I
I
1-
i
= ---I
1
1
1- NEQ -I
I
I
1-
~=
--I
<string relation>
--<pointer part>--<relatlonal operator>---------------------------->
>---<pointer part>-- FOR --<arithmetic expression>-----------------I
1
1
I-<string literal>----------------------------------I
1
1
1- FOR --<arithmetic expression>-I
<pointer part>
-----------------------<pointer expression>--I
I
i
I~<update pointer>-!
<pointer relation)
--<pointer expression>--<equality operator>--<pointer expressioh>--I
495
BOOLEAN
E~pressions
<equality operator>
EQL -----1
1
1
\- = ----I
\
1
\- NEQ --I
I
!
\- "= ---I
I
I
1- IS ';"--1
I
1
1- ISNT -I
<string expression relation>
--<string expression>--<string relational operator>---------------->
>-<string
expression>~-----~---------------------------------------I
<arithmetic table membership>
--<arithmetic expression>-- IN --<truth set table>--I
<pointer table membership>
--<pointer expression>-- IN '--<truth set tab1e>-------------------->
>--------------------------~---------------------------------------1
1
1- FOR --<arithmetic expression>-I
<conditional Boolean expression>
--<if clause>-'-<Boolean expression>-- ELSE --<Boolean expression>--I
See also
<Boolean attribute> . . . . . . . . . .
<Boolean concatenation expression; . . . . . .
<Boolean function designator>
<Boolean variable).
....... .
<case head> .
<if clause> . . . .
<partial word part> .
<truth set table~ .
<update pointer>.
<update symbols/.
.
·
·
·
.
·
·
. ..
·
·
234
484
515
234
263
319
489
382
379
227
496
BOOLEAN
ALGOL REFERENCE MANUAL
Examples
Valid
Invalid
B AND TRUE
I-A> B*(-E)
(X=Y OR W=K)
X=O AND Y"=O
A>l AND (B=O OR C<D)
(A=B OR C=D) AND (X<2 OR Y(2)
A=B
XEQV Y
NOT B & TRUE [5:lJ
l+A AND 2>0
NOT NOT A
l-W*2
(B*2-4XAXC)
Semantics
The evaluation of a conditional
"Conditional Expression."
Boolean
expression
is
described
in
Operators in BOQlean Expressions
The following table lists the operators that can be used in Boolean
expressions, along with their meanings. When two operators are listed
on the same line, they are equivalent to each other.
Operator
Meaning
--.------
-------
NOT
AND
OR
IMP
EQV
IS
ISNT
EQL
NEG
GTR
GEQ
LSS
LEQ
logical NOT
logical AND
logical inclusive OR
logical implication
logical equivalence
identical to
not identical to
equal to
not equal to
greater than
greater than or equal to
less than
less than or equal to
=
"=
>
>=
(
<=
497
BOOLEAN
E~pressions
Logical Operators
The values returned by the logical operators are defined in Table 6-4.
Table 6-4.
Results of Logical Operators
I Operand A I Operand B I NOTA
I
I
I
I
I
I
A AND B I A OR B I A IMP B I A EQV B I
I
1
1
I
I===========I===========I=~===== ========~I========I=========I=========I
I
I
I
I
I
I
TRUE
TRUE
FALSE
FALSE
I
I
I
I
I
TRUE
FALSE
TRUE
FALSE
1 _ __
I
I
FALSE
TRUE
I TRUE I
FALSE
FALSE
TRUE I
TRUE
FALSE
TRUE!
TRUE
FALSE
FALSE I
____~________~ --------I
TRUE
FALSE
TRUE
TRUE
I
I
I
I
TRUE
FALSE
FALSE
TRUE
I
I
I
I
I
I
The Boolean operations defined above are performed on all 48 bits of the
Boolean primaries on a bit-bY-bi~ basis. For example, the constant TRUE
(4"000000000001") does not have ihe same bit pattern as the Boolean
expression NOT FALSE, because NOT complements all 48 bits of the
constant FALSE (4"OOOOOOOOOOOO")~ generating 4"FFFFFFFFFFFF". Even so,
the constant TRUE and the Boqlean expression NOT FALSE have the same
Boolean value of TRUE because th~ Boolean value of a Boolean primary is
based upon the value of the low-ordet bit (bit zero) of the Boolean
primary (0 is FALSE: 1 is TRUE).
NOTE
Exception:
When NOT operates on
an
arithmetic relation, the low-order bit
(bit zero) is complemented; however, the
other
47
bits
are not necessarily
complemented.
For example, if
X = Y
evaluates
to
~RUE.
then NOT(Z = y)
evaluates to FALS~. not necessarily to
NOT TRUE as would .be expected.
IS and ISNT Operators
The IS relational operator performs a bit~for-bit compare on its twc
operands. It returns TRUE if the corresponding bits of each operand are
the same. The ISNT operator is the negation of the IS operator.
498
BOOLEAN
ALGOL REFERENCE MANUAL
If the IS operator is used to compare a double-precision arithmetic
quantity to a single-precision (integer or real) arithmetic quantity,
the result 1s always FALSE.
The IS operator differs from the EQL or = operator. which does an
arithmetic compare on its operands.
Two operands can have the same
arithmetit value with different bit patterns. Thus, the following pairs
yield TRUE when compared with the EQL or = operator~ but yield FALSE
when compared with the IS operator:
1.
+0 and -0
2.
A normalized number and
format
3.
A number with an exponent of +0 and the
exponent of -0
4.
A number with bit 47 = 0 and the same number with bit 47
the
same
number
not
same
in
number
normalized
with
an
1
Relational Operators
The action of the relational operators GTR, >. GEQ. >=, LSS. <, LEQ, <=,
EQL. =
NEQ. and ~= depends on the kinds of items being compared. For
more information,
refer
to
"<arithmetic
relation>~"
"<complex
relation>," "<string relation>," "<pointer relation>," and "<string
expression relation>" in this section.
Precedence In Boolean Expressions
The components of Boolean expressions are
order:
evaluated
1.
All arithmetic, complex, pointer. and
evaluated.
2.
All relations,
evaluated.
3.
Logical operators are then applied.
table
memberships,
string
and
in
the
following
expressions
assignments
are
are
499
BOOLEAN
Expressions
The order of precedence of the logical operators is as follows:
1. NOT
(highest precedence)
2. AND
3. OR,
4. IMP
5. EQV
Operators with the same precedence are applied
appearance in an expression, from left to right.
in
their
order
of
The precedence of the assignment operator (:=) is as follows:
1.
A primary to the right of an assignment operator
before the assignment.
is
evaluated
2.
The assignment is done pefore the evaluation of an expression
involving the variable that is the target of the assignment.
Parentheses can be used to override the defined order of precedence. An
expression in parentheses is evaluated by itself, and the resulting
value is subsequently combined with the other elements
of
the
expression. For example, in the expression
X AND (Y OR Z)
the ORis performed before the AND because of the parentheses.
expression
In
the
X AND Y OR Z
the AND is performed before the OR.
Boolean Primaries
The Boolean concatenation
Expression."
expression
is
described
in
"Concatenation
The partial word part is described in "Partial Word Expression."
500
BOOLEAN
The evaluation of a
Expression."
ALGOL REFERENCE MANUAL
Boolean
case
expression
is
described
in
"Case
<Boolean value>
The Boolean value TRUE is represented internally as a" 48-bit word
containing 4"000000000001", and the Boolean value FALSE is represented
internally as a 48-bit word containing 4"000000000000".
<arithmetic relation>
An arithmetic relation performs an arithmetic comparison of the values
of two arithmetic expressions. The value of the relation is either TRUE
or FALSE.
<complex relation>
A complex relation performs a comparison between the values of" two
complex expressions.
Because one of the forms of a complex expression
is an arithmetic expression. the complex relation can also be used to
compare a complex value and an arithmetic value. In a complex relation.
the only allowed relational operators are =. EQL. ~=, and NEQ.
<string relation>
The string relation syntax causes a comparison to be performed between
two character strings referenced by two pointer expressions, or between
the character string referenced by a pointer expression and" a" string
literal.
The character strings are compared according to the EBCDIC
cOl~ating sequence.
The arithmetic expression specifies the number of
characters to be compared (the repeat count). If a string literal
follows the relational operator and a repeat count has been s~ecified.
then the string literal is concatenated with itself, if necessary, to
form a 48-bit literal. The comparison is repeated until the repeat
count is exhausted.
If no repeat count is specified. the string
characters are compared once.
501
BOOLEAN
Expressions
<pointer relation>
A pointer relation determines whether two pOinter expressions refer to
the .same character position in the same array row. If the character
sizes of the two pOj,nter expressions are unequal the comparison always
yields the value FALSE.
t
A pointer relation s;hould not be confused with. a string relation.
A
string relation cc.mpares the character strings referenced by pointer
expressions. .A pointer relation compares the pointer expreSSions
themselves.
For E~xample, if pointers PI and P2 are ini t ializedas
follows:
POINTER Pl,P2;
REAL ARRAY A.B[O:l]:
Pl := POINTER(A,8);
P2 := POINTER(B.S);
REPLACE Pl BY "A";
REPLACE P2 ~y "A";
then the string relation
Pl EQL P2 FOR 1
would have the value TRUE, but
th~
pointer relation
Pl EQL P2
would have the value FALSE, because PI refers to array A and
to array e~
P2
refers
<string expression relation>
The string expreSSion relation compares two string expressions according
to
the collating sequence of the character type of the string
expressions. Only string expressions of the same character type can be
compared.
T~o strings are equal only if the lengths of the two Strings
are equal
and if every character in one string is equal to the corresponding
tiharactei in the other string. T~o null strings are equal.
502
BOOLEAN
ALGOL REFERENCE MANUAL
One string.is strictly greater than a second string only if at least one
of the following conditions is true:
1.
The leftmost character in the first string that is not equal to
the corresponding character in the second string compares as
greater than the corresponding character in the second string.
2.
The length of the first string is greater than the length of
the second string, and the two strings compare as equal for the
length of the second string.
arithmetic
Whenever two string literals can be compared as two
primaries, they are so compared. For example, the Boolean expression
"B" > "AA"
yields a value of FALSE, because the two quoted strings are treated as
two arithmetic primaries. However, if the two string literals "B" and
"AA" were assigned to two string variables T and S, respectively, then
the Boolean expression
T > S
yields a value of TRUE, because the first character of T is greater than
the first character of S.
For example, if a string Sl is assigned the value "AAB12+", then all
the following comparisons are TRUE:
Sl
Sl
Sl
Sl
Sl
EOL
NEQ
GTR
LSS
LSS
of
TAKE(Sl.6)
HEAD(Sl.ALPHA)
HEAD(Sl,ALPHA)
DROP(Sl,3)
DROP(Sl,l)
Table Membership
The table membership constructs allow testing to determine whether a
character is a member of a truth set. The character can be either a
character in a string literal or a character in an array row referenced
by a pointer expression.
In a pointer table membership primary, the
"FOR <arithmetic expression>" part applies the membership test to the
first <arithmetic expression> characters to which the pointer expression
points.
The <subscripted variable> form of the <truth -set table> construct
allows several truth set tables to be contained in one array row. The
value of the subscript indicates the beginning of the desired table
503
BOOLEAN
Expressions
within the array row.
"TRUtHSET Declaration."
For
a
description
of
truth sets. refer to
Examples
Valid
. Invalid
TRUE
BOOL
SQRT(X)
8.[11:1J
B : = TR!UE
B1 := 11 AND B2
CSIN(Cl) = CSIN(C2)
X > Y
NOT B
R = 3
PTR = "ABCD"
Pl < P2 FOR 20
Sl I I S2 = S3
HAPPENED(E)
CASE I OF (Bl, TRUE. X=Y)
NOT FYLE.OPEN
Pl = P2
BOOL & TRUE [19:1J
X IN ALPHAS
Pl IN ALPHAS FOR 6
5.67
-X
R + TRUE
CSIN(Cl)> CSIN(C2)
PI > P2
S1 IS "ABCD"
504
CASE
ALGOL REFERENCE MANUAL
CASE EXPRESSION
Case expressions provide a means of selecting from a list of expressions
one expression for evaluation.
syntax
<case expression>
----<arithmetic case expression>-------i
I
\
I-<Boolean case expression>-------\
I
I
I-<complex case expression>-------I
I
!
I-<designational case expression>-I
i
!
I-<pointer case expression>-------!
See also
<arithmetic case expression>.
<Boolean case expression> . .
<complex case expression> . . .
<designational case expression> .
<pointer case expression> . . .
· 476
• . 493
. • 507
· 512
· 519
Semantics
In a case expression, the list of expressions must be composed of
expressions of the same kind: for example. all arithmetic expressions or
all Boolean expressions. The expression to be evaluated is selected as
follows:
1.
The arithmetic expression in the case head
integerized by rounding. if necessary.
is
evaluated
2.
This value is used as an index into the expression list.
The
component expressions of the expression list are numbered
sequentially from 0 through N-l. where M is the number of
expressions in the list.
3.
The expression selected by the index is evaluated,
value is the value of the case expression.
and
and
its
505
CASE
Expressions
If the value of the index lies outside the
program is discontinued with a fault.
range
0
through
N-l.
the
The type of an arithmetic case expression is DOUBLE if any of its
constituent expressions is of type DOUBLE; in this case, any constituent
expression that is not of type DOUBLE is extended to double precision.
The type of an arithmetic case expression is INTEGE~ if and only if all
of its constituent expressions are of type INTEGER.
Otherwise. an
arithmetic. case expression is of type REAL.
Examples
CASE N OF (2. 20. 100. 37)
CASE X.[27:2J OF (TRUE. FALSE. T~UE. TRUE)
CASE I OF (Cl. C2. COMPLEX(X,Y»
CASE TSTS[INDEX] OF (LBLl. LBL2. AGAIN. NEXT. MORE)
CASE CHAR.SZF OF (P'TR. PTS. POINTER(A), PTEMP, POLO)
506
COMPLEY.
ALGOL REFERENCE MANUAL
COMPLEX EXPRESSION
Complex expressions are expressions that
return
complex
values
(arithmetic values that consist of a real part and an imaginary part) by
applying specified operations to designated complex primaries.
Syntax
<complex expression>
----<arithmetic expression>-------------!
i
1
I-<simple complex expression>------I
1
1
I~<conditional
complex expression>-I
<simple complex expression>
1<- <complex operator> -I
1
I
----<complex primary>--------I
<complex operator>
+
----I
I
1
1- - -I
I
i
11
*
-I
I
1- / -I
<complex primary)
----<arithmetic primary>----------------------------------I
I
I
I-<comolex operand>----------------------------------i
I
I
I 1<---------------------------1 I
I I
I !
1--- ** --<arithmetic primary>---!
507
COMPLEX
Expressions
<complex operand>
----<complex
variable>---------------~--~------~-~--i
1
1
1
1- :=
I
1
--<compl~x
!
primary>-I
I
I-<updatesymbols>--------!
1
I
I-<complex function designator)----------------I
I
I
1- ( --<complex expression>-- ) ---------------i
I
I
I-<complex case expression>--~-----------------!
1
<complex case expression>
1<---------
~-<case
t
----·----1
I
I
head>-- ( ---<complex exp:ression>---
---I
<conditional complex expression>
--<if clause>--<complex expression>-- ELSE --<complex expression>--I
See also
<arithmetic primary> . . . . .
<case head>
<complex function designator>
<complex variable> • .
<if clause> . . . . . . . . .
<update symbols> . . . . . .
.
•
•
• 476
. 263
51tJ
237
319
. 227
Semantics
The imaginary part of a complex value can be equal to zero. Because of
this, an arithmetic expression is. whenever necessary. considered to be
the real part of a complex expression with a zero imaginary part.
No
automatic type conversion from complex to.arithmetic exists.
The sequence in which the operations of a complex expression are
performed is determined by the precedence of the operators involved.
The order of precedence is as follows:
*
2.
/
+~ -
(highest precedence)
508
COMPLEX
ALGOL REFERENCE MANUAL
Operators with the same precedence are applied
appearance in an expression. from left to right.
in
their
order
of
The precedence of the assignment operator (:=) is as follows:
,
A primary tc the right of an assignment operator
before the assignment.
..I. •
2.
is
evaluated
The assignment is done before the evaluation of an expression
involving the variable that is the target of the assignment.
Parentheses can be used in normal mathematical fashion to override the
defined order of precedence. An expression in parentheses is ~valuated
by itself, and the resulting value is subsequently combined with the
other elements of the expression. For example, in the expression
(C2 + Cl)/C2
the addition is performed before
parentheses. In the expression
the
division
because
of
the
C2 + Cl/C2
Cl is first divided by C2 and then the result is added to C2.
The evaluation of a conditional
"Conditional Expression."
The evaluation of a
Expression."
Examples
Cl
Cl+3
Cl
"Ie""
Cl.
X
COMPLEX(X,Y)
Cl := ,., - C2
complex
case
complex
expression
expression
is
is
described
described
in
in
"Case
50'1
ExpreSSions
CABS(CI)
(COMPLEX(R,S) * CCON)
CASE I OF (CI, C2. CLN(C2»
IF BOOL THEN CI ELSE CONJUGATE(CI)
COMPLEX
510
ALGOL REFERENCE MANUAL
CONDITIONAL
CONDITIONAl" EXPRESSION
A conditional expression is one that returns one of two possible values,
depending upon a specified condition.
Syntax
<conditional
e~pression>
----<conditional arithmetic expression>-------I
I
!
I-<conditional Boolean expression>-------!
I
j-<conditional complex expression>-------I
I
I
i-<conditional designational expression>-!
I
I
I-<conditional pointer expression>-------I
See also
<conditional
<conditional
<conditional
<conditional
<conditional
arithmetiC expression> . . . . . . . . .
Boolean expression> . . .
complex expression> . . . . . . . . . . .
designational expression> . .
pointer expression> . . . .
• • 47b
. . . 495
. 507
512
520
Semantics
Conditional expressions are of the form
IF <Boolean expression> THEN <expression> ELSE <expression>
Either the first or the second expression is selected for evaluation,
depending on the value of the Boolean expression. The two alternative
expressions must be of the same kind: for example. two arithmetic
expressions or tWO Boolean expressions.
The selection process proceeds as follows:
The Boolean expression following "IF" is evaluated.
If the resulting value is TRUE. the expression following "THEN"
is evaluated. and the expression following "ELSE" is ignored.
If the resul~ing value is FALSE. the expression following "THEN"
is ignored. and the expression following "ELSE" is evaluated.
511
Expressions
CONDITIONAL
If either of the two expressions is itself a conditional expression, the
process is repeated until an unconditional expression is selected for
evaluation.
The type of a conditional arithmetic expression is DOUBLE if either of
its constituent expressions is of type DOUBLE: in this case, a
constituent expression that is not of type DOUBLE is extended to double
precision.
The type of a conditional arithmetic expression is INTEGER
if and only if both of its constituent expressions are of type INTEGER.
OtherWise, a conditional arithmetic expression is of type REAL
Examples
IF BOOL THEN 47 ELSE 95
IF A = B THEN BOOL ELSE FALSE
IF NOT BOOL THEN Cl ELSE C2
IF ALLDONE THEN EOJLBL ELSE NEXTLBL
IF CHAR.SZF = 8 THEN PTRINEBCDIC ELSE PTRINHEX
512
DESIGNATIONAL
ALGOL REFERENCE MANUAL
DESIGNATIOHAL &XPRESSION
Designational expressions are expressions that return a value that is
label.
a
Syntax
<designational expression>
----<labe1 designator>------------------------I
I
1
I-<designational case expression>--------I
I
1
I-<conditional designational expression>-I
<label designator>
----<label identifier>----------------------------------!
I
1
I-<switch label.identifier>-- [ --<subscript>-- ] -!
<designational case expression>
1<------------ . ------------1
1
1
--<case head>-- ( ---<designational expression>--- ) --I
<conditional designational expression>
--<if clause>--<designational
expression>~-
ELSE ------------------>
>-<designational expression>---------------------------------------I
See also
<case head> . . . . .
<if clause> . . . .
<label identifier> . .
<subscript> .
. ...
<switch label identifier> .
• • 263
. 319
. . . 128
43
. 195
513
Expressions
DESIGNATIONAL
Semantics
If a designational expression is a label identifi.r. then the
the expression is that label.
value
of
If a designational expression is a Bubscripted switch label identifier,
then the numerical value of the subscript designates one of the elements
in the switch label list. The value of the subscript is rounded, if
necessary, to an integer.
This· value is used as an index into the
switch label list. The entries of the list are numbered sequentially
from 1 through N, where N is the number of entries in the list. The
entry corresponding to the value of the subscript is. seleCted.
If the
value of the subscript is outside the range of the switch label list.
program control continues to the next statement without any error
indication. (For more information about the switch label list, refer to
"SWITCH LABEL Declaration.")·
The evaluatiqn of a designational case expression is described in
Expression. 1I
"Case
The evaluation of a conditional designational expression is described in
"Conditional Expression."
Examples
ENDLABEL
CHOOSELABEL[I+2]
CASE X OF (GOTDATA. GOTERR, GOTREAL, GOTCHANGE, ESCAPE)
IF K
=1
THEN SELECT[2] ELSE START
514
FUNCTION
ALGOL REFERENCE MANUAL
FUNCTION EXPRESSION
A function expression is an expression that returns a single value that
is the result of invoking a procedure. The procedure can be declared in
the program, or it can be an intrinsic procedure.
Syntax
<function expression>
----<arithmetic function designator>----I
I
I
I-<Boolean function designator>----I
I
I
I-<complex function designator>----I
I
I
I-<pointer function designator>----I
I
I
I-<string function designator>-----I
Semantics
There are two kinds of functions:
predefined functions.
called
intrinsic
functions, which are part of the ALGOL language, and
programmer-defined functions, which are typed procedures that are
declared in the program.
The intrinsic functions are described later in this
heading "Intrinsic Functions."
chapter
under
the
See also
Intrinsic Functions . . . . . . . . . . . . . . . . . . • . . . 528
Arithmetic Function Designator
An arithmetic function designator specifies a function that
arithmetic value--a value of type INTEGER. REAL. or DOUBLE.
returns
an
515
Expressions
FUNCTION
Syntax
<arithmetic function designator>
----<procedure identifier>--~---~----~-------------------------I
I
I I
I
I-<arithmetic intrinsic namej-I I-<actual parameter part>~1
<arithmetic intrinsic name>
Any of the names listed
Names" in this chapter.
under
the
heading
"Arithmetic
See also
<actual parameter part> . . .
Arithmetic Intrinsic Names . .
<procedure identifier> . . .
Intrinsic
. . 346
528
. 165
Semantics
The procedure specifled by the procedure
INTEGER, REAL. or DOUBLE.
identifier
must
be
of
type
Boolean Function Designator
A Boolean function designator s~ecifies
Boolean value--a value of TRUE or FALSE.
a
function
that
returns
Syntax
<Boolean function designator>
----<procedure
identifier>---~-------~----------------------I
I
I
I-<Boolean intrinsic name>-l j-<actual parameter part>-l
a
516
FUNCTION
ALGOL REFERENCE MANUAL
<Boolean intrinsic name>
Any of the names listed under the heading "Boolean Intrinsic
in this chapter.
See also
<actual parameter part> .
Boolean Intrinsic Names .
<procedure identifier>.
Names"
••
.
.
346
• 531
• 165
Semantics
The procedure specified by the procedure
.BOOLEAN.
identifier
must
be
of
type
Complex Function Designator
A complex function designator specifies a function that returns
complex value--a value with a real part and an imaginary part.
a
Syntax
<complex function designator>
----<procedure identifier>----------------------------------i
I
I I
I
I-<complex intrinsic name >-1 1- <actual parameter part >-1
<complex intrinsic name>
Any of the names listed under the heading "Complex Intrinsic
in this chapter.
See also
<actual parameter part> . .
Complex Intrinsic Names .
<procedure identifier> . . . .
Names"
• 34b
.
.
.
. 531
. 165
517
Expressions
FUNCTION
Semantics
The procedure specified by the procedure
COMPLEX.
identifier
must
be
of
type
Pointer Function Designator
A pointer function designator specifies a function that returns a
pointer value~-a value that can be used to refer to a character position
in an array row.
Syntax
<pointer function designator>
--<pointer intrinsic name>--<actual parameter part>--I
<pointer intrinsic name>
Any of the names listed under the heading "Pointer Intrinsic
in this chapter.
See also
<actual parameter part>
Pointer Intrinsic Names .
Names"
• 346
. 531
Semantics
Unlike the other function designators, the syntax for pointer function
designator does not allow a procedure identifier as part of the syntax.
There is no PROCEDURE declaration that allows declaring a procedure of
type POINTER.
518
FUNCTION
ALGOL REFERENCE MANUAL
string Function Designator
A string function designator specifies a function that returns a string
value--a hexadecimal string. an ASCII string, or an EBCDIC string.
Syntax
<string function designator>
----<string procedure identifier>--------------------------------I
I I
I
I-<string intrinsic name>-------I I-<actual parameter part>-I
<string intrinsic name>
Any of the names listed under the heading "String
in this chapter.
See also
<actual parameter part> . . . .
String Intrinsic Names . . . . .
<string procedure identifier>
Intrinsic
Names"
. . . 346
. • 531
. 165
Semantics
A string procedure identifier designates a procedure
typ~ of HEX STRING, ASCII STRING, or EBCDIC STRING.
declared
with
a
519
Expressions
POINTER
POINTER EXPRESSION
A pointer expression is an expression that returns a value that is a
pointer. which can be used to reference a character position in an array
row.
Syntax
<pointer expression>
----<simple pointer expression>---------I
I
I
I-<conditional pointer expression>-I
<simple pointer expressiori>
---~<pointer
primary>---------~---I
I
I
I
I-<skip>-I
I I
I-<pointer assignment>-------I
I
I
I-<character array part>-----I
I
<pointer primary>
----<pointer identifier>--------------I
!
! .
1- ( --<pointer expression>-- ) -I
I
I-<pointer case express1on>-~~---!
I
i
!-<pointer function designator>--I
<pointer case expression>
1<---------
---------:
1
--<case headj-- ( ---<pointer expression>--- ) --I
j-
+
---<arithmetic
-
-I
primary>~-i
520
POINTER
ALGOL REFERENCE MANUAL
<character array part>
----<character array
row>--------~---------------------I
1
1
1<----- , ----I
1
1
I
I
I
I
I-<character array name>-- [ ---<subscript.>--;....J -f
<character array row>
An <array row> whose identifier is declared with a <charac.ter type>.
<character array name>
An <array name> whose
type> .
identifier
is
declared
with
a
(character
<conditional pointer expression>
--<if clause>--<pointer expression>-- ELSE --<pointer
See also
<arithmetic primary>.
<array name> . . . . • . . .
<array row> . . .
<case head> . . • . .
<character type>.
<if clause> . . . .
<pointer assignment> . .
<pointer function designator> .
. ..•.•.
<pointer identifier>. .
. ......•.
<subscript) . . . . . . . . .
. ...
expression>~-I
476
43
43
~ 263
•
•
•
·
42
319
241
517
160
43
\
521
POINTER
Expressions
Semantics
A pointer must be initialized befote it can be used; otherwise, a
run-time error occurs.
A pOinter can be initialized in the following
ways:
1.
By a pointer assignment
2.
By appearing as an update pointer in any of the following:
a REPLACE statement
a SCAN statement
a string relation in a Boolean expression
the DOUBLE function
the INTEGER function
The evaluation of a conditional
"Conditional Expr~ssion."
pointer
~xpression
is
described
in
'(pointer primary>
A one-dimensional array designator or a fully subscripted variable can
be interpreted as a pointer primar~ whenever context determines that no
conflict exists with other valid constructs (for example. when a pointer
expression is required). This syntax can be used for such constructs as
REPLACE A BY B FOR 10 WORDS
where A and B are
one-dimen~ional
The evaluation of a
Expression."
pointer
arrays.
case' expression
is
described
in
"Case
<Sk.ip>
If the <skip> construct is used, the value of the arithmetic primary
determines the adjustment to the ~alue of the pointer primary. If N is
the value of the arithmetic primary, the pointer is adjusted as follows:
If N is less than or equal to zero. the pointer is not adjusted.
522
POINTER
ALGOL REFERENCE MANUAL
If N is greater than zero. then the pointer is adjusted N
characters to the right if the <skip> construct specifies "+". or
N characters to the left if it specifies
Skipping to the
right is defined as incrementing the value o~ the character
index. Skipping to the left is defined as decrementing -this
value.
ft_ft.
If the aajustment to the value of the pointer primary is given by the
value of an arithmetic expression. note that the arithmetic expression
must be enclosed in parentheses. For example, the expression
PTR + X*y
is invalid and will get a compile-time error.
as
It is
correctly
written
PTR' + (x*y)
pragmatics
The use of a pointer expression to skip up and down an array for more
than a few words is expensive. Each word of the array is accessed in
order to ensure that no memory-protected words are encountered.
For
pointer moves of more than a few words, it is faster to re-index the
array and use the POINTER (unction for word arrays, or to re-index the
array for character arrays.
Examples
PTR
PTS+15
PTR := POINTER(A)
(PTEMP + (X*y»
HEXARAY
HEXARAY[N=
CASE VAL OF (PTR,PTS.PTEMP,PSORCE)
POINTER(INFO.8)
READLOCK(PTR.POLD)
IF BOOL THEN PI ELSE POINTER(A)
523
Expressions
STRING
STRING EXPRESSION
A string expression is an expr~ssion that returns a
hexadecimal string. EBCDIC string. or ASCII string.
value
that
is
a
Syntax
<string expression>
--<string
primary>----~-------~-----------------~------------------)
>----------------.-------------.------------------------------------1
1
I
I<--------------------------------~-----------------I
I
II
I I
I---<string concatenation operator>--<string primary>---I
oJ
<string concatenation operator>
CAT ----I
I
1
1- II --I
<string primary>
----<string
i
I-<string
constant>-----~--------------I
variable>--------~~-------I
,-<subscripted string variable>-----j
1
I.
I-<stringfunction
designator>------~
i
1
I-<string-valuedlibrary
~ttribute>-r
I
1
1- ( --<string expression>--
-----1
<string constant>
---- EMPTY
1
--------~-----------------I
I
I-<EBCDIC string constant>------\
;
I
I
I
I-<ASCII string constant>-------I
!
I-<hexadecimal string constant>-I
524
STRING
ALGOL REFERENCE MANUAL
<ESCDIC string constant>
---- EMPTY8
I
1
---------------------------------------------1
I
I<---------------------------~------------------I"
1 1
1--------------------- " --<EBCDIC
I
I~<EBCDIC
1
1
1
---I
string>-- " -
1
code>-I
1
1- 48 ---- " --<hexadeCimal string>-- "
I
I
1- 480 -:
"I
jI
28 ---- " --<quaternary string>-- " -----
1- 280 -I
I
I- 18---- " --<binary string>-- "
I
1- 180 -I
I
---------1
<ASCII string constant>
-------------------------------------------1
1
1 1<--------------------------------------------1 I
1 1
I I
1-------------------- " --<ASCII string>-- " -----1
---- EMPTY7
1
I
I
I-<ASCII code>-I
I
1- 47 ---- " --<hexadecimal string>-- " -I
1- 470 -i
i
i- 27 ---- " --<quaternary string>-- " --I
1- 270
-i
1- 17 ---- " --<binary string>-- " -------
1- 170 -
525
STRING
Expressions
<hexadecimal string constant>
-~-- EMPTY4 ------------~~--~~----~-------~----------I
1
'
I
I I~~~~-------------~-------------------------'I I
' I I
, I'I
1;...,..--- 4 ..:':"'-I
!
tl
--<hexadecimal string>-- " -----1
1- 40 -I
I
I
1- 24
" -7<quaternary string>-- " -I
!
I
1- 240 -i
I
1- 14 ---- " --<binary string>-- " -----1
I
I~ 140 -I
<string variable>
--<string identifier>--!
, <subscripted stririg variable>
----I
I
--<string array 1dentifier>-- [ ---<subscript>--- ]--1
1<-----
t
t
<string-valued library attribute>
--<library identifier>-- " ----..:----------------------------------->
>-<string-va1ued library
<const~nt
attribut~
name>---------------------------!
string expression>
A <string express;ion> that can be Ol11y evaluated at compile 'time.
S'ee
also
<library identifier> . . . . . .
<string array ide,ntifier> . .
<string function designator> . .
<string identifier> . . . . .
. .. .
<s'tring-valued library attribute name> . . .
<subser ipt > • • • •• • •• • • • • • • • • • •
.
. . 129
187
. 518
. . . . . 185
129
43
526
STRING
ALGOL REFERENCE MANUAL
Semantics
In the syntax for EBCDIC string constant. ASCII string constant, and
hexadecimal
string
constant.
the
string
codes
determine the
interpretation of the characters between the quotation marks (") and has
no effect on the justification of a string.
A string is always
left-justified; therefore. any "0" in a string code is ignored.
The <.t..w;.;.ul\.... ""~'- L ..: :C,L-ru.e;. IS G}. • ,,-,,'
..•.
a
Lr:: . . >:I:::'
string constant
containing an EBCDIC string only if the default character type is
EBCDIC. The <ASCII code> construct is optional in an ASCII string
constant containing an ASCII string only if the default character type
is ASCII. For more information, refer to "String Code" in the chapter
"Language Components" and "Default Character Type" in the appendix "Data
Representation."
The reserved words EMPTY8, EMPTY7, and EMPTY4 represent null strings of
the character types EBCDIC. ASCII, and hexadecimal, respectively. The
reserved word EMPTY represents a null string of the default character
type.
For more information about string-valued library attributes. refer to
"Library Attributes" in the "Interface to the Library Facility" chapter.
String Concatenation
The operators CAT and I I are used to concatenate two strings.
The
concatenation of two strings yields a new string whose length is the sum
of the lengths of the two original strings. and whose value is formed by
joining a copy of the second string immediately onto the end of a cOpy
of the first string.
Only strings of the same character type can be concatenated.
If more than one string primary is used in
they are evaluatec from left to right.
a
concatenation
operation.
E;xpressions
527
STRING
Pragmatics
No more than 256 characters can appear between one pair of quotation
marks in a string constant; however, as many as 4095 characters can
or
appear in an EBCDIC string constant, ASCII string constant,
hexadecimal string constant.
See also
Default Character Type.
Library Attributes . . . . . .
String code . . . . . . .
Examples
8"ABCD123"
% result = ABCD123
""WHY"4S"6F""""
% result = "WHY?"
EMPTYS
% result =
S2 I I S3
"AC" II S2 II "123'"
Sl I I TRANSLATE(S2.HEXTOEBCDIC)
HEAD(S,ALPHA)
TAIL( S. NOT "-")
REPEAT( "ABC" . 3)
STRING(256.*)
TAKE(S.2)
DROP(TAKE(S.4).2)
TRANSLATE(S,HEXTOEBCDIC)
S17
. 665
36
528
Intrinsic Functions
~
ALGOL REFERENCE MANUAL
INTRtHSIC FUNCTIONS
Intrinsic functions are typed procedures that are predefined in the
ALGOL languag~~ that is, intrinsic functiOns can be used without being
declared~
INTRInSIC
~
BX
~
RETURNED
intrinsic functions of ALGOL return values of
DOUBLE, BOOLEAN. COMPLEX, POINTER, and STRING.
The
ArithmetiC Inttinsic
type
INTEGER;
REAL,
~
The following intrinsic functions return arithmetic
type 1NTEGER. REAL. and DOUBLE).
values
(values
of
52q
Expressions
Intrinsic Functions
Alphabetical Listinl~ of Arithmetic Intrinsic Functions
The type of the value each function returns, INTEGER. REAL. or DOUBLE,
is indicated by I, R. or D. respectively, following the name of the
function.
ABS (R)
ARCCOS (R)
ARCSIN (R)
ARCTAN (R)
ARCTAN2 (R)
ARRAYSEARCH (I)
ATANH (R)
CABS (R)
CHECKSUM (R)
CLOSE (I)
COMP1LETIME (R)
COS (R)
COSH (R)
COTAN (R)
DABS (D)
DAND (D)
DARCCOS (D)
DARCSIN (D)
DARCTAN (D)
DARCTAN2(D)
DCOS (D)
DCOSH (D)
DECIMAL (D)
DELINKLIBRARY (I)
DELTA (I)
DEQV (D)
DERF (D)
DERFC (D)
DEXP (D)
DGANMA (D)
DIMP (D)
DINTEGER (D)
DLGAMMA (D)
DLN (D)
DLOG (D)
DMAX (D)
DMIN (D)
DNABS (D)
DNOT (D)
DOR (D)
DOUBLE (D)
DSCALELEFT (D)
DSCALERIGHT (D)
DSCALE~IGHTT (D)
DSIN (D)
DSINH (D)
DSQRT (D)
DTAN (D)
DTANH (D)
ENTlER (I)
ERF (R)
ERFC (R)
EXP (R)
FIRST (R)
FIRSTO:tfE (I)
FIRSTWORD (R)
GAMMA (R)
IMAG (R)
INTEGER (I)
INTEGERT (I)
LENGTH. (I)
LINENUMBER (I)
LINKLI13RARY (I)
LI STLOOKUP (I).
LN (R)
LNGAMMA (R)
LOG (R)
MASKSEARCH (I)
MAX (R)
MESSAGESEARCHER (I)
MIN (R)
NABS (R)
NORMALIZE (R)
OFFSET (I)
ONES (I)
OPEN (I)
POTC (D)
POTH (D)
POTL (D)
PROCESS1D (I)
RANDOM (R)
READLOCK (R)
REAL (R)
REMAIN1NGCHARS (I)
SCALELEFT (I)
SCALERIGHT(I)
SCALER1GHTF (R)
SCALERIGHTT (I)
SECONDWORD (R)
SETACTUALNAME (I)
SIGN (I)
SIN (R)
SINGLE (R)
SINH (R)
SIZE (I)
SQRT (R)
TAN (R)
TANH (R)
TIME (R)
VALUE (I)
WAIT (I)
WAITANDRESET (I)
530
Intrinsic Functions
ALGOL REFERENCE MANUAL
Listing of·Arithmetic Intrinsic Functions by Type Returned
Intrinsic Functions Returning Values of Type INTEGER
ARRAYSEARCH~
CLOSE
DELINKLIBRARY
DELTA
ENTlER
FIRSTONE
INTEGER
INTEGERT
LENGTH
LINENUMBER
LINKLIBRARY
....... LISTLOOKUP
'-<MASKSEARCH
MESSAGESEARCHER
OFFSET
ONES
OPEN
PROCESSID
REMAININGCHARS
SCALELEFT
SCALERIGHT
SCALERIGHTT
SETACTUALNAME
SIGN
SIZE
VALUE
WAIT
WAITANDRESET
"
Intrinsic Functions Returning Values of Type'REAL
ABS
ARCCOS
ARCSIN
ARCTAN
ARCTAN2
ATANH
CABS
CHECKSUM
COMPILETIME
COS
COSH
COTAN
ERF
ERFC
EXP
FIRST
FIRSTWORD
GAMMA
IMAG
LN
LNGAMMA
LOG
MAx
MIN
NABS
NORMALIZE
RANDOM
READLOCK
REAL
SCALERIGHTF
SECONDWORD
SIN
SINGLE
SINH
SQRT
TAN
TANH
TIME
Intrinsic Functions Returning Values of Type DOUBLE
DABS
DAND
DARCCOS
DARCSIN
DARCTAl'
DARCTAN2
DCOS
DCOSH
DECIMAL
DEQV
DERF
DERFC
DEXP
DGAMMA
DIMP
DINTEGER
DLGAMMA
DLN
DLOG
DMAX
DMIN
DNABS
DNOT
DOR
DOUBLE
DSCALELEFT
DSCALERIGH'1'
DSCALERIGHTT
DSIN
DSINH
DSQRT
DTAN
DTANP.
POTC
POTH
POTI..
531
Expressions
Intrinsic Functions
Boolean Intrinsic Na.mes
The following intrinsic functions return values of type BOOLEAN.
ACCEPT
AVAILABLE
BOOLEAN
CHANGEFILE
CHECKPOINT
FIX
FREE
HAPPENED
READ
READ LOCK
REMOVEFILE
SEEK
SPACE
WAIT
WRITE
Complex Intrinsic Bgmes
The following intrinsic functions return values of type COMPLEX.
CCOS
CEXP
CLN
COMPLEX
CONJUGATE
CSIN
CSQRT
Pointer Intrinsic Names
The following intrinsic functions'return values of type POINTER.
POINTER
READ LOCK
String Intrinsic
Nam~
The following intrinsic functions return values of type STRING.
DROP
HEAD
REPEAT
STRING
STRING4
STRING7
STRING8
TAIL
TAKE
TRANSLATE
532
Intrinsic Functions
ALGOL REFERENCE MANUAL
INTRINSIC FUNCTION DESCRIPTIONS
For arithmetic intrinsic functions, all arithmetic parameters are
assumed to be call-by-value. For a further description of some of the
arithmetic intrinsic functions, refer ~o the chapter "Mathematical
Functions" in the "System Software Utilities Reference Manual."
<abs function>
-- ABS -- ( --<arithmetic expression>-- ) --I
The ABS function returns. as a real value, the
specified arithmetic expression.
absolute
value
of
the
<accept statement>
The ACCEPT statement returns a Boolean
refer to "ACCEPT Statement."
value.
For
more
information.
<arccos ftinction>
-- ARCCOS -- ( --<arithmetic expression>-The ARCCOS function returns, as a real value, the principal value of the
arccosine (in radians) of the speCified arithmetic expression, where
-1 < (arithmetic expression> < 1.
If the value of the
arithmetic
expression is not in this range, a run-time error occurs.
<arcsin function>
-- ARCSIN -- ( --<arithmetic expression>-- ) --:
The ARCSIN function returns, as a real value. the prinCipal value of the
arcsine (in radians) of the speCified arithmetic expression, where
-1 < <arithmetic expression> < 1.
If the value of the
arithmetic
expression is not in this range. a run-time error occurs.
533
Intrinsic Functions
Expresisions
<arctan furictlon>
-- ARCTAN -- ( --<arithmetic expression>-- )
~-I
The ARCTAN fundtion returns, as a real value, the principal value of the
arctangent (in radian~) of the specified atithmetic expression.
<aretan2 fUnction>
-- ARCTAN2 -- ( --<arithmetic expression>-- .
>-<arithmetic expression>-- )
The ARCTAN2 function returns,
radians) of
------------------~-->
-------------------------------------1
as
a
real
value,
the
arctangent
(in
first <arithmetic expression> / second <arithmetic expression>
the teturned value is adjusted to fall in the range (-pi to +pi) by
following formula:
the
Let X be the value of the first arithmetic expression and Y be the value
of the second arithmetic expression.
If Y > 0,
ARCTAN2(X,Y) = ARCTAN(X/Y)
If
y = 0,
ARCTAN2(X~Y)
= SIGN(X)
11
pi /
.::.
If y < 0,
ARCTAN2(X,Y) = ARCTAN(X/Y) + SIGN;(X) * pi
534
Intrinsic Functions
ALGOL REFERENCE MANUAL
<arrayseareh function>
-- ARRAYSEARCH -- ( --<arithmetic expression>-- , ----------------->
>-<arithmetic expression>-- . ---<array row>-------------- ) ------1
1
I
I-<subscripted variable>-I
See also
<array row> . . . . . .
<subscripted variable>.
.
.
.
.
•
•
•
43
•
• 225
The ARRAYSEARCH function searches for a specific value within an array.
The first arithmetic expression is the value being searched for (the
target value). The second arithmetic expression is the mask to be used
in the search. The third parameter is a row or subscriPted variable of
an array of type INTEGER, REAL, BOOLEAN, or COMPLEX.
If the third parameter is an array row, the search begins with the last
element of the specified array row; otherwise, the search begins with
the element specified by the subscripted variable.
Each element, in
turn. is retrieved. logically ANDed with the value of the mask. and
compared. using the IS operator. with the target value, which has also
been logically ANDed with the mask. If the comparison yields TRUE. the
function returns an integer value equal to the difference between the
subscript of the element where the value is found and the subscript of
the first element in the array. If the comparison yields FALSE, the
subscript of the element to be retrieved is decremented by one, and the
search continues until either a match is found or the first element of
the array has been examined. If no match is found, -1 is returned.
The ARRAY SEARCH function can be used on
unpaged (unsegmented) arrays.
paged
(segmented)
arrays
and
<atanh function>
-- ATANH --
--<arithmetic expression>-- ) --I
The ATANH function returns, as a real value, the
of the specified arithmetic expression.
hyperbolic
arctangent
535
Expressions
Intrinsic Functions
<available function>
-- AVAILABLE -- (
~-<event
designator>-- )--1
See also
<event designator>. • . . . . . . . . • . . . . . . . . . . . .
78
The AVAILABLE function is a Boolean function that returns TRUE if the
available state of the specifi~d event. is TRUE (available) and returns
FALSE if the available state is FALSE (not available).
(Bool~an
function>
-- BOOLEAN -- ( --<arithmetic expression>-- )
~-l
The BOOLEAN function returns the value 6f the arithmetic expression as a
Boolean value.
Ii
the arith~etic expression is double precision. its
value is first truncated to single precision.
(cabs function>
-- CABS -- ( --<complex
expression~--
) --I
The CABS function returns, as a real val,ue, the absolute
specified complex expression.
value
of
the
<ccos function>
-- CCOS -- ( ---<complex expression>-- ) --I
The CCOSfunction returns. as a ·complex value, the complex cosine of the
specified complex expression.
53b
Intrinsic Functions
ALGOL REFERENCE MANUAL
<cexp function)
-- CEX? -- ( --<complex expression>-- ) --I
The CEXP function returns. as a complex value.
e .... <complex expression>
where e is the base of the natural logarithms.
<changefile statement)
The CHANGEFILE statement ret'J.rns a Boolean value.
refer to "CHANGEFILE Statement."
For more informati.or:"
:checkpoint statement)
The CHECKPOINT statement returns a Boolean value.
refer to "CHECKPOINT Statement.
II
For more informatioll.
537
Expressions
Intrinsic Functions
<checksum function>
-- CHECKSUM -- ( --<array row)-- , --<starting index>-- • ---------)
>-<ending index>-- )
----------------------------------------------1
<starting index>
--<arithmetic expression>--I
<ending index>
--<arithmetic expression>--I
See also
<array row> . . . . . . . . . . . . . . . . . . . . . . . . . .
43
The CHECKSUM function returns. a$ a real value, a hash function of all
bits in the words o! the arra~ row beginning with the word indexed by
<starting index> and up to, but 'not including, the word indexed by
<ending index>. Both <starting index> and <ending index> are rounded to
an integer value before they are1used to index the array row. The value
of this function can be used to verify the integrity of data being
transferred or stored. The arra~ row must be single precision and
unpaged (unsegmented).
<cln function>
-- CLN -- ( --<complex expression>-- ) --I
The CLN function returns, as a complex value, the natural
the specified complex expression.
logarithm
of
<close statement>
The CLOSE statement returns an integer
refer to "CLOSE Statement."
value.
For
more
information,
538
Intrinsic Functions
ALGOL REFERENCE MANUAL
<compiletime function>
-- COMPILETIME -- ( --<constant arithmetic expression>-- ) --I
See also
<constant arithmetic expression> . . . . . . . . . . . . . . . . 476
The COMPILETIME function obtains various system time values at compile
time, for use by the object program. The form of the value returned by
the COMPILETIME function is the same as that returned by the TIME
function for the same argument. The returned value is compute~ ",
compiler using the TIME function at compile time. For more informaLlon,
refer to the TIME function in this section.
COMPILETIME(20) returns, in integer form, the program version number
set by the most recent VERSION compiler coritrol option.
as
COMPILETIME(21) returns. in integer form, the program cycle
set by the most recent VERSION compiler control option.
number
as
COMPILETIME(22) returns. in integer form, the program patch
set by the most recent VERSION compiler control option.
number
as
<complex function>
-- COMPLEX -- ( --<arithmetic expression>-- •
-------------~------->
>-<arithmetic expression>-- ) -------------------------------------/
The COMPLEX function returns, as a complex value,
first <arithmetic expression>
+
i
* second <arithmetic expression>
where i is the square root of -1. The arithmetic expressions are
rOL':ded to single precision, if necessary.
first
Expressions
Intrinsic Functions
<conjugate function>
-- CONJUGATE -- ( --<complex expresEion>-- ) --I
The CONJUGATE function returns, as a complex
conjugate of the specified complex expression.
value.
the
comple)
<cos function>
-- COS -- ( --<arithmetic expression>--
--I
The COS function returns, as a real value, the cosine
<arithmetic expression> radians.
of
an
angle
01
<cosh function>
-- COSH -- ( --<arithmetic
e~pression>--
) --I
The COSH function returns. as a real value, the hyperbolic cosine of the
specified arithmetic expression.
<cotan function>
-- COTAN -- ( --<arithmetic
expre~sion>--
)
The COTAN function returns. as areal value, the cotangent of
of <arithmetic expression> radians.
angl~
all
<csin function>
-- CSIN -- (
~-<complex
expressioD>--
The CSIN function returns, as a complex value. the complex sine
specified complex expression.
of
th
540
Intrinsic Functions
ALGOL REFERENCE MANUAL
<csqrt function>
-- CSQRT -- ( --<complex expression>-- ) --I
The CSQRT function returns, as a complex value, the square root
specified complex expression.
of
the
<dabs function>
-- DABS -- ( --<arithmetic expression>-- ) --I
The DABS function returns. as a double-precision
value of the specified arithmetic expression.
value.
the
absolute
<dand function>
-- DAND -- ( --<arithmetic expression>-- .
>-<arithmetic expression>-- )
--------~--------------->
-------------------------------------1
The DAND function returns. as a double-precision value,
first <arithmetic expression> AND second <arithmetic expression>
The arithmetic expressions are first exxended to double precision,
necessary, and the AND operation is performed on all q6 bits.
if
<darccos function>
-- DARCCOS -- ( --<arithmetic expression>--
--I
The DARCCOS function returns. as a double-precision value. the principal
value of the arccosine (in radians) of the specified arithmetic
expression, where -1 < <arithmetic expression> ~ 1. If the value of the
arithmetic expression is not in this range. a run-time error occurs.
541
Intrinsic Functions
Expres£ions
<darcsin fUnction>
-- DARCSIN -- ( --<arithmetic expression>-- ) --I
The DARCSIN function returns,as a double-precision value, the principal
value. of
the arcsine (in radians) of the specified arithmetic
expression, where -1 «arithm~tic expression> < 1. If the value of the
arithmetic .expression is not in this range, a run-time error occurs.
<darctan function>
-- DARCTAN -- (--<arithmetic expression>-- ) --I
The DARCTAN function returns, as a double~precision value. the principal
value of the arctangent (in radians) of the specified arithmetic
expression.
<darctan2 function>
-- DARCTAN2 -- ( --<arithmetic expression>-- . --------------------)
)-<arithmetic expression>-- )
The DARCTAN2 function returns. as a double-precision
principal value of the arctangent (in radians) of
value.
the
first <arithmetic expression> / second <arithmetic expression>
<deos function>
-- DCOS -- ( --<arithmetic expression>-- )
--I
The DCOS function returns, as a double-precision value, the cosine of an
angle of <arithmetic expression> radians.
542
Intrinsic Functions
ALGOL REFERENCE MANUAL
<dcosh function>
-- DCOSH -- ( --<arithmetic expression>-- ) --I
The DCOSE function returns. as a double-precision value. the
cosine of the specified arithmetic expression.
hyperbolic
<decimal function>
-- DECIMAL -- ( ..,--<string expression:--- ) --I
The DECIMAL function returns the double-precision value
the string expression.
represented
by
The string expression must yield a valid <number> on evaluation (see
"Number" in the chapter "Language Components").
For example. the
assignment
D
.- DECIMAL( STR):
is valid for the strings
"+5497823"
STR
STR
"1.75@-46"
STR = "-4.31408"
STR = u@2"
STR = u+549" II "7823"
However
STR
STR
STR
STR
t
for the strings
=
=
=
"50 00. "
"1,505,278.00"
"[email protected]"
".573"11"5.82"
the program is given a run-time error.
543
Expressions
Intrinsic Functions
<delinklibrary functiolJl}
-- DELINKLIBRARY -- i
--<librar~
identifler>--) --I
See also
<library identifier> . . . . . . . . . . . . . .
~
. . . . . . . 129
The DELINKLIBRARY function del inks the program from the librar
'specified by the library identifier. The DELINKLIBRARY function affects
only th~ linkage between the program and the indicated library; other
programs using the library program are not ~fiected. This function
returns an integer value that indicates success or failure and the
reason for failure.
The values returned by the functi-on can be
interpreted a~ follows~
Value
Meaning
1
The library has been delinked from the program.
o
The library was not linked to the program.
-1
The library structure could not be accessed; a system fault has
occurred.
'(delta function>
DELTA -- ( --<pointer expression>-- • --<pointer expression>---->
>- ) --------------------~----~------~-----------------------------1
The DELTA function returns, as an integer value, the number of
characters between the character position' referenced by the first
pointer expression and the charact~r position referenced by the second
'¢ointer expression. The value is calculated as follows: the character
position referenced by the first pOinter expression is subtracted from
the character position referenced by the second pointer expression.
For a function that returns the number of characters between the
character position referenced by ~ pointer expression and the beginning
of the array row. see the OFFSET function in this section.
For a
function that returns the number of characters between the character
position referenced by a pointer expression and the end of the array
row. see the REMAININGCHARS function in this section.
544
Intrinsic Functions
ALGOL REFERENCE MANUAL
<deqv function>
-- DEQV -- ( --<arithmetic expression>-- . ------------------------>
)-<arithmetic expression>-- )
--------------------------------------1
The DEOV function returns, as a double-precision value,
r~r~
~lirithmetic
expression> EQV second <arithmetic expression>
arithmetic expressions are first extended to double precision,
necessary, and the EQV operation is performed on all 96 bits.
Both
if
<derf function>
-- DERF -- ( --<arithmetic expression>--
--j
The DERF function returns, as a double-precision value. the value of the
standard error function at the specified arithmetic expression. For any
valid N. DERF(-N) = -DERF(N).
'derfc function>
-- DERFC --
--<arithmetic expression)-- )
--j
The DERFC function returns, as a double-precision value, the complement
of the value of the standard error function at the specified arithmetic
expression. For any valid N. DERFC(N) = l - DERF(N).
<dexp function>
-- DEXP -- ( --<arithmetic expression>-- ) --I
The DEXP
f~nc~ion
returns. as a double-precision value.
** <arithmetic expression>
wnere e is the base of the
natura~
logarithms.
545
Expressions
Intrinsic Functions
<dgamma function>
-- DGAMMA --
--<arithmetic exp'ression>--
--I
I
The DGAMMA function returns. as a dduble-precision value. the
the gamma function at the specified 'arithmetic expression.
value
of
<dimp function>
-- DIMP -- ( --<arithmetic
expr~ssion>--
• ------------------------>
)-<arithmetic exprE?ssion>-- ) -------------------------------------\
The DIMP function returns. as a double-precision value.
first <arithmetic expression>
I~P
second <arithmetic expression>
Both arithmetic expressions are first extended to double precision,
necessary. and the IMP operation is performed on all Qb bits.
if
<dinteger function>
-- DINTEGER -- ( --<arithmetic expression>-- ) --I
The DINTEGER function returns the value of the arithmetic expression as
a double-precision integer value. Specifically. the function returns
DOUBLE(ENTIER«arithmetic
expr~ssion>
+
0.5»)
<dlgamma function>
-- DLGAM¥.i-_ -- ( ---<arithmetic expression',--
--I
The DLGAMMA function returns. as a double-precision value, the natural
logarithm of the gamma function at the specified arithmetic expression.
Intrinsic Functions
ALGOL REFERENCE MANUAL
-- DLN -- ( --<arithmetic expression>--
--I
The DLN function returns, as a double-precision
lognrithm of the specified arithmetic expression.
value,
the
natural
value,
the
base-lO
Junction>
-- DLOG -- ( --<arithmetic expression>-- ) --I
DLOG function returns. as a double-precision
logarithm of the specified arithmetiC expression.
'Tl12
(;:imax function)
1<----------- ,
DMAX -- (
---<ar~thmetic
----------1
expression>---
-~I
The D11AX function returns, as a double-precision value, the
the values of all the specified arithmetiC expressions.
<dlll.in
maximum
of
minimum
of
function>
1<----------DMIN -- ( ---<arithmetic expression>---
--I
Tne DMIN function returns. as a double-precision v~lue. the
tne values of all the specified arithmetiC express;i'ons.
547
Expressions
Intrinsic Functlons
<dnabs function>
-- DNABS -- ( --<arithmetic expression>-- ) --I
The DNABS function returns, as a dduble-precision value, the negative of
the absolute value of thesp~cified arithmetic expression.
<dnot function>
-- DNOT -- ( --<arithmetic expression>-- ) --I
The DNOT function returns, as a double-precision value, the logical
complement' of the value of the arithmetic expression. The arithmetic
expression is first extended to dotible precision, if necessary, and the
NOT operation is performed on all 96 bits.
<dor function>
-- DOR
~-
~
--<arithmetic expression>-- , --------------------------)
>-<arithmetic expression>-- ) -------------------------------------!
The DOR function returns, as a double-precision value,
first <arithmetic expression> OR second <arithmetic expression>
Both arithmetic expressions are first extended to double precision,
necessary. and the OR operation is'performed on all 9b bits.
if
548
Intrinsic Functions
ALGOL REFERENCE MANUAL
<double function>
The DOUBLE function has
double-precision value.
-- DOUBLE --
three
forms,
each
of
which
returns
a
--<arithmetic expression>-- ) --I
This form of the DOUBLE function returns the value of the arithmetic
expression extended to a double-precision value.
DOUBLE -- ( --<arithmetic expression>-- . --<arithmetic expression>->
>- ) ------------------------------------------------------------------/
This form of the DOUBLE function returns a double-precision value in
which the first word is equal to the value of the first arithmetic
expression and the second word is equal to the value of the second
arithmetic
expression.
The arithmetic expressions are first
truncated to single precision. if necessary.
-- DOUBLE -- ( ----------------------<pointer expression>-- •
I
I
/-<update pointer>-I
>-<arithmetic expression>-- )
------~-->
-----------------------------------------i
See also
<upda t e po i n t e r ;;. . . . . . . . . . . . . . . . . . . . . . . . 3 7 q
This form of the DOUBLE function returns. as a double-precision
value. the decimal value represented by the string of characters
starting with the character pointed to by the pOinter expression.
The arithmetic expression specifies the length of the string and
must have a value, when rounded to an integer. less than 24.
A zone field configuration of 1"1101" for 8-bit characters or 1"10"
for 6-bit characters in the least significant character position
causes the result of the function to be negative.
With 4-bit
characters, a 1"1101" in the most significant character position
results in a negative value.
Expr4ssions
Intrinsic Functlons
The state of the pointer expres~ion when the count is exhausted
be preserved by using the <update poin:er> construct.
can
<dr-ap function)
DROP -- ( --(string expression>-- • --<arithmetic expression>--->
,
.
-----------------------~--------------------------------------1
The DROP function returns a string With a value equal to the value 01
:he string expression with the fir~t <arithmetic expression> characters
de.lt-::ted.
integer,
The value of the' arithffi,letic expression is rounded to an
if necessary.
An error occurs if the rounded value of the
~rithmetic expression is greater than the number of
characters in the
tring expression or less than zero.
If the rounded value of the
:i):-ithmetic expression is zero, the ,result is the same as the value of
l:!l('
string expressl.on.
If th~ rounded value of the ar'ithme'Cic
:~Y.pres:";lon is equal' to the length qf fhe string expression,
the resul t
5 ~he null string.
I
'i'he DROP furlction and the TAKE
fuI1ction are complementary functlons.
This means that for any string expression S and any arithmetiC
c';cp:cession A in the range 0 ( = A <~ LENGTH(S). the following rele,tion is
1 \Ijay s TRUE:
s
-~,)E
~
TAKE(S,A) CAT DROP(S,A)
tl1(:? TAKE
function in this
n the examples
d'A3CDEF".
r~;,:2)
string
::: 8"CDEF"
!jI~QP(TAKE(S,4),2)
; I ~2.
below.
=
sect~or;.
8 e!)"
It
0 P ( S , 6 ') = the null s t r i n b
S
has
a
length
of
b
and
contains
550
Intrinsic Functions
ALGOL REFERENCE MANUAL
<dscaleleft function>
-- DSCALELEFT -- ( --<arithmetic expression>-- , ------------------>
>-<arithmetic expression)-- )
-------------------------------------1
The DSCALELEFT function returns. as a double-precision value,
first <arithmetic expression>*(lO ** second <arithmetic expression»
where the second arithmetic expression, rounded to an integer, has a
value in the range 0 to 12. The DSCALELEFT function is undefined when
the integerized value of the second arithmetic expre~sion is less than 0
or greater than 12.
<dscalerjght function>
-- DSCALERIGHT -- ( --<arithmetic expression>-- , -----------------)
>-<arithmetic expre$sion>-- )
The DSCALERIGHT function
rounded result of
returns,
---------------~---------------------I
as
a
double~precision
value,
the
first <arithmetic expression>/(IO ** second <arithmetic expression»
where the second arithmetic expression, rounded to an integer, has a
value in the range 0 to 12. A run-time error occurs if the integerized
value of the second arithmetic expression is less than 0 or greater than
12.
551
Expre's s ion s
Intrinsic Functions
<dscalerightt.function>
-- DSCALERIGHTT -- ( --<arithmet1ic expression >--:- , -.;..-----------'---- >
)-<arithmetic expression>-- )
--~----~-~-------------------~-------I
The DSCALERIGHTT function returns,a$
truncated result of
a
double-precision
value,
the
first <arithmetic E?xpression>/(IO ** second <arithmetic expression»
~lhere the second ari thmetic expression. rounded to an
integer, has a
value in the range 0 to -12. A run~~ime error occurs if the integerized
value of the second arithmetic expr~ssion is less than 0 or greater than
12.
<dsin function>
-- ~SIN ~- ( --<arithmetic expres~ion>-- ) --I
The DSIN function returns. as a double-precision value. the sine
angle of <arithmetic expression> radians:
of
an
<dsinh function>
-- DSINH -- ( --<arithmetic expression>-- ) --I
~he
DSINH function returns, as a dduble-precision value, the
Sine of the specified arithmetic expression.
hyperbolic
<dsqrt function>
-- DSQRT -- ( --<arithmetic expression>-- ) --I
The DSQRT function returns. as a double-precision value, the square root
of the specified arithmetiC ex~ression: The value of the arithmetiC
expression must be greater than or equal to zero.
552
Intrinsic Functions
ALGOL REFERENCE MANUAL
cdtan function>
-- DTAN -- ( --<arithmetic expression;--
-_.j
The DTAN function returns. as a double-precision value, the
<arithmetic expression> radians.
tangent
of
an angle of
:frunctJon)
-- DTANH -- ( --<arithmetic expression>-- ) --I
The DTANH function returns. as a double-precision value. the
tangent of the specified arithmetic expression.
hyperbolic
<entier function)
-- ENTlER -- ( --<arithmetic expression>--
The ENTlER function returns the largest integer
value of the arithmetic expression.
--I
not
greater
than
the
:is e c au sec i
t he II In ita t j on ~;
o:f
f - Ii j t e r e p yes en t ;i t 1 (} r:
:'1 .it- t mp tic .'
'"
function erroneously ren..:rns 7ero. r?lrhp . . . th;~; _.j, for r;1:~'
"'l"~
numbers of small magnitude.
For a sinEle-pre~islnn eXrr0~ in0
t
hreshold
is -0.5 * 8**-13
(apprcximarely -Q.09E-13).
This numbe v
correctly yields
~.
whereas thE
next
smalJer
(in
magnitude
single-precision number incorrectly yields zero.
For a double-precision
expression. the threshold can differ on various systems (because of
different algorithms for double-precision roundin2), but it ~s in the
vicinity of -2**-26 (approximately -3.31£-24).
r::NTIER
'rr,e ENTlER function returns an incorrect
:,>, ,-'.- ":
resu 1
negative integers less than or equa to-( ~F'* 3:'
function for an integer expression should be equal to the V~
expressior..
Howeve!-,
ENTIER(-6871 Cl 47b736)
returns
G
l)e
of
vG~;lle
th~
of
-6871947673/.
The ENTlER func~ion is not a simple truncation funcr~an GS
by the examples.
For a simple trunca-cion funcrion, see
function in this section.
;1
'lstrated
TNT1:;(JER'::'
553
Expressions
Intrinsic Functions
Examples
ENTIER(2.6) = 2
ENTIER(3.1) = 3
ENTIER(-O.Ol) = -1
ENTIER(-3.4) = -4
ENTIER(-1.8) = -2
<erf function>
-- ERF "--( --<arithmetic expressioin )-- ) --I
The ERF function returns, as a real value. the value of the standard
error function at the specified "arithmetic expression. For any valid N,
ERF(-N) = -ERF(N).
<erfc function>
--ERFC -- ( --<arithmetic expression>-- ) --I
The ERFC function returns, as areal value, the complement of the value
of the standard error function at the specified arithmetic expression.
For any valid N, ERFC(N) = 1 - ERF(N).
<exp function>
-- EXP -- ( --<arithmetic
expr~SSiOn)--
) --I
The EXP function returns. as a real value.
e ** <arithmetic expression>
where e is the base of the natural logarithms.
Intrinsic Functions
ALGOL REFERENCE MANUAL
XUIlction)
-- FIRST -- ( --<string expression>-- ) --I
The FIRST function returns, as a real value, the ordinal position in the
EBCDIC,
ASCII. or hexadecimal co1lating sequence of the first character
in the string expression.
This function returns an ordinal position in
the EBCDIC collating sequence if the string expression is EBCDIC. an
ordinal position in the ASCII collating sequence if the
string
expression is ASCII.
and an ordinal position in the hexadecimal
collating sequence if the string expression is hexadecimal.
A run-time
error occurs if the string expression is the null string.
I;;l(amples
FIRST("ABC It
)
193 (4"Cl")
FIRST(7"NNXX")
78 (4"4E")
FIRST(4 It FlF2")
15 (4"OF")
<firstone function>
-- FIRSTONE -- ( --<arithmetic
expressio~>--
) --I
The FIRSTONE function returns. as an integer value, the bit number plus
1 o£ the leftmost nonzero bit in the value of the arithmetic expression.
The FIRSTONE function returns zero if all the bits are zero.
If the
expression is double precision.
only the first word of its value is
examined.
<firstword function>
--- FIRSTWORD -- ( ------------------------------------------------->
>-<arithmetic expression>-------------------------- )
,
--------------1
1
1- , --<real variable>-I
See alsc
<real variable> . . . . . . . . . . . . . . . . . . . . . . . .
1±47
Intrinsic Functions
Expr~ssions
The FIRSTWORD function returns. as a real value, the first word of
~he
double-precision arithmetic expression.
The arithmetic expression is
first extended to double precision.: if necessary.
If the rea: variable
parameter
is specified,
the second word of
the doublE'-precision
arithmetic expression is stored in the variable.
<fix statement>
The FIX statement returns a Boolean value.
to tlFIX Statement."
For more information.
refer
<free statement>
The FREE statement returns a Boolean value.
to "FREE Statement."
For more information, refer
<gamma function>
-- GAMMA -- ( --<a.rithmetic expression>--
--j
The GAMMA function returns, as a f$al value.
the
function at the specified arithmetic expression.
value
of
the
gamma
<happened function>
-- HAPPENED -- ( --(event designator>-- ) --I
See also
<event designator>.
.
.
.
.
.
. .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
78
The HAPPENED function is a Boolean function that returns TRUE if
the
happened state of
the specified event is TRUE (happened) and returns
FALSE if the happened state is FALSE (not happened).
556
Intrinsic Functions
ALGOL REFERENCE MANUAL
<head function>
HEAD -- ( --<string expression>-- . --<string character set)---->
)- ) --------------------------------------------------------------1
<string character set>
--------------<string constant>----!
I
I I
I
1- NOT - j I-<truth set table>-I
See also
<string constant> . . . . . .
<tru th set table> . . . . .
523
382
The HEAD function returns a string whose value consists of the leftmost
characters of the string expression up to, but not including, the first
character that is not a member of the string character set.
If the
first character of the string expression is not a member of the string
character set, the null string is returned. If all characters of the
string expression are members of the string character set, the entire
string expression is returned.
The string character set must be of the same character type as the
string expression.
If a truth set table is used, it must not be
composed of characters of different Character types. "NOT" indicates a
string character set made up of all characters that are not specified in
the string constant or truth set table. but that are of the same
character type as the string expressior..
The HEAD function and the TAIL function are complementary functions.
This means that for any string expression S and any string character set
C, the following relation is always TRUE:
S
= HEAD(S,C)
CAT
TAIL(S.C)
See the TAIL function in this section.
557
Expressions
In the examples
8"ABC/1-2+3".
below,
S
is
a
Intrinsic Functions
string
of
length
9
that
contains
HEAD(S.NOT "/") = 8"ABC"
HEAD(S,ALPHA)
HEAD(S,"123")
8"ABC"
= the
null string
<imag function>
-- IMAG -- ( --<complex expresSion>-- ) --I
The IMAG function returns, as a real value. the imaginary
specified complex expression.
For a function that returns the re~l part of a complex
the REAL function in this section.:
part
of
the
expression.
see
<integer function>
The INTEGER function has two forms, each of
value.
-- INTEGER -This form
arithmetic
returns
whiCh
returns
an
integer
--<arithmetic expression>-- ) --I
of t he INTEGER ;funct i on ret urns the value of the
expression integerized with rounding. Specif ically. it
ENTIER«arithmetic expression>
+
0.5)
558
Intrinsic Functions
-- INTEGER -- (
ALGOL REFERENCE MANUAL
-----~----------------<pointer expression>-~
,
------~->
I
f-<update pOinter>-1
>-<arithmetic expression>-- )
-----------------------------------------1
See also
<update pointer> . . . . . . . . . . . . . . . . . . . . . . . . 379
This form of the INTEGER function returns, as an integer value. the
decimal value represented by the string of characters starting with
the character pointed to by the pointer expression.
The absolute
value of the integer value to be returned must be less than or equal
to 549755813887.
The arithmetic expression specifies the length of the string of
characters and must have a value, when rounded to an integer, less
than 24. If the rounded value of the arithmetic expression is 24 or
greater. the program is terminated with a fault. If the length is
zero. a result of zero is returned.
A zone field configuration of 1"1101" for 8-bit characters or 1"10"
for 6-bit characters in the least signif1cant character position
causes the result of the function to be negative.
With 4-bit
characters, a 1"1101" in the most significant character position
results in a negative value.
The state of the pointer expression when the count is exhausted
be preserved by using the <update pointer> construct.
can
<integert function>
-- INTEGERT -- ( --<arithmetic expression>-- ) --I
The INTEGERT function returns the value
integerized with truncation.
of
the
arithmetic
expression
The INTEGERT function does not necessarily return the same value as
ENTLER
function.
For
example.
INTEGERT(-1.2) = -1.
ENTIER(-1.2) = -2.
the
but
559
Intrinsic Functions
Expressions
<length function>
-- LENGTH -- ( --<string
exptession>-~
) --I
The LENGTH function returns, ~s an int~ger value, the number of
'characters in the string that results from evaluation of the string
expression. The null string has a length of zero.
<linenumber functioJO>
-- LINENUMBER --I
The LINENUMBER function returns, as an integer value,
number of the source file record on which it appears.
,
the
sequence
<linklibrary function>
-- LINKLIBRARY -- ( --<libraiy
See also
<library identifier> . . . .
identifier)-~
• .
• .' .
.
.
) --I
.
.
.
.
.
.
.
.
.
. 129
The LINKLIBRARY function determ~nes whether or not the program is
currently linked to or is capabl~ of being linked to the library program
specified by the library identifier. Results indicating a successful
linkage are returned by the LINKLIBRARY function if the program is
presently linked to the library or if the program ,is capable of being
linked, in which case the LINKLIBRARY function performs the linkage. If
the program cannot be linked to the library, the function returns a
result indicating the reason for the failure. In either case, the
program continues to execute: that is, use of the LINKLIBRARY function
prevents termination or suspension of a program upon an unsuccessful
attempt to link to a library.
During the linkage process, an attempt is made to link to every entry
point exported from the libiary who~e name matches an entry point
declared in the program. Only those names that match are checked for
correct function type, numbe~ of parameters, and parameter types.
Therefore. the LINKLIBRARY function does not check that every entry
point declared in the program i~ also exported from the library.
560
Intrinsic Functions
ALGOL REFERENCE MANUAL
The values·returned by the LINKLIBRARY function can
foilows:
Value
be
interpreted
as
Meaning
2
Successful linkage was made to the library, but not
points were provided.
all
entry
1
Successful linkage was made
points were provided.
all
entry
o
The program was already linked to the specified library at
time of the LINKLIBRARY call.
to
the
library.
and
the
-1
The library code file is missing.
-2
The family size of a process running in Swapper was exceeded on
the attempt to link to the library.
-3
A by-calling procedure specified more than one library task.
-4
The library is not a system library.
-5
The number or types of parameters provided by the
not correspond to those declared in the program.
library
do
-6
The library was terminated. canceled. or thawed before being
. frozen; therefore, the library was not successfully initiated.
-7
A circular chain of library linkages was detected.
A library
cannot reference itself. either directly or indirectly. through
a chain of library references.
-8
A by-calling procedure never specified a library task.
-9
A bad task was passed by a by-calling library procedure.
-10
A library feature that was used is not implemented.
-11
The library template contained an illegal provision type.
-12
The library template level is obsolete.
recompiled.
-13
The library directory level is incompatible with the
template level. The older program must be recompiled.
-14
The program cannot link to c system library.
-15
A task array for a by-calling library was not declared
library's stack.
This program
must
be
library
in
the
5bl
Expressions
Value
Intrinsic Functions
Meaning
-16
This program is not authorized t6 use this library procedure.
-17
The library is not visible to the program attempting to link to
the library.
<listlookup function>
,\~
0..0
~'
LISTLOOKUP -- ( --<arithmetic expression>-- . --<array row>-----)
~~..ft~ '1';fJ.~t
)- , --<arithmetic expresslon>-- ) --------------------------------1
See also
<array row> . . . . . . . . . .
43
The LISTLOOKUP function causes a linked list of words to be searched and
returns, as an integer value, an index into the list as follows:
1.
The array row is indexed. by the value of the second arithmetic
expression and the word is extracted. Each word contains a
value (in field [47:28J) and a link (in field [19:20J) to the
next word of the linked list.
2.
If the value in the extr~cted word is greater than or equal to
the value of the first arithmetic expression, the operation
stops, and the index of the word whose link points to the
extracted word is returried by the function.
3.
If the value in the extracted word is less than the value of
the first Glri thmetic expression.; the link of the extracted word
is used as an index into the array row, a new word is
extracted, and the process is repeated.
i
A word with a link of zero terminates the search. The value of a word
is tested only if the link field is nonzero. If the linked list is
exhausted (if a word with a link of zero is encountered), a value of -1
is returned by the LISTLOOKUP function.
562
Intrinsic Functions
ALGOL REFERENCE MANUAL
<In functi0n>
-- LN -- ( --<arithmetic expression>-- ) --I
The LN function returns, as a real value. the natural logarithm
specified arithmetic expression.
of
the
<lngamma function>
-- LNGAMMA -- ( --<arithmetic expression>--
--I
The LNGAMMA function returns. as a real value. the natural logarithm
the gamma function at the specified arithmetic expression.
Of
<log function>
-- LOG -- ( --<arithmetic expression>-- ) --I
The LOG function returns. as a real value, the base-10 logarithm of
specified arithmetic expression.
the
<masksearch function>
-- MASKSEARCH -- ( --<arithmetic expression>-- . ------------------>
>-<arithmetic expression>--
See a.l.so
<array row,' . . . . . . .
<subscripted variable> . .
------1
---<array row>-------------I
!-<subscripted variable>-I
•
43
• 225
The MASKSEARCH function performs the same operations as the ARRAYSEARCH
function, except that it is intended for use only with unpaged
(unsegmented) arrays.
563
Expressions
Intrinsic Functions
If the third parameter to the MASKSEARCH function is an array row or a
subscripted variable of a paged (segmented) array. then a warning
message is given at run time. ThRS warning message is given only the
first time the statement containing the MASKSEARCH function is executed.
If the third parameter is an array row of a paged
the MASKSEARCH function causes a fault.
array,
execution
of
If the third parameter is a subscripted variable of a paged array, then
no fault is generated at run time, but the results can be unexpected.
The MASKSEARCH function searches pnly the 256-word segment containing
the specified array element. If the target value is found in that array
segment, the in~~l.qli.Y~_.to tlle beginning of the segmen,t is returned.
If the target is not found in that segment, -1 is returned.
<max function>
i < ----------- , :---------- I
I
I
-- MAX -- ( ---<arithmetic expression>--- ) --I
The MAX function returns. as a re,al value, the maximum of the values
all the specified arith~etic expressions.
of
<messagesearcher statement>
The MESSAGESEARCHER statement returns an integer
information, refer to "MESSAGESEARCHER Statement."
value.
For
more
<min function>
1(----------- .
-- MIN --
---<arithmetic
-~~-------i
e~pression>---
--!
The MIN function returns. as a r~al value, the minimum of the values
all the specified arithmetic exp~essions.
of
564
Intrins~c
Functions
ALGOL REFERENCE
MANUA~
<nabs function>
-- NABS -- ( --<arithmetic expression>-- ) --I
The NABS function returns. as a real value, the negative of the absolute
value of the specified arithmetic expression.
<normalize function>
-- NORMALIZE -- ( --<arithmetic expression>-- ) --I
The NORMALIZE function returns, as a real value, the value of the
arithmetic expression, normalized and rounded to a single-precision
operand. (For more information on normaljzed format, refer to "Real
Operand" in the appendix "Data Representation.")
See also
Real Operand. . . . . . . . . . . . . . . . . . . . . . . . . . 820
<offset function>
-- OFFSET -- ( --<pointer expression>-- ) --I
The OFFSET function returns, as an integer value. the number of
character£ between the character position referenced by the pointer
expression and the beginning of the array row. not including the
character at which the pointer expression is pointing. The function
value is in terms of the character size of the pointer expression.
If
it is a word pointer. the offset is given in terms of 8-bit characters.
If the pointer expression points to a paged (segmented) array, the
OFFSET function returns the total offset from the beginning of the first
segment of the row.
For a function that returns the number of characters between the
character position referenced by a pointer expression and the end of the
array row. see the REMAININGCHARS function in this se~tion.
56 :,;
Intrinsic
Expressions
((;fH::S
f unct jon)
-- ONES -- ( --<arithmetic
ir.(2
Func~iont
e~pression>--
) --I
function returns, as an iinteger value. the number of nonzero
the value of the a~ithmetic expression.
If the arithmetic
10~ ls double precision. all 96 bits of its value are examined.
ONES
in
:'
e~:r
··,:-pm:·n
If-or,urns an
:::; ta tprnen t ...
initeger
value.
For
more
information.
:'nter functlon>
POINTER -- ( ---<array
-, <
';
-< _ _ ,
__ ,
_ _ _ _ _ _ _ _. _ _ _ _ _ _ _ _ _ _ ,
row>-------~-----------------------------,
variable>-I
ub~:;;criptled
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ,__
)
___________________________________
---<character 5ize>--I;
!-<pointer primary>-j
'-character size>
CJ -----
1--
4
i
-
1- c, ! -- 7
!-
8 --
i
See also
<array row> .
<pointer primary>
<subser ipted var iable). .
43
. 519
. 225
i
566
Intrinsic Functions
ALGOL REFERENCE MANUAL
The POINTER function generates a pointer to the specified location.
If the first parameter is an array row, the pointer references the first
character of the first word of the specified array row. If the first
parameter is a subscripted variable. the pointer references the first
character of the array element specified by the subscripted variable.
If the Becond parameter is not given, the character size of the pointer
is six or eight bits depending on the default character type. (For
more information on the default character type, refer to "Default
Character Type" in the appendix "Data Representation.")
t
If the second parameter is a character size of 4. 6. or 8, the character
size of the pointer being generated is four bits. six bits, or eight
bits. respectively. If the second parameter is a character size of 7,
the character si~e of the pointer is eight bits.
If the second
parameter is a character size of 0, the pointer is word-oriented. rathei
than character-oriented: it is single precision if the array it points
to is single precision (INTEGER. REAL, or BOOLEAN) and double precision
if the array is double precision (DOUBLE or COMPLEX).
If a pointer primary is given as the
size of that pointer primary is
pointer being generated.
second parameter. the character
used for the character size of the
See also
Default Character Type. . . . . . . . . . . . . . . . . . . . . 817
NOTE
The BeL data type is not supported on all
A Series and B 5000/B 6000/B 7000 Series
systems.
The appearance
of
a
BCL
construct that may cause the creation of
a BCL descriptor. such as
a
6-bit
pointer. wi~l cause the program to get a
compile-time warning message.
Expressions
567
Intrinsic Functions
Examples
BEGIN
ARRAY Al,A2[O:9];
POINTER Pl,P2,P3,P4,P5;
Pl .- POINTER(Al);
P2 .- POINTER(Al[9]);
P3 .- POINTER(Al,4);
P4 .- POINTER(A2[6].P3);
$ SET BCL
P5 .- POINTER(Al):
END.
% LAST STATEMENT
Execution of this program has the following results:
Pl
This pointer has a character size of eight bits (the default
character type is EBCDI~ when pi is assigned) and points to the
first 8-bit character of the first element of array Al.
P2
This pointE~r has a character siie of eight bits and
the first 8-bit character of element 9 of array Al.
points
to
P3
This pointE~r has a character size of four bits and points
the first I~-bi t character of the first element of array Al.
to
P4
This pointE~r has a character size of four bits and
the first ,~-"-bit charact~r of element 6 of array A2.
to
P5
This pointer has a character size of six bits (when P5 is
assigned, the default Oharacter type is BeL) and points to the
first 6-bit character of the first element of array Al.
points
568
Intrinsic Functions
ALGOL REFERENCE MANUAL
<pot function>
POTL
[ --<arithmetic expression>-- ] --I
1
1- POTe -i
1
1
1- POTH -I
The POT (Power of Ten) functions. POTL (low), POTC
(high), together provide the value
(center),
and
POTH
10 ** <arithmetic expression>
from three tables that are double-precision, read-only arrays. Each of
the POT functions is defined only for integerized values of the
arithmetic expression falling in the range 0 through 29604.
The
complete value of 10 ** <arithmetic expression> can be computed using
the following arithmetic expression:
POTL[<arithmetic expression>.[5:6]J
* POTC[<arithmetic expression>.[11:6]]
* POTH[<arithmetic expression>.[14:3]J
Examples
.RESULT := POTL[XJ; % WHERE X < 64
DEFINE P6T(T) = (POTL[T.[5.6]J * POTC[T.[11:6]J * POTH[T.[14:3JJ)#:
ONEDIVTENTOI .- 1 / POT(I);
<processid function>
-- PROCESSID --I
The PROCESSID function returns a positive integer
identifies the process executing the function.
Value
that
uniquely
The PROCESSID function returns a value that remains unique to that
process for the duration of its execution. However, the value is not
guaranteed to be the same on every invocation of the PROCESSID function.
For example, upon restarting from a checkpoint, the value of the
PROCESSID function can have changed. Also. after a process terminates,
its PROCESSID value can be assigned to a new process.
569
Intrinsic Functions
Expressions
<random function>
-- RANDOM -- ( ---<arithmetic :variable>-- ) --I
See also
<arithmetic varjLable> . . . . . . . . . . . . . . . . . . . . • 225
The RANDOM function returns, as a real va:lue. a random number that is
greater than or equal to 0 and less than 1. The arithmetic variable is
a call--by-name parameter, and its value is changed each time the
function is referenced. A compile-time or run-time error occurs if the
parameter is not a single-precision arithmetic variable.
<read statement>
The READ statement returns a Boolean value.
to "READ Statement."
For more information. refer
<readlock function>
Taking oaly one memory cycle, the READLOCK function stores the value of
the specified expression in ~he designated variable and returns the
previous contents of the variable.
The READLOCK function has three forms. One form returns a real value.
one form returns a Boolean value, and one form returns a pointer.
READLOCK -- ( --<arithmetic
>-
~xpression)--
• --<arithmetic variable>->
---------~----------------~~-------~------------------------------1
See also
<arithmetic variable> . . . . . . . . . . . . . . . . . . . . . 225
This form of the READLOCK function stores the value of the
arithmetic expression in the arithmetic variable and returns the
previous contents of the variable as a real value.
Both the
variable and the expression must be single precision.
570
Intrinsic Functions
-~
ALGOL REFERENCE MANUAL
READLOCK -- ( --<Boolean expression>-- , --<Boolean variab1e>-- ) --1
See also
<Boolean variable> . . . . . . . . . . . . . . . . . . . . . . . 234
This form of the READLOCK function stores the value of the Boolean
expression in the Boolean variable and returns the previous contents
of the variable as a Boolean v~lue.
-- READLOCK -- (
--<point~r
expression>-- . --<pointer variab1e>-- )
See also
<pointer variable> . . . . . . . . . . . . . . . . . . . . . . . 241
This form of the READ LOCK function stores the value of the pointer
expression i~ the pointer variable and returns the previous contents
of the variable as a pointer value.
<real function>
The REAL function has four forms. each of which returns a real value.
-- REAL -- ( --<arithmetic expression>-- ) --I
This form of the REAL function returns the value of the
expression rounded to a single-precision, real value.
~-
REAL --
(-~<Boolean
arithmetic
expression>-- ) --I
This form of the REAL function returns the value of the Boolean
expression as a real value. All bits of the Boolean expression are
used.
571
Expressions
~-
REAL -- {
~-<cornplex
Intrinsic Functions
expressi6n>-- )--1
This form of .the REAL function return~. as a real
part of the specified complex express'ion .
value,
. For a function that returris the imaginary part
expression, see the IMAG function in this section.
of
the
a
real
complex
-- REAL -- ( --<pointer expression>-- , --<arithmetic expression>-- ) -I
This form of thE: REAL function returns. as a real value, the string
of <arithmetic expression> characters starting with the character
indicated by the pointer expression.
If the arithmetic expr~ssion ;indicat~s a string of characters that
is
less
than
or
equal to 48 bits long, this string is
right-justified in one word with leading zeros, if necessary, and
this word is returned as the function result. If the arithmetic
expression indicates a Strin~ of characters more than 48 bits long
but
less
than
or equal to 96 bits long, this string is
right-justified with leading zeros. if necessary, in a two-word
operand. and then only the first word is ret~rned as the function
result.
If the arithmetic expression indicates a string
of
chara6ters more than 96 bits long. a run-time error occurs.
<rema1n1ngchars
fun'~t1on>
-- REMAININGCHA1RS -- ( --<pointer expression >-- ) --I
The REMAININGCHARS function returns, as an integer value, the number of
. characters between the character position referenced by the pointer
expression and the end of the array row, including the character at
which the pointer expression is pointing. The returned value is in
terms of the character size of the pointer expression. If it is a word
pointer~
the value returned 1s in terms of 8-bit characters. If the
pointer expiession points to
a
paged
(segmented)
array,
the
REMAININGCHARS function gives the number of characters left in the
entire array row.
For a function that returns the number of characters between the
character position referenced by a pointer expression and the beginning
of the array row. see the OFFSET function in this section.
?
5
"7~
I
L
ALGOL REFERENCE MANUAL
Intrinsic Functions
<removefile statement>
The REMOVEFILE statement returns a Boolean value.
refer to "REMOVEFILE Statement."
For more information,
<repeat function>
REPEAT -- ( --<string expression>-- , --<arithmetic expression>->
>-
______________________________________________________ --------1
I
The REPEAT function returns a string according to the following rules:
1.
~,
If:. •
3.
If <arithmetic expression>
function is the null string.
0,
the
result
of
the
REPEAT
If <arithmetic expression> > O. the result of the REPEAT
function is the same as if <arithmetic expression> occurrences
of the value of the string expression were all concatenated
together.
If <arithmetic expression> < O. the result of the
function is either a compile-time or a run-time error.
The value of the arithmetic expression is rounded
necessary. before it is used as the repeat count.
to
an
REPEAT
integer,
if
Examples
REPEAT("ABC",3) = "ABCABCABC"
REPEAT(ItWON'T WORK".O)
=
the null string
<scaleleft function>
-- SCALELEFT -- ( --<arithmetic expression>-- . -------------------)
>-<arithmetic expression>-- )
-------------------------------------1
573
Expressions
Intrinsic Functions
The SCALELEFT function returns. as an integer value,
first <arithmetic expression>*(10 ** second <arithmetic expression»
where the second arithmetic expression. rounded to an integer, has a
value in the range 0 ~o 12. The SCALELEFT function is undefined when
the integerized value of the second arithmetic expression is less than 0
or greater than 12.
<scaleright function>
-- SCALERIGHT -- ( --<arithmetic expression>-- , ------------------)
>-<arithmetic expression>-.:- )
-------------------------------------1
The SCALERIGHT function returns,as an integer value, the rounded result
of
first <arithmetjLc
expression~/(lO
** second <arithmetic expression»
where the second arithmetic expr~ssion, rounded to an integer, has a
value in the range 0 to 12. A run-time error occurs if the integerized
value of the second arithmetic expreSsion is less than 0 or greater than
12.
<scalerightf function>
-- SCALERIGHTF ._- ( --<arithmetic expression>-- , -----------------)
>-<arithmetic expressiori>--)
-----~--------~----------------------I
The SCALERIGHTF function returns~ as a real value,
packed decimal (4-bit decimal) number representing
a
left-justified.
first <arithmetic expression> MOD (10 ** second <arithmetic expression»
where the second arithmetic expression, rounded to an integer, has a
value in the range 0 to 12. A run-time error occurs if the integerized
value of the second arithmetic ekptession is less than 0 or greater than
12.
The number of significant digits returned by the function is equal to
the 1ntegerized value of the second arithmetic expression. The external
sign flip-flop (EXTF) is set to reflect the sign of the first arithmetic
574
Intrinsic Functions
expression· for
declaration.
use
ALGOL REFERENCE MANUAL
with
the
editing
phrases specified in a PICTURE
Examples
SCALERIGHTF(1234,4) = 4"12340000000C"
SCALERIGHTF(12345678.l2)
=
4"000012345678"
<scalerightt function>
-- SCALERIGHTT -- ( --<arithmetic expression>-- ,
>-<arithmetic expression>-- )
----~---~-----~-->
-------------------------------------1
The SCALERIGHTT function returns. as an
result of
integer
value,
the
truncated
first <arithmetic expression>/(lO ** second <arithmetic expression»
where the second arithmetic expression, rounded to an integer, has a
value in the range 0 to 12. A run-time error occurs if the integerized
value of the second arithmetic expression is less than 0 or greater than
12.
<secondword function>
-- SECONDWORD -- ( --<arithmetic expression>-- ) --I
The SECONDWORD function returns, as a real value, the second word of the
The arithmetic expression is
double-precision arithmetic expressior..
first extended to double precision. if necessary_
For a function that returns the first word of a double-precision
arithmetic expression. see the FIRSTWORD function in this section.
575
Expressions
Intrinsic Functions
<seek. statement>
The SEEK statement returns a Boolean value.
to "SEEK Statement."
For more information. refer
<setactualname fUnction>
-~
SETACTUALNAME -- (
~-<library
entry point identifier>-- . ------)
>-<pointer expression>-- ) ---~--~---------------------------------I
<library entry point identifier>
A <pr06edure identifier>
specification>.
declared
with
See also
<library entry point specification> .
<procedure identifier> . . . . ~ . . . .
a
<library
entry
point
. 169
. 165
The SETACTUALNAME function determines whether or not the ACTUALNAME of
the library entry point specified by the library entry point identifier
can be changed to the name pointed'to by the pointer expression.
The
function then makes the change, if it is possible. Results of a
successful change are returned upon completing the ACTUALNAME change;
otherwise. results indicating the reason for failure are returned.
The ACTUALNAME of an entry p01rit of a link~d libtary cannot be modified.
Therefore. a linked library mu~t be delinked before calling the
SETACTUALNAME function to change the ACTUALNAME of any of its entry
points.
The function can be called to modify an entry point of a
library th~thas not yet been linked.
Starting with the first character pointed to by the pointer expression.
characters are included as the new entry point name until either a
period is encountered. the maximum allowable number of characters is
included. or the end of the array row is encountered. The last case
results in an error condition.
576
Intrinsic Functions
ALGOL REFERENCE MANUAL
The SETACTUALNAME function returns the following integer values:
Value
Meaning
1
A successful change was made to the
point.
o
The new ACTUALNAME is the same as the current ACTUALNAME of the
entry point.
-1
The library is linked. The library must be del inked before the
SETACTUALNAME function is called.
-2
The library entry point identifier
accessibLe library template.
-3
A parameter error occurred in the SETACTUALNAME function.
ACTUALNAME
is.
not
of
the
currently
entry
in
an
Example
REPLACE NEWEPNAME BY "ENTRYPOINT2.";
SETACTUALNAME(EP2,NEWEPNAME);
Changes the ACTUALNAME of
"ENTRYPOINT2", if possible.
the
library
entry
point
EP2
to
<sign function>
-- SIGN -- ( --<arithmetic expression>--
--I
The SIGN function returns an integer 1 if the value of the arithmetic
expression is greater than zero. an integer 0 if the value of the
arithmetic expression is equal to zero. and an integer -1 if the value
of the arithmetic expression is less than zero.
577
Expressions
Intrinsic Functions
<sin function>
-- SIN -- ( --<arithmetic
expr~ssion>--
The SIN function returns, as a real value,
<arithmetic expression> radians.
) --I
the
sine
of
an
angle
of
<single function>
-- SINGLE -- ( --<arithmetic expression>-- ) --I
The SINGLE function returns, as a real value, the value of
arithmetic expression normalized and truncated to single precision.
the
<sinh function>
-- SINH -- ( --<arithmetic
expression)~-
) --I
The SINH function returns. as a real value, the hyperbolic sine
specified arithmetic expression.
of
the
<size function>
-- SIZE -- ( ---<array designator>----1
!
I-<pointer identifier>-I
See also
<array designator> . .
<pointer identifier>.
--I
.
43
. 160
The "SIZE«array designator»" form of the SIZE function returns. as an
integer value. the size of one dimension of the specified array in
elements. If the array designator is an array name. the SIZE function
returns the size of the first dimension of the specified array. If the
array designator contains a subarray selector. the SIZE function returns
the size of the dimension that corresponds to the first asterisk (*)
subscript.
578
Intrinsic Functions
ALGOL REFERENCE MANUAL
The "SIZE«pointer identifier»" form of the SIZE function returns~ as
an integer value, the character size of the specified pointer. If the
character size of the pointer is four, six, or, eight bits. the value
returned is 4, 6, or 8, respettively. If the pointer 1s word-oriented,
the value returned is 0 or 2. depending on whether the pointer is single
precision
or double precision, respectively.
If the pointer is
uninitialized. the SIZE function returns zero. See the P01NTER function
in this section for a discussion of character size.
<space statement>
The SPACE statement returns a
refer to "SPACE Statement."
Boolean
value.
For
more
information.
<sqrt function>
--SQRT -- ( --<arithmetic
expression>-~
) --I
The SQRT function returns. as a real value, the square root of the
arithmetic expression.
The value of the arithmetic expression must be
greater than or equal to zero.
<string function>
------------------------------------------------>
>---<pointer expression>-- , --<arithmetic expression>------- ) ---I
1
I
I-<arithmetic expression)-- , ---<arithmetic expression>-I
I
1-
*
---------------------1
The STRING function returns a String value.
The function STRING4
returns a hexadecimal string. the function STRING7 returns an ASCII
string. and the function STRING8 returns an EBCDIC string. The function
STRING returns a string of the default character type. (For more
579
Expressions
Intrinsic Functions
information on the default character type, see "Default Character
in the appendix "Data Representation.")
Type"
See also
Default Character Type. . . . . • . . . . . . . . . . . . . • . 817
If the first parameter to the STRING function is a pointer expression,
the STRING functionc:onverts the string of characters pointed to by the
pointer expression into a string. The number 6f characters converted is
given by the value of the arithmetic expression, rounded to an integer,
if necessary. If thi~ rounded value is less than zero, a compile-time
or run-time error occurs. If the rounded value is zero, the null string
is returned.
If the first parameter to the STRING function is an arithmetic
expression ',the STRING function returns a string consisting of a decimal
representation of the value of that arithmetic expression.
If the
second parameter is also an arithmetic expression, then the value of
this expression. rounded to an integer, specifies the length of the
resulting string.
If this value is less than zero. a compile-time or
run-time ,error occurs. If this value is e~ual to zero, the null string
is returned. If the second parameter is an asterisk (*), the resulting
string is exactly long enough to r$presentthe value of the arithmetic
expression with no blanks.
If the value of the first arithmetic
expression is zero and the second parameter is an asterisk, the
resulting string is one character long,.
When the STRING function is to ret:urn an ASCII or EBCDIC string and the
first parameter is an arithmetic expression, its value is converted into
the most efficient form. depending on the length specified by the second
parameter.
If both parameters are arithmetic expressions and the
rounded value of the second parameter is greater than the minimum number
of characters needed to represent the first parameter, leading blanks
are inserted in the'resulting string. If both parameters are arithmetic
expressions arid the rounded valrie of the second parameter is less than
the, number of characters needed to represent the first parameter, then a
string of all asteriSiks, is, returned.
For the function STRING4. when the first parameter is an arithmetic
expression. only the integer portion Of, the value of this expression is
converted. If both parameters to STRING4 are arithmetic expressions and
the rounded value N of the second parameter is less than the number of
characters needed to represent the first parameter, then the rightmost N
digits of the converted value of the first parameter are returned. If
both parameters to STRING4are arithmetic expressions and the rounded
value of the second parameter is greater than the number of characters
needed to represent the converted value of the first para'meter. then
leading zeros are inserted into th$ resulting string.
580
Intrinsic Functions
ALGOL REFERENCE MANUAL
Examples
STRING(P.20)
STRING(POINTER(A),N-3)
STRING(256,*)
= 8"256"
STRING(-335.25.8) = 8" -335.25"
STRING(4.78@-2,5) = 8".0478"
STRING(555000,1} = 8"*"
STRING(45b.789,7) = 8"456.789"
STRING4(123.45b.8) = 4"00000123"
STRING4(12345678.4) = 4"5678"
<tail function>
TAIL -- ( --<string expression>-- , --<string character set>---->
)- ) --------------------------------------------------------------1
See also
<string character set> . . . . . . . . . . . . . . . . . . . . . 556
The TAIL function returns a string whose value consists of the rightmost
characters of the string expression beginning with the first character
that is not a member of the string character set. If all characters in
the string expression are members of the string character set, the null
string is returned. If the first character of the string expression is
not a member of the string character set. the entire string expression
is returned.
The string character set must be of the same character type as the
string expression. For an explanation of the string character set. see
the HEAD function in this section.
581
Intrinsic Functions
Expressions
The TAIL function and the HEAD function are complementary functions.
This means that for any string expression S and any string character set
C, the following relation is alway~ TRUE:
S
= HEAD(S,C) CA1 TAIL(S,C)
See the HEAD function in this
sect~on.
Examples
In the examples
below,
S
is
a· string
of
length
9
that
contains
8t1ABC/1-2+3u~
TAIL(S.NOT
It_tl)
= 81t:-2+3"
TAIL(DROP(S.7),"+-") = 8"3 1t
<take function>
•
TAKE -0- ( --(string expression>-- , --<arithmetic expression>--->
)- ) --------------------------------------------------------------1
The TAKE function returns a string whose value is equal to the first
<arithmetic expression> characters taken from the value of the string
expression. The value of the arithmetic expression is rounded to an
integer. if necessary.
An error occurs if the rounded value of the
arithmetic expression is greater than the number of characters in the
string expression or less than zero.
If the rounded value of the
arithmetic expression is zero, the result is the null string.
If the
rounded value of the arithmetic expression is equal to the length of the
string expression. the result is the same as the value of the string
expression.
The TAKE function and the DROP function are complementary functions.
This means that for any string expression S and any arithmetic
expression A in the range 0 ( = A <:LENGTH(S). the following relation is
always true:
S = TAKE(S.A) CAT DROP(S.A)
See the DROP function in this section.
582
Intrinsic Functions
ALGOL REFERENCE MANUAL
Examples
In the examples
8"ABCDEF".
below,
string
S
has
a
length
of
6
and
contains
TAKE(S,2) - 8"AB"
TAKE(S,4)
= 8"ABCD"
TAKE(DROP(S,2),2) = 8"CD"
<tan function>
-- TAN -- ( --<arithmetic expression>-- ) --I
The TAN function returns, as a real value, the tangent of
<arithmetic expression> radians.
an
angle
of
tangent
of
(tanh function>
-- TANH -- ( --<arithmetic expression>-- ) --I
The TANH function returns, as a real value, the
the specified arithmetic expression.
hyperbolic
<time function>
-- TIME --
--<arithmetic expression>-- ) --I
The TIME function makes various system time values available. The value
of the arithmetic expression is rounded to an integer, if necessary.
before being used. The results returned for different values of the
integerized arithmetic expression are given in the following table. If
the integerized value of the arithmetic expression is not one of the
values listed in the table. the TIME function returns the value zero.
583
Intrinsic Functions
Expressions
Parameter
Result Returned
o
T1ME(0) returns the curren~ date in BCL characters in the
format 6"YYDDD" , where YY is the year and DDD is the day of the
year.
1
TIME(l) returns the time of day, irt sixtieths of a
an integer Value.
second.
as
2
TIME(2) returns the elapsed proces~or time of the
sixtieths of a second. as an integer value.
program,
in
3
TIME(3) returns the elapsed I/O time of
sixtieths of a second. as an integer value.
program.
in
4
TIME(4) returns the value of a
times per second.
increments
60
5
TIME(5) returns the month~ day, and year as six BCL characters,
right-justified, in the format 6"OOMMDDYY".
6~bjt
TIME( 6) returns a ul,ique number for
timestamp) in the following form:
the
clock that
the
time
and
date
(a
o & (JULIANDATE-70000) [47:16J & (TIME(11) DIV 16) [31:32J
7
TIME(7) returns the current date
form:
[47 :12 ]
[35:06J
[29:06J
[23:06J
[17:06J
[11:06J
[05:06J
and
time
in
the
fOllowing
Year (1900-1999)
Month (1-12)
Day (1-31)
Hour (0-23)
Minute (0-59)
Second (0-59)
Day of the week
(0 = Sunday. 1 ~ Monday •...• 6 = Saturday)
9
TIME(9) returns the current time in EBCDIC characters in the
format 8"HH11MSS". where HH is the hour. MM is the minute, and
55 is the second.
10
TIME(lO) ret.urns the same value as TIME( 0) • except that the
time is expressed in EBCDIC characters in the format 8"YYDDD" .
11
TIME(11) returns the same value as TIME( 1 ) , except
time is expressed in multiples of 2.4 microseconds.
that
the
12
TIME(12) returns the same value as TIME( 2) • except
time is expressed in multiples of 2.4 microseconds.
that
the
584
Intrinsic Functions
Parameter
ALGOL REFERENCE MANUAL
Result Returned
13
TIME(13) returns the same value as TIME( 3) . except
time is expressed in multiples of 2.4 microseconds.
14
TIME(14) returns the time elapsed since the last
multiples of 2.4 microseconds.
15
TIME(lS) returns the current date in EBCDIC characters
format 8"MMDDYY" .
16
TIME(16) returns the same value as TIME(6).
23
TIME(23) returns the system identification information
following format:
[31:08]
[23:16]
[07:08]
24
that
Halt/Load
the
in
in
the
in
the
ASD System flag.
o - Non-ASD system
1 - Non-ASD system
2 - ASD system
System serial number.
Type of machine DIV 100
(for example, 68 means B 6800).
If the system type is not of the form
B XXOO. this field contains zero.
TIME(24) returns the system type as a real value containing six
EBCDIC characters. The name is left-justified with blank fill.
For example, on a B 5920 or B 5930 system. TIME(24) returns
8"BS900 "
<translate function>
TRANSLATE -- ( --<string expression>-- , --<translate table>----)
)- )
------------------------------------------~-------------------1
See also
<translate table> . . . . . . . . . . . . . . . . . . . . . .
~
382
The result of the TRANSLATE function is a string of the same length as
the string expression with each character Of the string expression
translated according to the translate table.
585
Expressions
Intrinsic Functions
The translate table used in the TRANSLATE function must not be composed
of items of differEmt character types. The translate table can be a
translate table identtfier declared in t:he program or one of the
The use tif a subscripted variable as a
intrinsic translate tables.
translate table is not allowed in the TRANSLATE function.
;Examples
TRANSLATE(S,HEXTOEBCDIC)
'TRANSLATE ( TAKE ( s, 10) ,~!YTT)
<value function>
VALUE --
---<mnemonic file attribute value>------------------->
I-<arithmetic-valued file attribute name>------I
I
I
I-<Boolean-valued file attribute name>---------I
I
I~(pointer-valued
I
file attribute name>---------I
I
I
I-<translate-table-valued file attribute name>-I
)- ) -------------------------~------------------------------------1
See also
<arithmetic-valued fileattrib\1te;> name> .
<Boolean-valued ·file attribute 'name>.
<mnemonic file attribute value> . . . . .
. ...
<po~nter-valued file attribute name> . . . . . . .
<translate-table-valued file attribute name) . . .
86
86
86
86
86
If ~ mnemonic file attribute value is specified, the VALUE function
returns the integer value that corresponds to that mnemonic file
attribute value. If ct file attribute name is specified, the VALUE
function returns the attribute number that corresponds to that attribute
name. For more information on file attribute names and mnemonic file
attribute values, refer to the "I/O Subsystem Reference Manual."
58b
Intrinsic Functions
ALGOL REFERENCE MANUAL
Examples
F.KIND := VALUE(DISK)
F.INTMODE := VALUE(EBCDIC)
<wait statement)
Depending on the form used, the WAIT statement returns no value, a
Boolean value, or an· integer value. For more information, refer to
"WAIT Statement."
<waitandreset statement>
The WAITANDRESET statement returns an integer
information. refer to "WAITANDRESET Statement."
value.
For
more
<write statement>
WRITE statement returns a
refer to "WRITE Statement."
Th~
Boolean
value.
For
more
information,
587
1
COXPtLIBGPRQGRAlS
This chapter pres~ntsinformation outside of the ALGOL language.
This
information is necessary to compile and run an ALGOL program. The
c'hapter describes the files used by the ALGOL compiler when it compiles
a program, the format ofa source record. and compiler control options.
7.1
FILES USED
m: TIm
COMPILER
When the ALGOL compiler compiles a prqgram. it requires, at minimum. one
input file that contains the source code to be compiled. If the compile
is $uccessful,the compiler produces, at minimum, one output file that
.contains executable object code.
Through the use of compiler control options, the compiler can be
directed to use additional input files and to produce additional output
files. Among the optional input file!s that can be used are files
containing source code that is to be merged or inserted into the
required source code file. and files c:ontaining information needed to
perform separate compilation and binding. Among the optional output
files that can be produced are a printer listing of the program, a
cross-reference file, an updated source file, an error message file, and
a file containing information needed for future separate compilation.
Table 7~1 .lists the logical input and output files used by the ALGOL
compiler.
Each file is listed wtth values for the INTNAME, KIND,
INTMODE. MAXRECSIZE. BLOCKSIZE, and FI:LETYPE attributes. Some or all of
the attributes for these files can be changed. using c0mpiler file
equation, when the compiler is initiated. (For more information, refer
to the "I/O Subsystem Reference Manual~ and the ~Work Flow Language
(WFL) Reference Manual" for detailed tnformation about file attributes
and compiler file equation, respectively.)
588
ALGOL REFERENCE MANUAL
Table 7-1.
Compiler Files
Compiler Input Files
Deacriptia\
DmW4E
Pft.n.1ARY mPUl' Fn.E
CARD
In:Lt1atic:n
mID
'rIFt
:READER
CANOE
OPl'IONAL SmlNDARY
INPtJl' FILE
TAPE
OPl'IONAL OOURCE FILES
INPtJ1' BY $ IN:l.UDE
COMPILER CONTROL
OPTIONS
CDC,UDE:i
files)
INPUT
OPl'IONAL DG'O Fn.E
'rIFt ani
lN1MlDE
EBCDIC
DISK
DISK
EBCDIC
WFL ani
CANOE
DISK
EBCDIC
HlST
WFL ani
CANOE
DISK
DG'O
WFL ani
CANOE
DISK
OPl'IONAL OBJB::T FlLE
CANOE
M\X1GrSIZE
1l1.OCICSIZE
Ta.ken from
Taken from
JTlyslcal fUe
r::nystcal fUe
Taken from
Taken £rom
JTlysical rue
JTtystcal tUe
FILE'IYPE
8
8
Taken fram
Taken fram
JTlysical rue
r::nystcal tUe
SINGLE
30 words
2.70
Taken from
Taken from
SINGLE
JTlysical rue
r::nys1cal tUe
0
~
8
8
Compiler Output Files
OBJECT cxm: FILE
~{
EXECtTl'ION
CODE
W'FL ani
CANDE
DISK
SINGLE
30~
2.70 words
-
NlNTAPE
VFL ani
CANOE
DISK
EBCDIC
1.5 words
4:20 words
-
OPl'IONAL
LmB PR1NTER LISTDC
LINE
VFL ani
CANDE
PJU:NTER
EBCDIC
2.2. words
2.2. words
-
OPl'IONAL
ERROR MESSIGE PnE
ERRORFILE
'rIFt
P.RlNTER
EBCDIC
12 words
12 words
CANOE
:R.EM:>'l'E
OPTIONAL
CROSS REF.EREN::!E FILE
XREF.FILE
WFL ani
CANDE
DISK
EBCDIC
510 words
510 words
0
OPTIONAL INFO PILE
INFO
VFL ani
CANOE
DISK
SINGLE
2.5S words
2.560 words
0
OPl'IONAL UPDATlID
~ICFILE
Compiling Programs
The input files used by the compiler consist of the following:
CARD, which is the required source code file
TAPE, which is a source code file that can be merged with CARD
INCLUDE files. which are source code files that can
into CARD or TAPE
HOST, which contains information used
and binding
for
separate
be
inserted
compilation
INFO, which contains information used for separate compilation
The EXTMODR attribute (the character type of the physical file) of these
input files can be EBCDIC, ASCII~ or BCL. The MAXRECSIZE attribute of
these input files must be large enough to accommodate at least 72
characters.
BeCaUSE? the values of the MAXRECSIZE and BLOCKSIZE
attributes for these files are taken from the physical file (when
FILETYPE = 8), these two attributes do not require explicit assignment.
The CARD file supplies the primary source input to the compiler and must
be present for each compilation. If the compiler is initiated from the
Work Flow Language (WFL) and compiler file equation is not applied to
the CARD file. the file is assumed to be a card reader file. If the
compiler is initiated through CANDE and compiler file equation is not
applied to the CARD file, the file is assumed to be a disk file.
The TAPE file supplies secondary source input to the compiler.
Its
presence is optjona1. If compiler file equation is not applied to the
TAPE file, the file is assumed to be a disk file regardless of whether
the compiler is initiated from WFL or CANDE.
When this file is present and the MERGE option is TRUE. records from the
TAPE file are merged with those of the CARD file on the basis of
sequence numbers. If a record from the CARD file and a record from the
TAPE file have the same sequence number. the record from the CARD file
is compiled and the TAPE record is ignored. For more information on the
MERGE option. see n<ItiE?rge option>" in this chapter.
590
ALGOL REFERENCE MANUAL
INCLUDE Files
INCLUDE files provide source input to the compiler in addition to that
supplied by the CARD and TAPE files. An INCLUDE file is used only if an
INCLUDE compiler control option appears in the source input being
compiled.
For more information on the INCLUDE option. see "<include
option>" in this chapter.
The HOST file provides the compiler with information that allows it to'
separately compile and bind to a host program only procedures that are
being changed. This process is called a "sepcomp" . . and the HOST file is
used if the SEPCOMP compiler control option is TRUE. The HOST file is a
special object code file. created by a previous compile when the
MAKEHOST compiler control option was TRUE.
The HOST file contains
information about the outer block environment of the program and the
environments of selected procedures.
For more information on the
SEPCOMP and MAKEHOST options, see "<sepcomp option>" and "<makehost
option>," respectively, in this chapter.
The INFO file contains the contents of variables and tables used in the
compiler, saved from a previous compile. This file is used for separate
compilation of procedures. It is created by the DUMPINFO compiler
control option and is used as an input file by the LOADINFO compiler
control option. For more information on the DUMPINFO and LOADINFO
options. see "<dumpinfo option>" and "<loadinfo option>," respectively,
in this chapter.
See also
<dumpinfo option> .
<include option> . .
<loadinfo option> .
<makehost option> .
<merge option> . .
<sepcomp option>.
.
.
.
.
.
. 611
. 615
623
625
628
. 635
591
Compiling Programs
OUTPUT FILES
The output files produced by the compiler consist of the following:
CODE, which is the object code file
NEWTAPE, which is the updated source code file
LINE, which is the printer listing of the program
ERRORFILE, which is the error message file
XREFFILE, which contains cross-reference information
INFO. which contains information used for separate compilation
The CODE file is produced unconditionally and contains the executable
object code produced by the compiler.
This file is either stored
permanently, executed and then discarded, or discarded, depending on the
specifications in the WFL or CANDE "COMPILE" statement that initiated
the compiler. and on whether or not syntax errors occurred during the
compilation.
For more information on the WFL and CANDE "COMPILE"
statements, refer to the "Work Flow Language (WFL) Reference Manual" and
the "CANDE Reference Manual."
NEWTAPE File
The NEWTAPE file is produced only if the NEW compiler control option is
TRUE.
The NEWTAPE file is an updated source file that consists of the
source input from the CARD file. the TAPE file. and (if the INCLNEW
compiler control option is TRUE) the included files that was actually
compiled. If compiler file equation is not applied to the NEWTAPE file,
it is a disk file. For more information on the NEW and INCLNEW options,
see "<new option>" and "<inclnew option>," respectively. in this
chapter.
The LINE file is produced if either of the compiler control options LIST
or TIME is TRUE. If compiler file equation is not applied to the LINE
file, it is a printer file.
592
ALGOL REFERENCE MANUAL
The contents and format of the LINE file depend on
following compiler control options:
CODE
FORMAT
LISTDELETED
LISTINCL
LISTOMITTED
LISTP
the
values
of
the
PAGE
SEGS
SINGLE
STACK
TIME
The LINE file always contains at least the following information:
1.
The title of the source file CARD used as input to the compiler
L.
Code segmentation information
3.
Error messages and error count, if syntax errors occur
4.
Summary information about the compile, such as the
lines read and the size of the object code file
number
For more information about the compiler control options that affect
LINE file. see "Option Descriptions" in this chapter.
~R.RORFILE
of
the
File
The ERRORFILE file is produced only if the ERRLIST compiler control
option is TRUE.
If compiler file equation is not applied to the
ERRORFILE file. it is a printer file if the compile was initiated
through WFL and a remote file if the compile was initiated through
CANDE. If no syntax errors occur during compilation, no ERRORFILE file
is produced. regardless of the value of the ERRLIST option. For more
information on the ERRLIST option~ see n<errlist option>" in this
chapter.
For every syntax error that occurs during compilation. two records are
written to the ERRORFILE file. The first record is a copy of the source
record that contains the error. The second record contains the sequence
number of that source record (if the source record was sequenced) and
the error message.
59::
Compiling Programs
XREFFILE File
When either of the compiler control options XREFor XREFFILES is TRUE.
the compiler saves raw cross-reference information in the XREFFILE file.
The contents of the file are affected by the compiler control options
XDECS and XREFS.
Before this information can be printed or read by
-SYSTEM/INTERACTIVEXREF or the Editor, it
must
be
analyzed
by
SYSTEM/XREFANALYZER.
The
XREFFILE file is given the file name
"XREF/<code file name>", where <code file name> is the file name of the
object code file being produced.
For more information about the
cross-reference options, see "Option Descriptions" in this chapter.
The INFO file contains the contents of variables and tables used in the
compiler.
It
is intended ior use in separate compilations of
procedures. This file is created by the DUMPINFO comp:Ller control
option, and it is used as an input file by the LOADINFO compiler control
option.
See also
<errlist option> . . .
<inclnewoption>.
<new option> . . . .
Option Descriptions .
.
.
. 612
. 614
. . . 629
603
594
ALGOL REFERENCE MANUAL
7.2
SOURCE RECORD FORIAT
The records of a source code file read by the ALGOL compiler can be
size greater than or equal to 72 characters.
any
Assume that the character positions (called columns) of a source record
are numbered from I to n. where n is the size of th& record in
characters. The compiler divides each source record as follows:
1.
The data in columns 1 through 72 is assumed to be ALGOL source
'language as defined in this manual. Any characters that appear
beyond column 72 are not compiled ,as
source
language
constructs.
2.
Characters in columns 73 through 80 of a record are treated
a sequence number. which is optional.
3.
Any information beyond column 80 is ignored.
as
The column in which an ALGOL construct begins is not significant. unless
the source record 1s a compiler control record or the construct
continues beyond column 72. (For more information on compiler control
records. refer to "Compiler Control Records" in this chapter.) The data
in columns I througQ 72 is treated as a continuous stream from record to
record.
In other words, no delimiters are implied at the end of a
record. and string literals, identifiers, and all other valid ALGOL
constructs can be continued from column 72 of one record.to column 1 of
the succeeding record.
595
Compiling Programs
7.3
COMPILER CONTROL OPTIONS
Compiler control options provide the programmer with the means to
control many aspects of the compilation of an ALGOL program. These
options c~n instruct the compiler to use optional input files or to
produce optional output files. In addition to other things, the options
can do all of the following:
Affect the contents of the printer listing
Designate the target computer for which code is to be produced
Set the default character type
Cause the compiler to perform separate compilation
Invoke the Binder
Invoke debugging features
Exclude source records
Set a limit on the number of syntax errors the program can get
Resequence source records
Check that sequence numbers are in order
Control code file segmentation
Flag BeL constructs
596
ALGOL REFERENCE MANUAL
COMPILER CONTROL RECORDS
Compiler control options are included in an ALGOL program
special source records called compiler control records.
by
using
Syntax
<compiler control record>
-- $
---~---------------------------------------------------------->
1
I
1 1<----------------1 1 I-<dumpinfo option>-I
I 1
11 I
1
I---<option phrase>---I I-<loadinfo option>-I
I
I
1
I-<include option>--I
1
1
1
I-<binder cornmand>--------------------------I
>-<escape remark>--------------------------------------------------I
<option phrase>
I<----------------------~I
1
1
---------------------------------------------------------------1
I
1
1- SET ---I
I
1- POP ---I
I
1- RESET -I
I
I
I-<Boolean option>---I
I
I
I
1
I-<immediate option>-!
1
I
1
1
1
'-<value option>-----I
1
1<----------------------------------------------1 1
I
1
1
\- SET ---<Boolean option>--------------------------------I
1-
= --<option
1
expression>-I
597
Compiling Programs
<Boolean option>
A <Boolean option> can be any of the following:
<$ option>
<ASCII option>
<autobind option>
<BeL option>
<breakpoint option>
<B7700 option>
<check option>
<code option>
<errlist option>
<format option>
<inclnew option>
<inclseq option>
<installation option>
<intrinsics option>
<library option>
<lineinfo option>
<list option>
<listdeleted option>
<listincl option>
<listomitted option>
<listp option>
<makehost option>
<MCP option>
<merge option>
<new option>
<newseqerr option>
<noBCL option>
<nobindinfo option>
<nostackarrays option>
<noxreflist option>
<oldresize option>
<omit option>
<optimize option>
<segs option>
<sepcomp option>
<seq option>
<seqerr option>
<single option>
<stack option>
<statistics option>
<TADS option>
<time option>
<user option>
<void option>
<voidt option>
<warnsupr option>
<writeafter option>
<xdecs option>
<xref option>
<xreffiles option>
<xrefs option>
<immediate option>
----<beginsegment option>----!
!
I
I-<breakhost option>----!
1
!
I-<endsegment option>---I
I
I
I-<go to option>-------~I
i
1
I-<page option>---------I
598
ALGOL REFERENCE MANUAL
<value option>
----<leveloption>-----------------.
I
I
I-<limit option>--------------!
1
I-<segdescabove option>-------j
I
I-<sequence base option>------i
I
I-<sequence increment option>I
I-<sharing option>-----------I
I-<target option>------------I-<version option>-----------<option expression>
1
AND ------1
I
I
1
1 <- OR --I
1
I
1
1 <-
1 (------
1
1
1
I
1
1 <-
1
1
i
I
I
1
EQV -I
1
IMP -
I
----<option primary>----I
1
<option primary>
--------------<user option>--------------------I
I
I
I
1- NOT -I !- TRUE ------------------------1
i
I
I
1- " ---I ! - FALSE -----------------------1
*
---------------------------1
- ( --<option expression>-- ) -!
Compiling Programs
<binder command>
----<bind option>----------i
I
I
I-<binder option>-----j
I
I
I
I-<external option>---I
I
I
I-<host option>-------I
I
I
I-<initialize option>-I
I
I
I-<purge option>------I
I
I
I-<stop option>-------I
I
I
I-<use option>--------!
Semantics
Compiler control records are submitted to the ALGOL compiler as part of
the source input and are distinguished from other constructs by the
dollar sign ($) that must begin every compiler control record.
In a compiler control record. the column in which the initial $ occurs
is significant. Compiler control records with the initial $ in column I
affect only the current compilation and are not saved in the NEWTAPE
file, if any. Compiler control records with the initial S in column 2
are considered permanent compiler control records and are saved in the
NEWTAPE file. i f any. Compiler control records with the initial $ in
columns 3 through 7~~. inclusive, are considered both permanent and
conditional, in that they are saved in the NEWTAPE file, if any, and
they are ignored when the OMIT option is TRUE.
A compiler control record can contain tne following:
1.
Boolean options
~.
Value options
3.
lmmedia teopt ions
4.
Special options
5.
Binder commands
600
ALGOL REFERENCE MANUAL
A Boolean option is one that is either enabled (TRUE) or disabled
(FALSE).
When enabled, it causes the compiler to apply an associated
function to all subsequent processir.g unti~ the option is disabled.
A value option causes the compiler to store a value
given function.
associated
An immediate option causes the compiler to perform
function that is not applied to subsequent processing.
with
a
immediately
a
The special options (the DUMPINFO option, the LOADINFO option, and the
INCLUDE option), like the immediate options, cause the compiler to
perform immediately a function that is not applied to subsequent
process~ng.
However. they are not grouped with the immediate options
because of special syntactic requirements.
Binder commands are passed directly to the Binder program.
For more
information on Binder statements and control options. refer to the
"Binder Reference Manual."
The keywords SET, RESET, and POP affect the value of Boolean options.
Each Boolean option has an associated "stack" in which the current value
and up to 46 previous values of the option are saved. The management of
this stack of values is described below:
1.
If the first keyword to the left of a Boolean option in a
compiler control record is SET or RESET, the current value of
the option is pushed onto the stack and the option is assigned
a value of TRUE or FALSE. respectively. In other words, the
option is assigned a new value. and the previous value is saved
in the stack..
2.
If the first keyword to the left of a Boolean option in a
compiler control record is POP. the current value of the option
is discarded and the previous value is removed from the top of
the stack and assigned to the option.
3.
If a Boolean option is not preceded in a compiler control
record by any keyword. then the following actions occur:
a.
All resettable standard Boolean options are assigned a
value of FALSE and all previous values in their stacks are
discarded.
b.
The Boolean options appearIng in the compiler control
record with no preceding keyword are assigned a value of
TRUE.
601
Compiling Programs
The following is a list of the reset table standard Boolean options that
are affected when a Boolean option appears in a compiler control record
without a preceding keyword:
ASCII
AUTOBIND (if SEPCOMP is FALSE)
BCL
CHECK
CODE
FORMAT
INCLNEW
INCLSEQ
INSTALLATION
INTRINSICS
LIST
LISTDELETED
LISTINCL
LISTP
MAKEHOST (if thE' first syntactic
item has not been seen)
NEW
NEWSEQERR
NOXREFLIST
OMIT
OPTIMIZE
SEGS
SEQ
SEQERR
STACK
STATISTICS
TIME
VOID
VOIDT
WARNSUPR
WRITEAFTER
XREF
XREFFILES
XREFS
$
A compiler control record that consists of only
followed by all blanks) has no effect unless it is
MERGE option is TRUE, and a record is present in
file TAPE that has the same sequence number as
record. When these three conditions are met, then
ignored.
an initial $ (a $
in the CARD file, the
the secondary input
this compiler control
that TAPE record is
In an <option expression>, the Boolean operators have the
same
precedence as they do in Boolean expressions; that is. NOT and ~ are
equivalent and have the highest precedence, followed by AND. OR, IMP.
and EQV, in that order. The <option primary> n,..n represents the current
value of the Boolean option whose value is being assigned. For example.
the compiler control record
$ SET OMIT
=
~
OR DEBUGCODE
causes records from both the CARD and TAPE files to be ignored if either
the OMIT option is TRUE or the user option DEBUGCODE is TRUE.
602
ALGOL REFERENCE MANUAL
Examples
$
SET LIST MERGE NEW RESET SINGLE
This compiler control record assigns a value of TRUE to the LIST
option, MERGE option, and NEW option. and assigns a value of FALSE
to the SINGLE option. The previous value of each of these options
is saved in the corresponding stack.
$
PAGE
This compiler control record invokes the immediate opti'on PAGE"
causing the compiler to skip the printer listing to the top of the
next page (if the LIST option is TRUE). Because the PAGE option is
not a Boolean option. the action described above for Boolean options
not preceded by a keyword does not occur.
$
SET LISTP 135000 POP LIST
This compiler control record assigns a value of TRUE to the LISTP
option. assigns the value 135000 to the sequence base option. and
returns the LIST option to its most recent previous value.
$
LISTP POP MYOPTION
This compiler control record assigns FALSE to all reset table
standard Boolean options and discards all previous values in their
stacks. assigns the value TRUE to the LISTP option. and returns the
USER option MYOPTION to its most recent previous value. The stack
for MYOPTION is unaffected by the purge of the stacks for the
standard reset table Boolean options, because it is not a standard
option.
603
Compiling Programs
OPTJON DESCRIPTIOlfS
The rest of this
options.
Chapter
d~scribes
ttie' individual
compiler
control
<ASCII option>
--ASCII --I
(Type:
Boolean. Default value:
FALSE)
When TRUE, the ASCII option sets the default character type to ASCII.
For more informaticlO. refer to "Default Character Type" in the appendix
"Data Representation."
If the BCLoption is TRUE and the ASCII option
TRUE, a syntax error is given.
is
assigned
the
value
See also
Default Character Type. . . . . . . . . . . . . . . . . . . . . 817
<autob1nd option>
-- AUTOBIND --I
(Type:
Boolean. Default value:
FALSE)
If TRUE, ~heAUTOBIND option causes the processes of compilation and
program binding to be combined into one job. During compilation, the
compiler produces a set of instructions to be passed to the Binder
program~
In most cases, these .Binder instructions are suffiCient. If
additional Binder instructions are required, the ALGOL <binder command>
syntax can be used.
604
ALGOL REFERENCE MANUAL
The AUTOBIND option can be assigned a value at any time during
compilation.
However, for the following reasons, it shbuld be assigned
a value only once, at the beginning of compilation:
1.
The value of the AUTOBIND option is significant only at the end
of compilation.
For example, if four procedures are being
compiled. the first three with the AUTOBIND option FALSE and
the last with the AUTOBIND option TRUE, the Binder attempts to
bind all four procedures to the specified host.
2.
When the AUTOBIND option is FALSE, compile-and-go on a separate
procedure is not executed.
If the AUTOBIND option is TRUE
throughout compilation, execution of the resulting program
takes place after binding.
In ALGOL, an outer block or a separate procedure compiled at lexical
(lex) level two can serve as a "host" for binding. Separate ALGOL
procedures compiled at lex level three (the default level) or higher can
be bound into a host. Any number of separate procedures, but only one
host, can be compiled in one jab. The host must be the last program
unit compiled.
If an appropriate host file is compiled with the
AUTOBIND option equal to TRUE. it is assumed to be the host for binding.
(This assumption cannot be overridden by file equation or by use of the
HOST option.) If no eligible host is being compiled, a host must be
specified, either by file equation of the compiler file HOST or by use
of the HOST option.
The object code file of any procedure compilea at lex level three or
higher
with
the
AUTOBIND
option equal to TRUE is marked as
nonexecutable. To be executed. the procedure must be bound into a host
file by the Binder program or invoked by a PROCESS or CALL statement.
Object code files of any procedures compiled at lex level three or
higher are purged after being bound into a host by the AUTOBIND option.
To be retained, such a code file must be referenced specifically in
either a BIND option or an EXTERNAL option.
When the batch facility is used, the AUTOBIND option cannot be assigned
a v~lue.
If the TADS option is TRUE when the AUTOBIND option is
assigned the value TRUE, then the AUTOBIND option is left equal to FALSE
and a warning message is given.
605
Compiling Programs
<BeL option>
-- BCL --I
(Type:
Boolean, Default value:
FALSE)
When TRUE, the BCL option sets the default character type to BCL.
For
more information. refer to "Default Character Type" in the appendix
"Data Representation."
If the ASCII option :ls TRUE when the BCL option is
TRUE. a syntax error is given.
assigned
the
value
See also
Default Character Type. . . . . . . . . . . . . . . . . . . . . 817
NOTE
The BeL data type is not supported on all
A Series and B 5000/B 6000/B 7000 Series
systems.
The appearance
of
a
BCL
construct that may cause the creation of
a BeL descriptor, such as the BCL option,
will
cause
the
program
to get a
compile-time warning message.
<beginsegment option>
-- BEGINSEGMENT --I
(Type:
immediate)
The BEGINSEGMENT option and the END SEGMENT option a1lo\\1 the programmer
to control code file segmentatio~. Procedures encountered between a
BEGINSEGMENT option and an ENDSEGMENT option are placed in the same code
segment. which is called a "user segment" because it is user-controlled
instead of compiler-controlled.
606
ALGOL REFERENCE MANUAL
The oBEGINSEGMENT option must appear before the declaration of the first
procedure to be included in the user segment. The END SEGMENT option
must appear after the last source record of the last procedure to be
included in the user segment.
A procedure cannot be split across user segments. The first procedure
in the user segment must be one for which the compiler would normally
generate a segment; that is. it must have local declarations.
External
procedures cannot be declared inoa user segment.
Declarations of global items other than procedures within a user segment
can result in those items not being initialized. This could cause the
program to get a fault at run time. Declarations of global items other
than procedures should be placed outside user segments.
User segments can be nested; that is, a BEGINSEGMENT option can appear
in a user segment. In this case, an ENDSEGMENT option applies to the
user segment currently being compiled.
If a BEGINSEGMENT option appears before the beginning of a separately
compiled procedure, an ENDSEGMENT option is assumed at the end of the
procedure, even if none appears.
The driver procedure created for
procedures compiled at lexical level three is always in a different code
segment.
The segment information in the printer listing is modified for user
segments.
User segments are numbered consecutively in a program.
beginning with 1; that is, the first user segment is USERSEGMENT1, the
second user segment is USERSEGMENT2, and so forth. The code segment
number of each user segment is printed at its beginning; the length of
each user segment is printed at its end. Procedures or blocks whose
segmentation is overridden by user segmentation are printed out as being
"in" that user segment.
Forward procedure declarations are not affected by user segmentation.
If more than one BEGINSEGMENT option appears before a procedure, the
warning
message "EXTRA BEGINSEGMENT IGNORED" is printed.
If an
ENDSEGMENT option appears and there has been no BEGINSEGMENT option, the
warning message "EXTRA ENDSEGMENT IGNORED" is printed.
The BEGINSEGMENT option and ENDSEGMENT option allow the programmer to
reduce presence-bit overhead by grouping frequently called procedures
and infrequently called procedures in separate segments.
607
Compiling Programs
«bind option>
-- BIND
--<text>-~I
See also
<text>.
(Type:
61
Binder command)
During autobinding, the BIND option is passed directly to the Binder
program for analysis.
The format and function of this option are the
same as those of the Binder BIND statement and are described in the
"Binder Reference Manual."
When the batch facility is used, the BIND option cannot be used.
<binder option>
-- BINDER --<text>--I
See also
<text>.
(Type:
61
Binder command)
During autobinding, the <text> in the BINDER option is passed directly
to the Binder program for analysis. The format and function of <text>
are the same as those of the Binder control options and are described in
the "Binder Reference Manual."
608
ALGOL REFERENCE MANUAL
<breakhost option>
-- BREAKHOST
-----------------------------1
I
1
1- ( --<input file>-- ) -I
<input file>
--<file identifier>--I
See also
<file identifier> . . . . . . . . . . . . . . . . . . . . . . .
(Type:
85
immediate)
To create the necessary environment for interactive debugging with the
breakpoint intrinsic. the BREAKHOST option must appear in the outer
block of any program that uses the BREAKPOINT option or the BREAKPOINT
statement. This option must appear after the first "BEGIN" of a program
but before the first statement of the outer block.
A part of the environment created by the BREAKHOST option is a remote
file.
If a program to be debugged has a remote input file. the name of
that file must be specified as the <input file> to allow the breakpoint
intrinsic to use that remote file, because only one remote input file
can be open for each station.
Another part of the environment created wher. the BREAKHOST option is
TRUE is a 32.768-element real array.
If a program that uses the
BREAKHOST option is run with its task attribute OPTION equal to LONG,
the run-time error
DIMENSION SIZE ERROR 1=32768
is given if the overlay row size of the
array of that size.
system
cannot
accommodate
an
The BREAKHOST option should not be used in a library program.
For more information about the breakpoint feature. see ilBREAKPOINT
Statement" and the description of the BREAKPOINT option is this section.
609
Compiling Programs
NOTE
The BREAKHOST option,
the
BREAKPOINT
option. and the BREAKPOINT statement are
being deimplemented on the Mark
3.7
release.
For a debugging feature, refer
to the TADS option in this section.
<breakpoint option>
-- BREAKPOINT --j
(Type:
Boolean. Default value:
FALSE:)
While the BREAKPOINT option is TRUE. the code emitted for each ALGOL
statement is followed by a call on the breakpoint intrinsic. The
execution of the program stops (breaks:) after each statement in this
range (and at any explicit call of the breakpoint intrinsic) to allow
debugging through the use of breakpoint commands.
For more information about the breakpoint feature.
see "BREAKPOINT
Statement" and the de,scription of the :BREAKHOST option in this section.
NOTE
The BREAKHOST option.
the
BREAKPOINT
option. and the BREAKPOINT statement are
being deimplemented on the Mark
3.7
release.
For a debugging feature. refer
to the TADS option.
<B7700 option>
-- B7700 --I
(Type:
Boolean. Default value:
TRUE)
When TRUE. the B7700 option causes optimized code to be generated for
the B 7000 Series systems. The B7700 option cannot be assigned a value
if the TARGET option has been used or if the computer on which the
program is run is an A Series system.
610
ALGOL REFERENCE MANUAL
NOTE
The B7700 option will be deimplemented on
the Mark 3.7 release. For information on
code optimization
for
a
particular
computer. refer to the TARGET option in
this section.
<check option>
-- CHECK --I
(Type:
Boolean. Default value:
FALSE)
When TRUE, the CHECK option causes an error to be given if the sequence
number on a record of the TAPE or NEWTAPE file is not strictly greater
than the sequence number of the preceding record. If a sequence error
occurs in the TAPE file, the word "SEQERR" followed by the sequence
number of the previous source record is printed at the right side of the
source record on the printer listing. If a sequence error occurs in the
NEWTAPE file. the message "NEWTAPE SEQ ERROR" followed by the sequence
number of the previous source record is printed on the listing, and the
message "NEWTAPE SEQ ERR" is displayed on the Operator Display Terminal
(ODT).
In the ERRORFILE. the sequence number of the record that caused
the sequence error and the sequence number of the previous source record
appear on the line following the source record.
If the NEW option is FALSE and resequencing is occurring.
sequence number is the sequence number that is checked.
the
old
<code option>
-- CODE --I
(Type:
Boolean. Default value:
FALSE)
If both the LIST option and the CODE option are TRUE, the printer
listing includes the compiier-generated object code. If the LIST option
is TRUE but the CODE option is FALSE. the printer listing does 'not
include the object code. The value of the CODE option is ignored if the
LIST option i5 FALSE.
611
Compiling Programs
<dump1nfo option>
-- DUMPINFO
------------~------~------~I
I
I
I-<file specification.>-I
<file specification>
----<title>--~--------------I
I
I~<internal
I
file name>-I
I
I
I-<name and title>-----I
<title>
A quoted string containing a file title.
<internal file name>
. --<identifier>--I
<name and title>
--<internal file name>-- = --<title>--I
(Type:
special)
The DUMPINFO option is
section.
described
with
the
LOADINFO
option
in
this
The ENDSEGMENT option is described with theBEGINSEGMENT option in
section.
this
<endsegment option>
-- END SEGMENT --I
(Type:
immediate)
/
612
ALGOL REFERENCE MANUAL
<errlist option>
-- ERRLIST --I
(Type: Boolean, Default value:
FALSE otherwise)
TRUE
for
CANDE-originated
compiles,
When TRUE, the ERRLIST option causes syntax error information to be
written to the ERRORFILE file. When a syntax error is detected ·in the
source input, the source record that contains the error, an error
message, and the syntactical item where the error occurred are written
on two lines in the ERRORFILE file. This option is provided primarily
for use when the compiler is invoked at a terminal by CANDE, but it can
be used regardless of the manner in which the compiler is invoked. When
the compiler is invoked from CANDE. the default value of the ERRLIST
option is TRUE, and the ERRORFILE file is automatically equated to the
remote device from which the compiler was invoked.
<external option>
-- EXTERNAL --<text>--I
See also
<text>.
(Type:
61
Binder command)
During autobinding, the EXTERNAL option is passed directly to the Binder
program for analysis.
The format and function of this option are the
same as those of the Binder EXTERNAL statement and are described in the
"Binder Reference Manual."
When the batch facility is used. the EXTERNAL option cannot be used.
613
Compiling Programs
-(format option>
-- FORMAT --I
(Type:
Boolean, Default value:
FALSE)
If both the LIST option and the FORMAT option are TRUE,
then to aid
readability of the printer listing, several blank lines are inserted
after each procedure.
If the LIST option is TRUE but the FORMAT option
is FALSE,
no blank lines are inserted after procedures.
If the LIST
option is FALSE, the value of the FORMAT option is ignored.
<go to option>
-- GO ----------<sequence number>--I
i
1-- TO -!
<sequence number>
I
<------------
1
i
1
----/8\-<digit>----1
(Type:
immediate)
The GO TO option is used to reposition the secondary source input file
TAPE.
This option is intended for use with disk files and does not work
on tape files.
The <sequence number> construct specifies a sequence number appearing on
a record in the TAPE file.
The GO TO option causes the TAPE file to be
repositioned so that the next record from this file used by the compiler
is the first record with a sequence number greater than or equal to the
specified sequence number.
The TAPE file must be properly sequenced in
ascending order; that is, the sequence number on each record in the file
must be strictly greater than the sequence number on the preceding
record.
The specified sequence number can be greater than or less than
the sequence number of the record on which the option appears.
614
ALGOL REFERENCE MANUAL
This option cannot appear within a DEFINE declaration or in included
source input, and cannot be used when the batch facility is used.
<host option>
-- HOST --<text>--:
See also
<text>.
(Type:
61
Binder command)
During autobinding, the HOST option is passed directly to the Binder
program for analysis.
The format and function of this option are the
same as those of the Binder HOST statement and are described in the
"Binder Reference Manual."
When the batch facility if used. the HOST option cannot be used.
<inclnew option>
-- INCLNEW --I
(Type:
Boolean. Default value:
FALSE)
If both the NEW option and the INCLNEW option are TRUE, included source
input is written to the NEWTAPE file. If the NEW option is TRUE but the
INCLNEW option is FALSE. included source input is not written to the
NEWTAPE file.
If the NEW option is FALSE. the value of the INCLNEW
option is ignored.
When the batch facility is used, the INCLNEW option cannot be assigned a
value.
615
Compiling Programs
<inclseq option>
-- INCLSEQ --I
(Type:
Boolean. Default value: . FALSE)
If both the SEQ option and the INCLSEQ option are TRUE. included source
input is resequenced. If the SEQ option is TRUE but the INCLSEQ option
is FALSE. included source input is not resequenced. If the SEQ option
is FALSE, the value of the INCLSEQ option is ignored.
When the batch facility is used, the INCLSEQ option cannot be assigned a
value.
<include option>
-- INCLUDE -------------------------------------------------------->
I-<file specification>-I !-<start specification>-I
>------------------------------------------------------------------1
!
I-<stop specification>-!
<start specification>
---- • ------------------1
!
1
I-<sequence number>-I
<stop specification>
-- - --<sequence number>--I
See also
<file specification>.
<sequence number> . .
(Type:
special)
. 611
. . 613
616
ALGOL REFERENCE MANUAL
The INCLUDE option causes the compiler to accept source language input
from files other than the CARD and TAPE files. The included records are
compiled in place of the record on which the INCLUDE option appears.
The included records can themselves contain INCLUDE options: in this
way, included source input can be nested up to five levels deep.
The <file specification> construct specifies the file from which source
input is to be included. If the <title> form is used, the quoted string
specifies the TITLE attribute of the file.
The <internal file name>
form provides an internal file name that can be associated with an
actual file through file equation. The <name and title> form provides
both an internal file name available for file equation and a title to be
used if the internal file name is not file-equated.
If the <file specification> construct is not used, the same file as that
specified in the previous INCLUDE option at the same level of nesting is
used. Therefore, the first INCLUDE option at any of the five possible
levels of nesting must contain the <file specification> construct.
The <start specification> construct specifies the record of the included
file at which inclusion is to start. If the <sequence number> form is
specified. inclusion begins with the first record with a sequence number
greater than or equal to the specified sequence number.
If the
asterisk (*) form of <start specification> is used. inclusion begins at
the point where it left off the last time inclusion took place from this
file at the same level of nesting.
If the <start specification>
construct is not used, inclusion begins with the first record of the
file.
The <stop specification> construct specifies the record after which
inclusion is to stop.
If the <stop specification> construct is not
used. inclusion ends after the last record of the file.
Source files suitable for use by the INCLUDE option can be
the compiler by using the NEW option.
produced
Files declared globally in Work Flow Language (WFL) jobs should
used as INCLUDE files.
not
by
be
The INCLUDE option must be the last option appearing on a compiler
control record, and it cannot be used when the programmer is using the
batch facility.
617
Compiling Programs
j:::xamples
$ INCLUDE FILE8 00001000 - 09000000
This example instructs the compiler to accept as input all records
from the file indicated by the internal name FILE8, with a sequence
number greater than or equal to 00001000 and less than or equal to
09000000.
!S INCLUDE *
This example instructs the compiler to accept as input a portion of
the file accessed by the last INCLUDE option at this level of
nesting. The records to be included are all records that follow the
last record included by that preceding INCLUDE option. If, for
example. the precE~ding INCLUDE option was the one in the first
example above, the file that is accessed is FILE8, and the records
that are included are all the records with a sequence number greater
than 09000000.
:$
INCLUDE "SOURCE/XYZ." - 900
This example instructs the compiler to accept as input a portion of
the file with the title "SOURCE/XYZ". The included records are all
records of the file with a sequence number less than or equal to
00000900.
$ INCLUDE INCL = "SYMBOL/ALGOL/INCLUDEl."
This example instructs the compiler to accept as input all records
of
either
the file to which the internal name "INCL" was
file-equated or, if the INCL file was not file-equated, the file
"SYMBOL/ALGOL/INCLUDEl".
<initialize option>
-- INITIALIZE --<text>--!
See also
<text> .
61
618
ALGOL REFERENCE MANUAL
(Type:
Binder command)
During autobinding, the INITIALIZE option is passed directly to the
Binder program for analysis. The format and function of this option are
the same as those of the Binder INITIALIZE statement and are described
in the "Binder Reference Manual."
When the batch facility is used, the INITIALIZE option cannot be used.
<installation option>
-- INSTALLATION
---------------------------------1
I
1
I-<installation number list>-I
<installation number list>
I<-----------------------------------~-----------------I
1
1
1
1
I
1(- , -I
1
I
I
----<installation number>-----------------------------------I
1
I
1- - --<installation number>-I
<installation number>
--<unsigned integer>--I
(Type:
Boolean, Default value:
FALSE)
When TRUE, the INSTALLATION option causes the compiler to recognize one
or more groups of installation intrinsics so that they can be referenced
in an ALGOL program. This option must be assigned a value befcre the
first syntactic item in a program. Assigning a value to this option at
any other time has no effect.
An lnstallation number must be an unsigned integer between 1 and 2047.
inclusive. Each installation number in an installation number list must
be strictly greater than the preceding installation number in that list.
Installation numbers larger than 2047 are treated as if they were equal
to 2047.
619
Compiling Programs
An iNSTALLATION option with no installation number list is equivalent to
one with an installation number list of 100 thrOugh 2047.
\lJhen the batch faci11 ty is
assigned a value.
~'intrinsics
used,
the
INSTALLATION
option
cannot
be
option>
-- INTRINSICS --I
(Type:
Boolean, Default value:
FALSE)
When TRUE, the INTRINSICS option causes separately compiled procedures
to be compiled at lexical (lex) lev:el two and allows a <global part>
construct to appear before the procedures. These procedures can then be
used as installation: intrinsics.
A
<global part> is not normally
allowed when compiling separate procedures at lex level two.
The title of the object code file generated for a procedure when the
INTRINSICS option is TRUE is the same as if the procedure were compiled
at lex level three. Thus, the separateprocedtires being compiled can be
bound into the intrinsics.
When the Binder program is used to bind
procedures into the intrinsics, the INTRINSICS option must be assigned
the value TRUE before the first source statement~
When the batch facility
assigned a value.
is
used~
the
INTRINSICS
option
cannot
be
<level option>
LEVEL --<outer level>--l
<outer level>
--<unsigned integer>--j
(Type: value, Default value:
procedures)
2 for programs, 3 for separately compiled
620
ALGOL REFERENCE MANUAL
The LEVEL option allows
levels assigned by the
separate procedures for
construct specifies the
the programmer to override the
compiler. This feature is needed
binding to a host program.
The
lex level at which compilation is
lexical (lex)
when compiling
<outer level>
to begin.
The LEVEL option must appear before the first syntactic item
program. and it cannot be used when the batch facility is used.
in
a
<library option>
-- LIBRARY --I
(Type: Boolean. Default value: TRUE for CANDE-originated compiles
when the SEPCOMP option is TRUE, FALSE otherwise)
and
When compiling multiple separate procedures (such as intrinsics),
assigning TRUE to the LIBRARY option improves the efficiency of the
binding. When TRUE, this option causes all object code from this
compilation to be put in one file, which is marked as a multiprocedure
code file. If the LIBRARY option is FALSE, each separate procedure
produces its own object code file.
The LIBRARY option must appear before the first syntactic item in a
program, and it cannot be assigned a value when the programmer is using
the batch facility.
The LIBRARY option is unrelated to the library facility described in the
chapter "Interface to the Library Facility."
<limit option>
-- LIMIT --<error limit>--i
<error limit>
--<unsigned integer>--I
621
Compiling Programs
(Type: value, Default value:
otherwise)
10
for
CANDE-originated
compiles,
150
The LIMIT option allows the programmer to specify the number of
compile-time errors that can occur before the compilation is terminated
because of excessive errors.
A limit of 0 indicate~s that the program is not to be terminated for
excessive errors.
If, when the LIMIT option is assigned a value. the
number of syntax errors already equals 6r exceeds that value, then the
program is immediately terminated.
<lineinfo option>
--
LINE~NFO
--I
(Type: Boolean, Default value:
FALSE otherwise)
TRUE
for
CANDE-originated
compiles,
When TRUE, the LINEINFO option causes the compiler to associate sequence
number information with the object code.
This information is then
displayed in the event of a run-time error.
A larger code file is
generated if the LINEINFO option is TRUE than if it is FALSE.
<list option>
-- LIST --I
(Type: Boolean. Default value:
TRUE otherwise)
FALSE
for
CANDE-originated
compiles.
When TRUE. the LIST option causes source input from the CARD and TAPE
files and other information to be printed on the compiler LINE file.
When a value is aSSigned to the LIST option, the same value is
to the SEGS option.
assigned
622
ALGOL REFERENCE MANUAL
<listdeleted option>
-- LISTDELETED --I
(Type:
Boolean, Default value:
FALSE)
When both the LIST option and the LISTDELETED option are TRUE~ the
printer listing includes records from the secondary input file TAPE that
are replaced. voided. or deleted during the compilation.
The word
"REPLACED" appears to the right of the source records replaced by a
record from the primary input file. CARD; the word "VOIDT" appears if
the record is voided from the TAPE file by the VOIDT option; and the
word "DELETED" appears if the record is deleted by a compiler control
record that consists of a dollar sign ($) followed by all blanks.
If the LIST option is TRUE but the LISTDELETED option is FALSE, records
from the TAPE file that are replaced, voided, or deleted are not written
to the printer listing. If the LIST option is FALSE, the value of the
LISTDELETED option is ignored.
<listincl option>
-- LISTINCL --I
(Type:
Boolean, Default value:
FALSE)
When both the LIST option and the LISTINCL option are TRUE. source
records included by using the INCLUDE option are written to the printer
listing. If the LIST option is TRUE but the LISTINCL option is FALSE,
the included records are not written to the printer listing. If the
LIST option is FALSE, the value of the LISTINCL option is ignored.
When the batch facility is used, the LISTINCL option cannot be used.
623
Compiling Programs
<listomitted option>
-- LISTOMITTED --I
(Type:
Boolean, Default value:
TRUE)
When both the LIST option and the LISTOMITTED option are TRUE,
source
records omitted by the OMIT option are written to the printer listing.
In the listing, the word "OMIT" appears next to the sequence number of
each omitted record.
If the LIST option is TRUE but the LISTOMITTED
option is FALSE, omitted records are not wr~tten to the printer listing.
If the LIST option is FALSE, the value of the LISTOMITTED option is
ignored.
<listp option>
-- LISTP --I
(Type:
Boolean. Default value:
FALSE)
When TRUE, the LISTP option causes records from the primary source input
file, CARD, to be written to the printer listing. Because these records
are also written when the LIST option is TRUE.
the LISTP option is
effective only when the LIST option is FALSE.
<loadinfo option>
-- LOADINFO
-------------~-------------I
I
I
I-<file specification>-I
See also
<file specification> . . . . . . . . . . . . . . . . . . . . . . 611
(Type:
special)
The DUMPINFO option and the LOADINFO option make it possible for the
contents of cer~ain simple variables and arrays of the compiler to be
saved in a disk filE~ and subsequently reloaded for separate compilation.
624
ALGOL REFERENCE MANUAL
The <file specification> construct specifies the fIle to be created by
the DUMPINFO option or loaded by the LOADINFO option. If the <title>
form is used, the quoted string specifies the TITLE attribute of the
file. The <internal file name> form provides an internal file name that
can be associated with an actual file by file equation. The <name and
title> form provides both an internal file name available for file
equation and a title to be used if the internal file name is not
file-equated.
If the <file specification> construct is not used, the
default INFO file or the file that is file-equated to the INFO file is
used.
These options are used in conjunction with separate compilation of
procedures.
Typically, all global declarations are compiled. and then
the DUMPINFO option is used to dump information about the global
declarations from the compiler to the file INFO. When the separate
procedures are to be compiled, the file INFO. containing information
about all of the glObal declarations, is read in by the LOADINFO option
before the procedures are compiled. For example, consider the following
programs:
Program 1
BEGIN
<global declarations>
$ DUMPINFO
END.
Program
~
%%% LOAD THE GLOBALS
[
$
LOADINFO
<additional global declarations>
<separate PROCEDURE declarations>
Each time
affected
compiling
different
a loadinfo operation is done. the old information in the
variables and tables of the compiler is discarded. Thus,
different portions of the same program. even if they are in
environments. can be done in the same compilation.
The loadinfo operation changes all items in th~ INFO file to globals and
all procedures already compiled to forward PROCEDURE declarations.
Thus, an INFO file created by a DUMPINFO operation that is done
immediately before a PROCEDURE declaration in a normal compilation is
suitable for loading global declarations when that procedure is to be
compiled separately.
625
Compiling Programs
When two or more items with the same identifier are declared at
different lexical (lex) levels, a separate compilation can access only
the last declaration seen before the loadinfo operation occurred.
If the release level of the compiler that performs the dumpinfo
operation to create an INFO file and the release level of the compiler
that performs the loadinfo operation on that file are not the same, a
syntax error is given~ and the compilation is discontinued. If a
loadinfo operation is attempted and the file specified as the INFO file
is not in fact an INFO file, or the INFO file was created by a compiler
for a different language. a syntax error is given and the compilation is
discontinued.
The DUMPINFO option and LOADINFO. option must be the last options
appearing on a compiler conttol record. and they cannot be used when
using the batch facility.
<makehost option>
/<------ , -----1
/
-- MAKEHOST-- (
1
---<environment)-~-
) --I
<environment>
1<---------- OF ---------1
I
----<procedure identifier>----I
See also
<procedure identifier> . . . . . • . . . . . . . . . . . . . . . 165
(Type:
Boolean. Default value:
FALSE)
Given only the source code and object code of a host program to be
changed and the patches to Change i~, the sepcomp facility of the
compiler can separately compile and bind to ~he host program only the
procedures that are being changed. This method, which is particularly
useful for large programs. requires that information not normally
collected and saved during the compiLation of the host program be saved.
When TRUE, the MAKEHOST option causes this information to be saved when
compiling a program or a procedure at lexical (lex) level two.
62b
ALGOL REFERENCE MANUAL
If the MAKEHOST option is TRUE, information is saved in the object code
file of the program about the symbolic file used or created by the
compilation, the sequence ranges of all procedures declared in the outer
block of the program, and the global declarations. The saving of the
outer block environment enables lex-level-three procedures to
be
compiled separately within this environment.
The information saved about the items declared in an environment
describes all of the items in that environment. There is no information
about the relative order of the declarations and therefore which items
are visible from which procedures. Thus, a sepcomp of a patch is not
necessarily equivalent to a full compile Of that patch.
For example,
given the following host program:
$ SET MAKEHOST
BEGIN
REAL X:
PROCEDURE P;
BEGIN
REAL R;
R := X + 5;
END P;
REAL ARRAY A[O:4]:
P;
END.
If a patch replaces the statement
R := X
+
5;
by the statement
R := X + A[2];
a full compile with the patch fails with a syntax error on the
assignment to R. because array A has not yet been declared. A sepcomp
of the patch, however, is successful.
because
the
environment
. information saved for the outer block describes A as well as X and P.
Additional environments can be saved. if desired, so that procedures at
lex levels greater than three can be replaced. Tne list of environments
can extend across several source records. Environments must be fully
qualified through the outermost level of PROCEDURE declaration, except
that for a program that is a procedure. the name of that procedure must
not appear.
A procedure that is specified as an environment must
contain a local declaration.
If a specified environment does not
contain a local declaration or if it is never found during the course of
compilation, the compiler gives a syntax error containing the name of
the environment.
Environments can appear in any order, without regard
to the actual bloCk structure of the host program.
627
Compiling Programs
Source records that are ins~rted into a program using the INCLUDE option
are not included in the environment information saved by the MAKEHOST
option. This information is not saved· because sequence numbers on
included records can duplicate sequence numbers occurring in the rest of
the program.
The information necessary to make a program into a host program includes
the information saved for the Binder program when the NOBINDINFO option
is FALSE; therefore" an error is given if both the NOBINDINFO opt ion and
the MAKEHOST option are TRUE.
When making a host program, the NEW option should be TRUE if any changes
are made to the host program. The default source file associated with
the host program is the NEWTAPE file. if one has been created;
otherwise. jt is the TAPE file.
The MAKEHOST option must appear before the first syntactic item in a
program, and it cannot be assigned a value when the programmer is using
the batch facility.
Examples
S SET MAKEHOST
BEGIN
ARRAY A[O:9];
PROCEDURE PI;
BEGIN
BOOLEAN B;
PROCEDURE INNER;
BEGIN
REAL R;
IF B THEN
R := "Ie + A[2];
END INNER;
END Pl;
PROCEDURE P2;
BEGIN
END P2:
END.
When the above program is compiled. information about the global
environment is saved in the object code file for the program. If a
patch is made to the body of procedure INNER, then during the
sepcomp process. all of procedure Pl is recompiled and bound to the
628
ALGOL REFERENCE MANUAL
host pr-ogram.
If. however, the MAKEHOST option was
$ SET MAKEHOST (PI)
then the local environment of PI is also saved in the object code
file of the program. A sepcomp of a patch to the body of procedure
INNER would cause only INNER to be recompiled and bound to the host
progra~.
$ SET MAKEHOST
$ SET MAKEHOST (PASSONE, PASSTWO. WRAPUP OF PASSTWO)
In this example, the second compiler control option overrides the
first. saving the environment of procedures PASSONE, PASSTWO, and
WRAPUP OF PASSTWO in addition to the global environment.
<Kep option>
-- MCP --I
(Type:
Boolean, Default value:
FALSE)
When TRUE. the MCP option causes all value arrays, translate tables,
truth sets. and constant pools to be allocated at lexical (lex) level
two.
The MCP option cannot be assigned a value after the appearance of the
first syntactical item in a program or when the programme~ is using the
batch facility.
<merge option>
-- MERGE --I
(Type:
Boolean. Default value:
FALSE)
When TRUE. the MERGE option causes the primary source input file. CARD,
to be merged with a secondary source input file. TAPE. to form the input
to the compiler. If matching sequence numbers occur. the record from
CARD overrides t~e record from TAPE. If the MERGE option is FALSE. only
primary~ource input is used, and the TAPE file is ignored.
629
Compiling Programs
The total input to the compiler when the MERGE option is TRUE consists
of all records from the CARD file, all records from the TAPE file that
do not have sequence numbers identical to those on records in the CARD
file. and all records inserted by INCLUDE options. Records in the CARD
file also override INCLUDE options in the TAPE file if matching sequence
numbers are encountered.
When the batch facility is used, the MERGE option cannot be
value ..
assigned
a
<new option>
-- NEW
(Type:
~-I
Boolean, Default value:
FALSE)
When the NEW option is TRUE, the source input to the compiler from the
CARD file is written to the updated source output file NEWTAPE. If the
MERGE option is also TRUE. then the merged source input from the CARD
and TAPE files is written to NEWTAPE. The format of the file written to
NEWTAPE is such that it can later be used as input to the compiler.
Records included in the source input by the INCLUDE option are written
to the NEWTAPE file only if the INCLNEW option is also TRUE. Compiler
control records are written to the NEWTAPE file only if the initial
dollar sign ($) does not appear in column 1.
The NEWTAPE file is created whether or not syntax errors
source input.
occur
in
the
If the MAKEHOST option is TRUE and th'e first syntactic item has been
compiled, any attempt to assign a value to the NEW option results in a
syntax error.
When the batch facility is used, the NEW option
value.
cannot
be
assigned
a
630
ALGOL REFERENCE MANUAL
<newseqerr-option>
-- NEWSEQERR
(Type:
--I
I
Boolean. Default value:
FALSE)
When TRUE, the NEWSEQERR option causes an error to be given if the
sequence· number on a record of the NEWTAPE file is not strictly greater
than the sequence number of the preceding record.
If sequence errors
occur and the NEWSEQERR option is TRUE. the NEWTAPE file is not locked.
the message "NEWTAPE NOT LOCKED" is displayed on the Operator Display
Terminal (ODT), and the message ~'NEWTAPE NOT LOCKED <number of errors>
NEWTAPE SEQUENCE ERRORS" is printed on the printer listing.
The
NEWSEQERR option is effective even if the CHECK option is FALSE.
When the batch facility is used, the NEWSEQERR option cannot be assigned
a value.
<noBeL option>
--"NOBCL --I
(Type:
Boolean. Default value:
FALSE)
When TRUE. the NOBCL option causes a syntax error to be given whenever a
BCL construct that may lead to the creation of a BCL de~criptor is
encountered. This option is intended tc aid in the elimination of BCL
constructs from a program so that the program can run on non-BCL
systems.
631
compiling Programs
<nobindinfo option>
-- NOBINDINFO --I
(Type:
Boolean, Default value:
FALSE)
When TRUE, the NOBINDINFO option prevents information needed by the
Einder program from being written to the object code file. The
resulting object code file can be executed. but it cannot be used as an
input file to the Binder program. Object code files that do not contain
binding information (bindinfo) are smaller than object code files that
contain bindinfo.
Object code files that contain the timing code provided by the
STATISTICS option cannot be bound.
Thus, the NOBINDINFO option is
assigned the value TRUE if the' STATISTICS option is assigned the value
TRUE.
If the STATISTICS option is TRUE when the NOBINDINFO option is
assigned the value FALSE. a syntax error is given.
If the MAKEHOST option is TRUE when the NOBINDINFO
the value TRUE, a syntax error is given.
When the batch facility
assigned a value.
is
used.
the
NOBINDINFO
option
option
is
assigned
cannot
be
<nostackarrays option>
-- NOSTACKARRAYS
(Type:
--I
Boolean, Default value:
FALSE)
When TRUE, the NOSTACKARRAYS option prevents arrays from being allocated
within the stack.
When the NOSTACKARRAYS option is FALSE. the data f.rom certain arrays is
allocated within the stack. Such arrays are referred to as "in-stack
arrays." and can be accessed slightly faster than an array whose data
area is allocated in memory.
632
ALGOL REFERENCE MANUAL
<noxreflist option>
-- NOXREFLIST --I
(Type:
Boolean, Default value:
FALSE)
When TRUE, the NOXREFLIST option prevents the SYSTEM/XREFANALYZER
program from being initiated by the compiler when cross-reference
information is being saved (that is, when either the XREF option or the
XREFFILES option is TRUE). Instead. the file "XREF/<code file name>",
where <code file name> is the name of the object code file generated by
the compiler, remains on disk. SYSTEM/XREFANALYZER can be run later
using the file "XREF/<code file name>" as input. The NOXREFLIST option
has no effect if both the XREF option and the XREFFILES option are
FALSE.
For more information on cross-referencing, refer to the
the XREF option in this section.
description
of
<oldresize option>
-- OLDRESIZE --I
(Type;
Boolean. Default value:
FALSE)
The OLDRESIZE option. which affected the semanLics of the RESIZE
staLement. no longer has any effect. The pre-Mark 3.3 semantics are no
longer available for newly compiled programs.
Any compiler controi
record that assigns the value TRUE to the OLDRESIZE option causes a
syntax error to be given. Any other appearance of the OLDRESIZE option
in a compiler control" record causes a warning message to be given.
Compiling Programs
<omit option>
-- OMIT --I
(Type:
Boolean, Default value:
FALSE)
When TRUE, the OMIT option causes records from the CARD file (and.
if
the MERGE option is TRUE,
from the TAPE file) to be ignored (not
compiled).
If both the LIST option and the LISTOMITTED option are TRUE,
then in the printer listing, th:e word "OMIT" appears next to the
sequence number of each omitted record. When the OMIT option is TRUE,
compiler control records with the initial dollar sign ($) in either
column 1 or column 2 are recognized, but compiler control records with
the $ in columns 3 through 72, inclusive, are ignored.
<optimize option>
-- OPTIMIZE --I
(Type:
Boolean. Default value:
FALSE)
When TRUE, the OPTIMIZE option causes additional analysIs of Boolean
expressions to be performed, and object code is generated to permit
early termination of the expression evaluation.
Any portion of the
Boolean expression that could cause side effects is always evaluated.
<page option>
-- PAGE
(Type:
immediate)
When the LIST option is TRUE and the PAGE option
listing is spaced to the top of the next page.
appears,
the
printer
634
ALGOL REFERENCE MANUAL
<purge option>
-- PURGE --<text>--I
See also
<text> .
(Type:
61
Binder command)
During autobinding. the PURGE option is passed directly to the Binder
program for analysis.
The format and function of this option are the
same as those of the Binder PURGE statement and are described in the
"Binder Reference Manual."
When the batch facility is used, the PURGE option cannot be used.
<segdescabove option>
-- SEGDESCABOVE
-------------------------1
I-<unsigned integer>-!
(Type:
value, Default value:
none)
The SEGDESCABOVE option is used when compiling large programs
have difficulty in addressing the segment dictionary.
that
may
When a host program is compiled, this option causes all code segment
descriptors to be allocated starting at the word in the Dl stack
specified by the unsigned integer. The unsigned integer must be in the
range 4 to 4095, inclusive.
If the option is used after the first
syntactic item has been compiled, the given value is added to the
current size of the DI stack.
The Binder program preserves the
segdescabove specification.
Care should be taken when using this
option. because unused Dl stack locations below the code segment
desc::-iptors occupy "save" memory when the program is running.
This option is intended to be used when compiling host files and is
ignored when separate procedures are compiled. When the batch facility
is used, the SEGDESCABOVE option cannot be used.
635
Compiling Programs
<segs option>
-- SEGS --I
(Type: Boolean, Default value:
TRUE otherwise)
FALSE
for
CANDE-originated
compiles,
If both the LIST option and the SEGS option are TRUE. the printer
listing will contain beginning and ending segment mes~ages. Assigning a
value to the LIST option assigns the same value to the SEGS option.
However, to suppress the segment messages, the SEGS option can be
assigned the value FALSE even though the LIST option is TRUE. When the
value of the LIST option is FALSE. the value of the SEGS option is
ignored.
<sepcomp option>
-- SEPCOMP
--------------1
1
I
I-<title>-I
See also
<title> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611
(Type:
Boolean, Default value:
FALSE)
When TRUE, the SEPCOMP option invokes the automatic separatE~ compilation
and binding facility, called the "sepcomp facility."
The title of the host program can be specified either by using the
<tiile> syntax of the SEPCOMP option or by file-equating the HOST file
of the compiler. The <title> specification takes precedence over file
equation.
The title of the default source file is stored in the host
program. but this title can be overridden by file equation of the
compiler file TAPE.
Compiler control records with blank sequence numbers are accepted
following the compiler control record that assigns TRUE to the SEPCOMP
option and before the first "patch record." A patch record is a source
record with a nonblank sequence number: at least one patch record is
required in a sepcomp. Sequence number errors among patch records are
not allowed.
The SEPCOMP option examines the patch records. decides
636
ALGOL REFERENCE MANUAL!
which procedures of the host program must be recompiled, and generates
Binder input for binding these procedures to the host program. The
SEPCOMP option always tries to compile procedures at the highest
possible
lexical
(lex)
level.
Therefore, the number of extra
environments specified when making a host program affects the choices
available to the SEPCOMP option.
When TRUE, the SEPCOMP option assigns TRUE to both the AUTOBIND option
and the LIBRARY option, causing all procedures to be compiled into one
multiprocedure code file (a temporary file used by the Binder program).
Explicitly assigning FALSE to the AUTOBIND option prevents the Binder
from being called and causes the object code file to be locked on disk
if the LIBRARY option is TRUE.
Explicitly assigning FALSE to the
LIBRARY option causes each procedure compiled to be put in a separate,
permanent object code file.
Binding still occurs, but at a somewhat
slower rate.
If procedures are put in separate code files, the titles of the code
files are determined in the standard way. with the procedure name
replacing the last identifier from the title on the compile statement
that invoked the compiler. Procedures compiled at lex level four and
higher have the name of their environment in the code file name also.
In the following example. when two lex-level-four procedures are
compiled having the same name but different enVironments, two code files
are produced (titled "A/PASSONE/Q" and "A/PASSTWO/QtI) in addition to the
new host file titled "A/HOST" (assuming that PASSONE and PASSTWO were
specified as extra environments when A/HOST was made).
$ SEPCOMP "A/HOST"
$ RESET LIBRARY
% PATCH CARD TO Q OF PASSONE
% PATCH CARD TO Q OF PASSTWO
<sequence number>
<sequence number>
The special information associated with a host program is always copied
by the Binder to the object code file of the new program so it can be
used as a host. This information is not updated by either the Binder or
the compiler during the sepcomp process. Following a sepcomp, this
information can inaccurately reflect the actual structure and content of
the host program with which it is associated.
Because the arrangement of data in a bound code file differs from that
of an unbound code file. binding to a bound host is faster than binding
to an unbound host. For this reason, assigning TRUE to the AUTOBIND
option when compiling a host program can be advantageous, because it
causes the Binder to be invoked.
637
compiling Programs
If the release level of the compiler that creates the host code file and
the release level of the compiler that is attempting a sepcomp to that
file are not the same, a syntax error is given and the compilation is
discontinued.
If the code fil~ specified as the host program was not
compiled with the MAKEHOST option equal to TRUE, or if the host program
was compiled by a compiler for a different language, a syntax error is
given and the compilation is discontinued.
The SEPCOMP option automatically assigns values to several other
compiler control options in order to simplify operation. The· MERGE
option is unavailable for use while the SEPCOMP option is TRUE.
Assigning TRUE to the MERGE option before assigning TRUE to the SEPCOMP
option is not allowed because it destroys the default file equation of
the source file to be used for the patches.
When the batch facility is used. the SEPCOMP option cannot be assigned a
value.
If the TADS option is TRUE when the SEPCOMP option is assigned
the value TRUE, the value of the SEPCOMP option is left equal to FALSE
and a warning message is given. The SEPCOMP option cannot be assigned a
value after the first syntactic item of a program has been compiled.
Multiple SEPCOMP option settings are not allowed because, when first
assigned TRUE, the SEPCOMP option initiates preprocessing of the source
input from the CARD file.
For more information on the sepcomp facility. refer to
of the MAKEHOST option in this section.
the
description
<seq option>
-- SEQ --I
(Type:
Boolean, Default value:
FALSE)
When TRUE, the SEQ option causes the printer listing and the updated
source file, NEWTAPE, to contain new sequence numbers. These new
sequence numbers are determined by the current values of the sequence
base option and the sequence increment option.
This option is effective only when the LIST option or NEW option is
TRUE.
The sequence numbers that appear on the records in these files
when the SEQ option is FALSE are identical to the sequen'ce numbers on
the corresponding records in the input files.
638
ALGOL REFERENCE MANUAL
The sequence base option and the sequence increment option are described
in this section.
<seqerr option>
-- SEQERR --I
(Type:
Boolean. Default value:
FALSE)
When TRUE. the SEQERR option causes an error to be given if the sequence
number on a record of the TAPE file is not strictly greater than the
sequence number of the preceding record. If sequence errors occur and
the SEQERR option is TRUE. the object code file is not locked. the
message "CODE FILE NOT LOCKED" is displayed on the Operator Display
Terminal (ODT). and the message "CODE FILE NOT LOCKED <number of errors>
TAPE SEQUENCE ERRORS" is printed on the printer listing.
The SEQERR
option is effective even when the CHECK option is FALSE.
<sequence base option>·
1<------------1
1
I
----/8\-<digit>----1
(Type:
value. Default value:
1000)
The sequence base option specifies the sequence number that
assigned to the next record when the SEQ option is TRUE.
record is resequenced. the value of the sequence base
increased by the value of the sequence increment option.
is to be
After each
option is
039
Compiling Programs
(sequence increment option>
1< ------------- I
I
-- +
(Type:
1
---/8\-<digit>---~1
value, Default value:
1000)
The value of the sequE?nCe increment option is used to increment the
value of the sequence base option when records are resequenced because
the SEQ option is TRUE.
<sharing option>
-- SHARING --
=
DONTCARE -----------1
I
I
1- PRIVATE ---------1
1
1
1- SHAREDBYALL -----1
1
I
1- SHAREDBYRUNUNIT -I
(Type:
value, Default value:
DONTCARE)
The SHARING option is used in a library program
programs are to share the library.
to
specify
how
other
DONTCARE
If the SHARING option has the value DONTCARE, the Master
Control Program (MCP) determines the sharing, and it is unknown
to all users invoking the library.
DONTCARE is the default
value of the SHARING option.
PRIVATE
If the SHARING option has -the value PRIVATE, a separate
instance of the library is started for each invocation of the
library. Any changes made to global items in the library by a
block that invoked the library apply only to that user of the
library.
640
ALGOL REFERENCE MANUAL
SHAREDBYALL
If the SHARING option has the
value
SHAREDBYALL.
all
invocations of the library share the same instance of the
library. Any changes made to global items in the library by a
block that has invoked the library apply to all users of that
library.
SHAREDBYRUNUNIT
A run unit consists of a program and all libraries that are
initiated either directly or indirectly by that program. A
"program," in this context, does not include either a library
that is not frozen or any tasks that are initiated by the
program (that is, a process family is not a run unit). If the
SHARING option has the value SHAREDBYRUNUNIT, all invocations
of a library within a run unit share the same instance of the
library.
Note that a library is its own run unit until it freezes.
For
example. program P initiates library A and, before library A
freezes, it in turn initiates library B. Now library B is in
library A's run unit, not in program P's run unit.· Had library
A initiated library B after freezing. both library A and
library B would be in program P's run unit.
The SHARING option must appear before the first syntactic item
program, and it cannot appear when the batch facility .is used.
in
the
<single option>
-- SINGLE --I
(Type: Boolean. Default value: TRUE if the compiler was compiled with
the DOUBLES PACE compiler-generation option equal to FALSE, FALSE
otherwise)
When TRUE, the SINGLE option causes the printer listing to
be
Single-spaced. When FALSE, the SINGLE option causes the printer listing
to be double-spaced.
641
Compiling Programs
<stack option>
--·STACK --I
(Type:
Boolean, Default value:
FALSE)
If both the ~IST option and the STACK option are TRUE.
the printer
listing includes thE? relative stack addresses, in the form of address
couples. for all program variables.
If the LIST option is TRUE but the
STACK option is FALSE, the printer listing does not contain these
address couples. The value of the STACK option is ignored if the LIST
option is FALSE.
<statistic~
option>
-- STATISTICS
-------------------------------------1
1
1
1- ( ------------- LABELS -- ) -I
1
1
1- SET ---I
1
1
1- RESET -I
(Type:
Boolean, Default value:
FALSE)
When TRUE,
the STATISTICS option causes timing statistics to be
gathered.
The option is examined at the beginning of each procedure or
block and. if it is TRUE at that time, timing statistics are gathered
for that procedure or block. Although the value of the option can be
altered at any time, only its value at the beginning of procedures and
blocks is significant in determining whether timings are made.
The Binder program cannot bind object ~ode files that contain the timing
code necessary for statistics: therefore. if the NOBINDINFO option is
FALSE when the STATISTICS option is assigned the value TRUE, the
NOBINDINFO option is assigned the value TRUE and a warning message is
given.
If the STATISTICS option is TRUE when the NOBINDINFO option is
assigned the value TRUE. a syntax error is given.
642
ALGOL REFERENCE MANUAL
If statistics are taken for a procedure or block, the frequency of
execution of that procedure or block is measured. along with the length
of time spent in that procedure or block. When the program is completed
for any reason (including both normal and abnormal termination), the
statistics of the executing task are printed out to the TASKFILE.
On the statistics output listing, an asterisk (*) indicates that doubt
exists about the timing for the specific procedure whose name precedes
the asterisk. In addition, timings are invalid for any procedure or
block that is resumed by a "bad go to."
Only the first six characters of
listing.
any
identifier
are
printed
on
the
For any procedure or block that has statistics ,gathered. the timings can
be broken down to the label level within that procedure or block by
using the LABELS syntax. The word "LABELS" can be preceded by "SET" or
"RESET"; if both are omitted, SET is assumed. For example,
$ SET STATISTICS (LABELS)
begins timing of label breakpoints, and
$
SET STATISTICS (RESET LABELS)
ends timing of label breakpoints. The words "SET" or "RESET" inside the
parentheses affect only the LABELS specification.
<stop option>
-- STOP --<text>--I
See also
<text>.
(Type:
61
Binder command)
During autobinding, the STOP option is passed directly to the Binder
program for analysis.
The format and function of this option are the
same as those of the Binder STOP statement and are described in the
"Binder Reference Manual."
When the batch facility is used. the STOP option cannot be used.
643
Compiling Programs
<TADS option>
-- TADS
------------------------------------------------~-----1
I
1
1
1<----------------- , ----------------1
!
1-
!
I
-----/1\- FREQUENCY --------------------!
1-/1\- REMOTE --<file identifier>-!
!
!
-I
1
See also
<file identifier> . . . . . . . . . . . . . . . . . . . . . . .
(Type:
Boolean, Default value:
85
FALSE)
When the TADS option is TRUE, special debugging code and tables are
generated as part of the object code file. The tables are generated to
support the symbolic debugging environment of the ALGOL Test and Debug
System (TADS). For more information on ALGOL TADS, refer tOo the "ALGOL
Test and Debug System (TADS) User's Guide."
The FREQUENCY option causes additional code and tables to be' generated
for coverage and frequency analysis. This option must be specified if
either the TADS "FREQUENCY" command or the TADS "COVERAGE" command is to
be used to determine the number of times individual statements have been
executed or which statements have not been executed.
The REMOTE option allows TADS to share a remote file with the program
being tested.
Sharing a file might be necessary. because only one
remote input file can be open for each station. If specified, the <file
identifier> must correspond to a file identifier declared in a FILE
declaration occurring later in the outer block of the program. The file
must
have the attributes KIND equal to REMOTE. UNITS equal to
CHARACTERS, and FILEUSE equal to 10. The MAXRECSIZE attribute must not
be less than 72. The file must not be declared to be a direct file.
If the AUTOBIND option, the MAKEHOST option. or the SEPCOMP option is
TRUE when the TADS option is assigned the value TRUE, then the TADS
option is assigned the value FALSE and a warning message is given.
Programs compiled with the TADS option equal to TRUE cannot assign TRUE
to the MAKEHOST option, the AUTOBIND option. or the SEPCOMP option, and
they cannot be used as input files to the Binder program.
644
ALGOL REFERENCE MANUAL
The TADS option must
program.
appear
before
the
first
syntactic
item
in
a
<target option>
THIS ------1
-- TARGET -- ;
1
1
1- LEVELO -I
1
1
1- LEVELl -I
1
1
1- B5900 --I
1
1
1- B6800 --I
1
1
1- B6900 --I
1
1
1- B7000 --I
1
1
1- B7700 --I
I
I
- B7800 --I
1
- B7900 --I
-
A 3
----I
-
A 9
i
----I
1
- A 10 ---I
(Type:
Value, Default value:
installation-defined)
The TARGET option specifies the computer family for which the generated
code is to be optimized. The keyword "THIS" indicates that code is to
be optimized for the computer on which it is compiled.
The keyword
"LEVELO"
indicates
that
code
is
to
be
optimized
for the
B 5000/B 6000/B 7000 Series of computers.
The
keyword
"LEVELl"
indicates that code is to be optimized for the A Series of computers.
The generated object code can be run on any computer that
is
code-compatible
with
the specified family.
Table 7-2 indicates
code-compatible families.
645
Compiling Programs
Table 7-2.
Code-Compatible Families
Compatible Families
I Target i--------------------------------------------------------- ----I
i
IB 5900lB 6800lB 6900lB 7000lB 7700lB 7800lB 7900lA 31A 9 A 101
!--------I------I-------I------I------I------I------I------1---1--- ----I
I
1
1
1
I
1
LEVELO
B5900
B6800
B6900
B7000
B7700
I B7800
1 B7900
I LEVELl
x
x
x
x
x
x
1 x
1 x
x
x
x
x
x
x
x
x
1
I
I
1
1
I
x
x
x
x
x
x
x
1
I
I
I
1
I
x
x
x
x
x
x
x
x
x
x
x
x
1
x
1
x
x
I
1
x
x
I
I
x
x
I x
1 x
1 x
I x
1 x
I
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
I x
1 x
I x I x
x
I
I
I
1
1
I
I
x
x
x
x
x
x
x
1
I
i
I
I
I
I
x
IA3
I
I
I
Ixlx
x
IA9
A 10
I
1
Ixlx
x
1
1
1
I
1_ _ _ 1
1_ _
I
_______ I ___
i
x
I
x
I
x
1_1 __
i
1
For information on how an installation defines the default target
computer family, refer to the "CDMPILERTARGET" command in the "Operator
Display Terminal (DDT) Reference Manual."·
This option must appear before the first
syntactical
item in the
program.
It cannot be used in the same program as the B7700 option.
<time option>
-- TIME--I
(Type:
Boolean, Default value:
FALSE)
When TRUE. the TIME option causes trailer information,
such as the
number of errors. the number of code segments, and the compilation time,
to be printed on the printer listing.
Because this trailer information
is also printed when the LIST option is TRUE, the value of the TIME
option is effective only when the LIST option is FALSE.
646
ALGOL REFERENCE MANUAL
<use option>
-- USE --<text>--I
See also
<text>.
(Type:
61
Binder command)
During autobinding, the USE option is passed directly to the Binder
program for analysis.
The format and function of this option are the
same as those of the Binder USE statement and are described in the
"Binder Reference Manual."
When the batch facility is used, the USE option cannot be used.
<user option>
--<identifier>--I
(Type:
Boolean, Default value:
FALSE)
If an identifier on a compiler control record is not recognized as one
of the predefined options, it is considered to be a user option. A user
option can be manipulated exactly like any other Boolean option; that
is, it can be assigned values by using the SET, RESET, and POP keywords.
In addition, it can be used in option expressions to assign values to
standard Boolean options or to other user options.
647
Compiling Programs
<version option>
----<replace version>----I
1
1
I-<append version>--I
<replace version>
-- VERSION --<version increment>-- .
~-<cycle
increment>----------->
>------------------.------------------------------------------------1
I
I
1- . --<patch number>-I
<version increment>
--<digit>--<digit>--j
<cycle increment>
--<digit>--<digit>--<digit>--I
<patch number>
--<digit>--<digit>--<digit>--I
<append version>
-- VERSION -- + ---<version increment>-- . -- + --<cycle increment>->
>-------------------------------------------------------------------1
I
1
.
i- . --<patch number>-I
(Type:
value. Default value:
00.000.000)
The VERSION option allows the user to specify an initial version number
for a program. replace an existing version number, or append to an
existIng version number.
If the NEW option is TRUE. a VERSION option appears in the TAPE file,
and the CARD file contaIns a <repl~ce version> or <append version>, then
the VERSION option record in the NEWTAPE file is updated with the
version. cycle, and patch number in the last VERSION option record in
648
ALGOL REFERENCE MANUAL
the CARD file.
The sequence number of the VERSION option ip the CARD
file must be less than the sequence number of the VERSION option in the
TAPE file.
The functions COMPILETIME(20). COMPILETIME(21). and COMPILETIME(22)
allow a programmer to access the current version. cycle. and patch
numbers.
respectively.
For more
information.
see
"<compiletime
function>" in the chapter ItExpressions."
When the batch facility is used. the VERSION option cannot be used.
See also
<compiletime functIon> . . . . . . . . . . . . . . . . . . . . . 538
Examples
S VERSION 25.010.010
Sets the current version to 25.010.010.
S VERSION +01.+001.010
Increments the current version by 01 in the version increment, by
001 in the cycle increment, and assigns 010 to the patch number.
For example, if the existing version is 25.010.005 and this VERSION
option is compiled. the resulting version is 26.011.010.
<void option>
-- VOID --I
(Type:
Boolean. Default value:
FALSE)
When TRUE. the VOID option causes all source input other than compiler
control records from both the TAPE and CARD files to be ignored by the
compiler until the VOID option is assigned the value FALSE. The ignored
source input is neither listed nor included in the updated source file.
regardless of the values of the LIST option and the NEW option.
Once
the VOID option is assigned TRUE, it can be assigned FALSE only by a
compiler control record in the CARD file.
649
Compiling Programs
<voidt option>
-- VOIDT --I
(Type:
Boolean. Default value:
FALSE)
If the MERGE option is TRUE and the VOIDT option is TRUE. all source
i.nput from the TAPE file is ignored by the compiler until the VOIDT
option is assigned th~ value FALSE. Therefore, while the VOIDT option
is TRUE, only primary source input from the file CARD is compiled. The
ignored input is neither listed nor included in the updated source file,
regardless of the values of the LIST option and the NEW option. Once
the VOIDT option is assigned TRUE, it can be assigned FALSE only by a
compiler control record in the CARD file.
If the MERGE option is FALSE,
the value of the VOIDT option is ignored.
,cwarnsupr option>
-- WARNSUPR --I
(Type:
Boolean, Default value:
When TRUE, the WARNSUPR option
given.
FALSE)
prevents
warning
messages
from
being
<writeafter option>
-- WRITEAFTER --I
(Type:
Boolean, Default value:
FALSE)
The WRITEAFTER option provides the ability to designate whether carriage
contrc~
is performed before or after a write operation. The option can
be assigned values repeatedly in order to select before-write or
after-write carriage control for individual files and I/O statements.
Normally in ALGOL, carriage
operation.
control
is
performed
following
a
write
650
ALGOL REFERENCE MANUAL
If the WRITEAFTER option is TRUE when a FILE declaration is compiled,
then for all I/O statements that explicitly reference the file, carriage
control is done before a write operation.
For any I/O statement
compiled when the WRITEAFTER option is TRUE, carriage control is done
before the write operation.
The WRITEAFTER option does not apply
statements.
to
direct
files
or
direct
I/O
<xdecs option>
-- XDECS --I
(Type: Boolean, Default value: TRUE if either the XREF option
XREFFILES option is TRUE, FALSE otherwise)
or
the
When the compiler is saving cross-reference information because the XREF
option or the XREFFILES option is TRUE, only identifiers declared while
the XDECS option is TRUE are included
in
the
cross-reference
information.
This option is assigned TRUE when the XREF option or the
XREFFILES option is assigned TRUE and can be assigned a value as many
times as desired.
If the XDECS option is assigned the value TRUE and
both the XREF option and the XREFFILES option are FALSE. the XDECS
option is assigned FALSE and a syntax error is given.
For more information on cross-referencing, refer to the
the XREF option in this section.
<xref option>
-- XREF
------------------1
I
1
I-<linewidth>-I
<linewidth>
An <integer> between 72 and 160. inclusive.
(Type:
Boolean. Default value:
FALSE)
description
of
651
Compiling Programs
Depending on the values of several related compiler control options. the
compiler optionally generates cross-reference information containing an
alphabetized list of identifiers that appear in the program and. for
each identifier, the type of the item named by that identifier, the
sequence number of the source input record on which the identifier is
declared, the sequence numbers of the input records on which the
identifier is referenced. and other relevant information. The following
factors can be controlled through the use of compiler control options:
1.
Whether or not the compiler saves cross-reference
as it is processing the source input
2.
Which identj.fiers and which references to these identifiers are
cross-referenced
3.
Whether or not the SYSTEM/XREFANALYZER
automatically by the compiler
4.
If SYSTEM/XREFANALYZER is automatically initiated. whether it
is to produce printed output, disk files suitable for input to
SYSTEM/INTERACTIVEXREF and the Editor, or both
program
information
is
initiated
The compiler saves cross-reference information if either the XREF option
or the XREFFILES option or both options are TRUE. This information is
discarded if any syntax errors occur during compilation. If used, these
options should be assigned TRUE before any source input has been
processed. Once asslgned TRUE. these options cannot be assigned FALSE.
The identifiers and their references to be cross-referenced can be
selected by the XDECS option and the XREFS option. respectively.
Neither of these optlons can be used if cross-reference information is
not being saved by the compiler (that is. if both the XREF option and
the XREFFILES option are FALSE).
When the compiler is
saving
cross-reference
information.
this
information is written to a disk file in raw form. Before this
information can be printed or read by SYSTEM/INTERACTIVEXREF and the
Editor, it must be analyzed by SYSTEM/XREFANALYZER. If the NOXREFLIST
option
is
FALSE.
the
compiler
automatically
initiates
SYSTEM/XREFANALYZER to process the raw cross-reference file. If the
NOXREFLIST option is TRUE, SYSTEM/XREFANALYZER is not initiated, and the
compiler's raw file is left on disk with the title "XREF/<code file
name>". where <code file name> is the name of the object code file
produced by the compiler; this file can be analyzed at a later time by
running SYSTEM!XREFANALYZER directly.
If the compiler initiates SYSTEM/XREFANALYZER (that is.
if
the
NOXREFLIST option is FALSE), the program produces either a printed
listing or a pair of disk files suitable for the
Editor
and
652
ALGOL REFERENCE MANUAL
SYSTEM/INTERACTIVEXREF.
If the XREF option is TRUE, a listing is
produced. If the XREFFILES option is TRUE. the pair of disk files is
produced; these files are titled "XREFFILES/<code file name>/XREFS" and
"XREFFILES/<code file name>/XDECS". If both the XREF option and the
XREFFILES option are TRUE. both a listing and the disk files ar~
produced.
The line width. in
characters.
of
the
listing
produced
SYSTEM/XREFANALYZER can be specified by the <linewidth> construct.
not specified, the line width is 132.
by
If
User options are included in the cross-reference information.
SYSTEM/XREFANALYZER is described under "XREFANALYZER h in the "System
Software Utilities Reference Manual," and SYSTEM/INTERACTIVEXREF is
described under "INTERACTIVEXREF" in the "System Software Utilities
Reference Manual." The Editor is described in the "Editor User's Guide."
<xreffiles option>
-- XREFFILES --I
(Type:
Boolean, Default value:
FALSE)
When TRUE, the XREFFILES option causes cross-reference information to be
saved by the compiler and causes the SYSTEM/XREFANALYZER program. if it
is initiated by the compiler, to produce files that can be used by the
Editor
and
SYSTEM/INTERACTIVEXREF.
These files have the titles
"XREFFILES/<code
file
name>/XDECS"
and
"XREFFILES/<code
file
name>/XREFS", where <code file name> is the name of the object code file
that the compiler is generating.
For more information on cross-referencing, refer to the
the XREF option in this section.
description
of
653
compiling programs
<xrefs option>
XREFS --I
(Type: Boolean, Default value: TRUE if either the XREF option
XREFFILES option is TRUE, FALSE otherwise)
or
the
When the compiler is saving cross-reference information because the XREF
option or the XREFFILES option is TRUE, only identifier references that
are encountered while the XREFS option is TRUE are included in the
cross-reference information. This option is assigned TRUE when the XREF
option or the XREFFILES o~tion is assigned TRUE, and it can be assigned
a value as many times as deSired. If the XREFS option is assigned the
value TRUE when both the XREF option and the XREFFILES option are FALSE,
then the XREFS option is assigned FALSE and a syntax error is given.
For more information on cross-referencing, refer to the
the XREF option in this section.
description
of
<$ option>
-- $ --I
(Type:
Boolean. Default value:
FALSE)
If both the LIST option and the $ option are TRUE. the printer listing
includes all compiler c6ntrol records. If the LIST option is TRUE but
the $ option is FALSE, only compiler control records with an initial
dollar sign ($) in columns 2 through 72, inclusive, appear in the
printer listing. If the LIST option is FALSE, the value of the $ option
is ignored.
655
~
INTERFACE
The library facility is a
processes.
A library is
that can be called by other
programs." These procedures
a regular program~ which is
can be entered at any entry
~Q
THE LIBRARY FACILITY
feature that can be used to structure
a program containing one or more procedures
programs, which are referred to as "calling
are "entry paints" into the library. Unlike
always entered at the beginning, a library
paint.
Libraries provide all the benefits of procedures plus the added
advantages that they can be reused, and they can be shared by a number
of programs. Consolidating logically related functions into a library
can make programmtng easier- and program structure more visible. A call
on a procedure in a library is equivalent to a calIon a procedure in
the calling program.
Libraries offer the following improvements over binding:
1.
Interlanguage communication is significantly improved.
2.
Standard packages of functions
(such
as
plotting
statistics) need not be copied into any calling programs.
and
Libraries offer thE: following improvements over installation intrinsics:
1.
A library can have its own global files, databases. transaction
bases, and so on.
2.
Libraries can contain initialization and termination code.
3.
Libraries can themselves call other libraries.
4.
Individual users can create
possessing special privileges.
their
5.
Libraries can
more
in~tallation
6.
be written
intrinsic$.
in
own
libraries
languages
than
without
can
More than one version Of a library can be in use at a time.
the
656
ALGOL REFERENCE MANUAL
FUNCTIONAL. DESCRIPTION OF LIBRARIES
This section describes how the library facility operates.
Library Programs
A library program is a program that specifies entry points (procedures)
for use by calling programs and is distinguished by the occurrence of
EXPORT declarations and FREEZE statements. A procedure in a library is
specified to be an entry point by appearing in an EXPORT declaration. A
library program becomes a library after execution of a FREEZE statement.
Calling Programs
A calling program is a program that calls entry points provided by a
library and is distinguished by the appearance of LIBRARY declarations
and PROCEDURE declarations that contain the <library entry point
specification> construct.
A library can itself function as a calling program and call other
libraries.
The only restriction is that a chain of library linkages
must never be circular. That is, a library cannot reference itself.
either directly or indirectly. through a chain of library references.
Library Directories and Templates
The information used by the Master Control Program (MCP) to match entry
points in a library with entry points declared in a calling program is
contained in a pair of data structures called the "directory" and the
"template," which are built by the compilers.
When a program exports entry points and contains a FREEZE statement, the
object code file for that program contains a library directory. One
directory exists for each block that contains an EXPORT declaration.
After a library "freezes" (executes a FREEZE statement), only one
directory is in effect until the library program finishes executing.
A library directory contains a description of all the entry points
the library. This description includes the following information:
1.
The name of the entry point
in
657
Interface to the Library Facility
2.
The entry point's type
3.
A description of the entry point's parameters
4.
Information on how the entry point is
Provisions" lat'erin this chapter)
provided
(see
"Linkage
When a program declares a library and entry points in that library, the
object code file for the program contains a library template that
describes the library and the declared entry points.
One template
,exists for each library declared in the calling program. A template
contains the following information:
1.
A description of the attributes of the library
2.
A description of all the entry points of the library that
declared
by the program.
Each description includes
following information:
a.
The name of the entry point
b.
The entry point's type
c.
A description of the entry point's parameters
are
the
The SETACTUALNAME function can b~ used to change the name of an entry
point in an unlinked library template. (For more information, refer to
the SETACTUALNAME function in the chapter "Expressions.")
See also
Linkage Provisions.
<setactualname function> . .
659
575
Library Initiation
On the first calIon an entry point of a library or at an explicit
linkage request. the calling program is suspended. The description of
the entry point in the library template of the calling program is
compared to the description of the entry point with the same name in the
library directory associated witn the referenced library.
If the entry point does not exisi\: in the library, or if the two entry
point descriptions are not compatible. a run-time error is given and the
calling program is terminated. If the entry point exists and the two
entry point descriptions are compatible, the NCP automatically initiates
the library program (if it has not already been initiated). The library
program runs normally until it executes a FREEZE statement. which makes
658
ALGOL REFERENCE MANUAL
the entry points available. All of the entry points of the library that
are declared in the calling program are linked to the calling program.
and the calling program resumes execution.
If a calling program declares an entry point that does not exist in the
library, no error is generated when the library is initiated: however, a
subsequent calIon that entry point causes a "MISSING ENTRY POINT"
run-time error, and the calling program is terminated.
A library can be specified to be permanent or temporary.
A permanent
library remains available until it is terminated either by the Operator
Display Terminal (ODT) commands DS (Discontinue) or THAW, or by
execution of a CANCEL statement. A temporary library remains available
as long as users of the library remain. A temporary library that is no
longer in use "unfreezes" and resumes running as a regular program.
The PERMANENT or TEMPORARY specifications of the FREEZE statement
control the duration of a library. Any running program that executes a
FREEZE statement becomes a library. When a library is initiated by
explicitly running the library program instead of by calling an entry
point, the FREEZE statement should specify PERMANENT. (If TEMPORARY is
specified, the library immediately unfreezes because it has no users.)
After a library unfreezes. it must not execute another FREEZE statement
in an attempt to become a library again.
Because a library program initially runs as a regular program, the flow
of execution can be such that the execution of a FREEZE statement is
conditional and can occur anywhere in the program.
If a calling program causes a library program to be initiated and the
library program terminates without executing a FREEZE statement (for
example, because it was not actually a library program and, thus. had no
FREEZE statement). the attempted linkage to the library entry points
cannot be made, and the calling program is terminated.
Linkage to a library can be explicitly requested by using
the
LINKLIBRARY function, which is described in the cnapter "Expressions."
See also
<linklibrary function> . . . . . . . . . . . . . . . . . . . . . 559
659
Interface to the Library Facility
Linkage Provisions
Entry points declared in a calling program are linked to
entry points provide,d by a library in one of three ways:
1.
Directly
2.
Indirectly
3.
Dynamically
corresponding
The library program specifies the form of linkage. Indirect and dynamic
linkages allow linkage to be established to libraries other than the
library specified by the calling program.
The calling program can
control the library invocation to which it is linked only by specifying
the object code file title or the function name of the library or, for
dynamic linkage, by specifying the LIBPARAMETER library attribute.
Depending on the value of the LIBACCESS library attribute" the TITLE
attribute or FUNCTIONNAME attribute is used to specify the object code
file title of the library. (For a discussion of the library attributes.
refer to "Library Attributes" in this chapter.)
Direct linkage occurs when the library program contains
that is named in the EXPORT declaration of the library.
the
procedure
Indirect linkage occurs when the library program exports a procedure
that" is declared as an entry point of another library. The MCP then
at~empts to link the calling program to this second library, which can
provide the entry point directly. indirectly, or dynamically.
Dynamic linkage allows a library program to determine at link time which
library task the calling program will be linked to. The library program
must provide a selection procedure that accepts the value of the
LIBPARAMETER library attribute asa parameter. Based on the value of
LIBPARAMETER, the s€'lection procedure selects and initiates a library
task.
The selection procedure must ·also acceF~, as a" second parameter.
a procedure. This procedure. which is provided by the MCP to verify
that the library task is valid and complete. must be called before the
selection procedure is exited. The MCP calls the selection procedure at
1 i nk time.
(Ref er to "Library Examples in th i s chaptE?r f or a more
detailed explanation and examples of libraries that provide dynamic
linkage. )
It
660
ALGOL REFERENCE MANUAL
The only restrictions on the complexity of indirect and dynamic linkages
are as follows:
1.
Eventually, some library must provide the entry point directly.
2.
The chain of referenced libraries must never become
See also
Library Attributes . .
Library Examples . .
.
circul~r.
.
.
.
.
• 665
. 671
Discontinuing Linkage
A program can delink from a library program by using either
statement or the DELINKLIBRARY function.
the
CANCEL
The CANCEL statement causes the library program to unfreeze and resume
running as a regular program. The CANCEL statement can be used only on
PRIVATE and SHAREDBYRUNUNIT libraries.
The DELINKLIBRARY function affects only the linkage between the program
executing the DELINKLIBRARY function and the specified library. Any
other programs linked to the specified library are not affected.
(For
more
information, see the DELINKLIBRARY function in the chapter
"Expressions.")
See also
<delinklibrary function> . . . . . . . . . . . . . . . . . . . . 543
Error Handling
Any fault caused (and ignored) by a procedure in a library that is
invoked by a calling program is treated as a fault in the calling
prog~am.
If ignored by the calling program, this fault causes the
calling program to be terminated but has nc effect on the status of the
library.
If a library program faults (or is otherwise terminated) before
executing a FREEZE statement, then all calling programs that are waiting
to link to that library program are also terminated.
661
Interface to the Library Facility
If a library is terminated while calling programs
those calling programs are al~o terminated.
are
linked
to
it.
The first calIon an entry point in a library causes library linkage to
be made.
In this phase, an attempt is made to locate and establish
links to all entry points declared by the calling program. If an entry
point declared in the calling program does not exist in the library. its
linkage cannot be eBtablished. and any subsequent calls to that entry
point result in a "MISSING ENTRY POINT" error. This error continues to
occur whenever a ca11ing program links to that instance of the library
and calls that entry point.
Thus, it is advisable to remove that
instance of the library (by either a THAW or DS (Discontinue) ODT
command) and init:Late a correct version of the library. (For more
information, refer to the "Operator Display Terminal (ODT) Reference
Manual" f or a descr:Lption of these commands.)
662
ALGOL REFERENCE MANUAL
CREATING LIBRARIES
A library program is created by using the EXPORT declaration to declare
procedures to be exported as entry points. and by using the FREEZE
statement.
The duration of a library program following initiation is
controlled by the TEMPORARY or PERMANENT specification of the FREEZE
statement.
The allowed sharing of a library program is controlled by
the SHARING compiler control option. described below.
Library Sharing Specifications
Users of a library can be restricted through the normal file access
features provided by the system. The allowed simultaneous usage of a
library can be specified by the creator of the library at compile time
through the SHARING compiler control option.
The library sharing can be
PRIVATE. SHAREDBYALL, SHAREDBYRUNUNIT, or DONTCARE.
PRIVATE
A separate instance of
the library is started for each
invocation of the library.
Any changes made to global items in
the library by the program unit (block, procedure. or external
task)
invoking the library apply only to that particular
calling program.
SHAREDBYALL
All invocations of the library share the same ins~ance of the
library.
Any changes made to global items in the library by a
program unit that has invoked the library apply to all users of
that library.
SHAREDBYRUNUNIT
A run unit consists of a program and all libraries that are
called,
either directly or indirectly.
by that program.
A
"program." in this context, excludes both a library that is not
frozen and any tasks that are initiated by the program (that
is, a process family is not a run unit).
All invocations of a
library within a run unit share the same instance of the
library.
Note that a library is its own run unit until it freezes.
For
example.
program P initiates library A and. before library A
freezes, it in turn initiates library B.
Now library E is in
library A's run unit, not in program P's run unit.
Had library
A initiated library B after freezing.
both library A and
library B would be in program P'S run unit.
663
Interface to the Library Facility
DONTCARE
The MCP determines the sharing. This determination is
to all users invoking the library.
unknown
The default value of the SHARING compiler control option is DONTCARE.
664
ALGOL REFERENCE MANUAL
REFERENCING LIBRARIES
To use a library. the calling program does the following:
Declares the library in a
attributes of the library
LIBRARY
declaration.
specifying
the
Declares the entry points of
the
library
in
PROCEDURE
declarations with <library entry point specification> parts
When an entry point is invoked or at an explicit linkage request. the
MCP automatically creates the library linkage. If the library program
has not already been initiated, the MCP initiates it; then, when the
library is frozen, the MCP links the library to the calling program.
The MCP attempts to make linkages to all entry points referenced in a
library at the time that the library is first invoked.
The LINKLIBRARY function can be used to determine whether or not the
calling program is currently linked to or is capable of being linked to
a particular library program. If the calling program is not currently
linked but is capable of being linked, the linkage is performed. During
the linkage process, an attempt is made to link to every entry point
exported from the library whose name matches an entry point declared in
the calling program. Only those names that match are checked for
correct function type, number of parameters. and parameter types.
Therefore. the LINKLIBRARY function does not check that every entry
point declared in the calling program is also exported from the library.
(For more information, see the LINKLIBRARY function in the "Expressions"
chapter. )
See also
<linklibrary function> . . . . . . . . . . . . . . . . . . . . . 559
The CANCEL statement and the DELINKLIBRARY function can be used to
terminate the linkage between a calling program and a library. The
CANCEL statement causes the library to unfreeze and resume running as a
regular program regardless of whether it is temporary or permanent.
Only PRIVATE libraries or SHAREDBYRUNUNIT libraries can be canceled.
The DELINKLIBRARY function has no effect on any other users of the
library. (For more information on the DELINKLIBRARY function. refer to
the description of the function in the chapter. "Expressions.")
See also
<delinklibrary function> . . . . . . . . . . . . . . . . . . . . 543
665
lnterf~ce
to the Library Facility
The SETACTUALNAME function determines whether or not the name of a
particular library entry point can be changed in the template to a
particular character string and, if possible, makes the change.
The
name of an entry point of a linked library cannot be modified.
Therefore, a linked library must be delinked before the SETACTUALNAME
function can be called to change the name of any of its entry points.
(For more information. see the SETACTUALNAME function in the chapter
"Expressions.")
See also
<setactualname function> . . . . . . . . . . . . . . . . . . . . 575
Library Attributes
Libraries. like files. have attributes that can be assigned
tested programmatically.
values
and
The calling program can change library attributes dynamically: however.
since the MCP ignores, any changes made to library attributes of linked
libraries, these changes must not be made while the program is linked to
the library.
Any library attribute changes must be made before the
calling program has, linked to the library or after the library has been
del inked from the program.
This seccion describes the library attributes. The first line of each
description tells whether the attribute can be read or written or both;
its type; and its default value, if any.
FUNCTIONNAHE
(Read/Write. EBCDIC string-valued)
FUNCTIONNAME specifies the system function name used to find the
target object code' file for the library. (For more information.
refer to the LIBACCESS attribute.)
INTNAJIE
(Read/Write. EBCDIC string-valued)
INTNAME specifies the internal identifier for the library.
666
ALGOL REFERENCE MANUAL
LIBACCESS .
(Read/Write, mnemonic-valued, Default value:
BYTITLE)
LIBACCESS specifies the way in which .a library object code file is
accessed when a library is called.
LIBACCESS has one of the
mnemonic values BYTITLE or ByFUNCTION. If the value is BYTITLE, the
TITLE attribute of the library is used to locate the object code
file. If the value is BYFUNCTION, the value of the FUNCTIONNAME
attribute of the library is used to access the MCP library function
table, and the Object code file associated with that FUNCTIONNAME is
used.
LIBPARAMETER
(Read/Write, EBCDIC string-valued)
LIBPARAMETER is used to transmit information from the calling
program to the selection procedures of libraries that provide entry
points dynamically.
TITLE
(Read/Write, EBCDIC string-valued)
TITLE specifies the object code file title of the library.
more information, refer to the LIBACCESS attribute.)
(For
667
Interface to the Library Facility
Example
The following program shows examples of how the
FUNCTIONNAME library attributes can be used.
LIBACCESS.
TITLE,
and
BEGIN
% LIBRARYl, DECLARED BELOW, IS NOT A SYSTEM LIBRARY. ITS LIBACCESS
X ATTRIBUTE, SET TO BYTITLE. INDICATES THA1 THE TITLE ATTRIBUTE
% IS USED TO LOCATE THE LIBRARY'S CODE FILE.
LIBRARY LIBRARYl(TITLE="OBJECT/LIBRARYl.",LIBACCESS=BYTITLE);
REAL PROCEDURE PROCl;
LIBRARY LIBRAR.Yl;
REAL PROCEDURE PROC2;
LIBRARY LIBRAR.Yl;
REAL PROCEDURE PROC3;
LIBRARY LIBRARYl;
% THE LIBRARY DECLARED BELOW IS A SYSTEM LIBRARY. ITS LIBACCESS
% ATTRIBUTE. SET TO BYFUNCTION, INDICATES THAT THE FUNCTIONNAME
% ATTRIBUTE OF THE LIBRARY IS LOOKED UP IN THEMCP LIBRARY FUNCTION
,~ TABLE;:, AND THE CODE FILE ASSOCIATED WITH THE FUNCTIONNAME,
% SYSTEMLIB, IS USED.
LIBRARY LIBRARY2(FUNCTIONNAME="SYSTEMLIB.",LIBACCESS=BYFUNCTION);
PROCEDURE SYSTEMLIBPROC;
LIBRARY LIBRAF~Y2;
<executable statements>
END.
668
ALGOL REFERENCE MANUAL
Entry Point
~'Matching
Library entry points can be either typed or untyped, and they can have
parameters.
Type' matching is performed on entry points during library
linkage. If the description of an entry point in the template does not
match the description of the entry point in the directory, the linkage
is not made, and the calling program is terminated. Matching is based
on several factors: the procedure type, the number of parameters, the
parameter types, and the ways in which the parameters are passed.
Parameters
are
passed
as
call-by-value.
call-by-reference, or
call-by-name.
An ALGOL library entry point can be any of the following:
ASCII string procedure
Boolean procedure
Complex procedure
Double procedure
EBCDIC string procedure
Hexadecimal string procedure
Integer procedure
Real procedure
Untyped procedure
The parameters of an ALGOL
following:
library
entry
point
Boolean variable. array, or direct array
Double variable. array. or direct array
Real variable, array. or direct array
Integer variable, array. or direct array
Complex variable or array
EBCDIC string variable or array
ASCII string variable or array
can
be
any
of
the
669
Interface to the Library Facility
Hexadecimal string variable or array
EBCDIC character array or direct array
ASCII
characte~ ~rray
or direct array
Hexadecimal ch.aracter array or direct array
Event variable or array
Task variable or array
File or direct file
Pointer
A fully-specified procedure (declared using "FORMAL")
above restrictions on its possible parameters and type
with
the
Parameter Passing
If a· library program declares a parameter to be call-by-name, the
calling
program
can
declare the parameter to be call-by-name,
call-by-reference, or call-by..,.value. If a library program declares a
parameter to be call-by-reference, the dalling program can declare the
parameter to be call~-by-name, call-by-reference, or call-by-value. If a
library program declares a parameter to be call-by-value. the calling
program can declare the parameter only to be call-by-value.
Table 8-1 illustrates the parameter passing rules.
Table 8-1.
Parameter Passing Rules
1
.
Call ing Program
1
--------------------------------
I
1
Library Program
I
1
Name
I
Reference
I
1
Value
1
I----..,.~--------------I--------I-------------I---------1
I
Name
I
X
I
'
X
1
x,
1
I~-------------------I--~-----I-------------I---------1
'I
Ref erence
I
X
I
.X
I
X
1
I----------~-----~---I--------I-------------I---------1
I
1
Value
I
1
X
1
1
670
ALGOL REFERENCE MANUAL
In ALGOL pr-ograms, parameters are declared to be either call-by-value or
call-by-name.
In ALGOL library programs, parameters to entry points
that are declared to be call-by-value are described in the directory as
call-by-value; parameters declared to be call-by-name are described in
the directory as call-by-reference. except for formal procedures and
Boolean. complex, double, integer, and real variables, which are
described in the directory as call-by-name. In ALGOL calling programs,
parameters to entry points that are declared to be call-by-value are
described in the template as call-by-value; parameters declared to be
call-by-name are described in the template as call-by-reference, except
for Boolean. complex, double, integer. and real variables. which are
descrLbed in the template as call-by-name.
An array parameter in ALGOL that is declared with any of its lower
bounds as an asterisk (*) lower bound is described in the template or
directory as N+l parameters. where N is the number of dimensions of the
formal array. The first parameter is the array itself. followed by the
N lower bounds described as call-by-value integer variables.
671
Interface to the Library Facility
LIBRARY EXAMPLES
This section gives examples of libraries and calling programs that
these libraries.
Library:
call
OBJECT/FILEMN~AGER/LIB
The following library program illustrates dynamic linkage. This library
provides a set of file management routines. The users of this library
would assign the title of the file to be used to the LIBPARAMETER
attribute. LIBPARAMETER is then used at link time to determine to which
library task the user is to be linked.
This library represents features of dynamic
necessarily represent efficient programming.
$ SHARING = PRIVATE
BEGIN
TASK ARRAY LIBTASKS[O:lO]:
PROCEDURE FILEMANAGER(TASKINDEX);
VALUE TASKINDEX;
INTEGER TASKINDEX;
BEGIN
PROCEDURE READFILE:
BEGIN
END READFILE:
PROCEDURE WRITEFILE;
BEGIN
END WRITEFILE:
.
but
does
not
% PROVIDES UP TO 11 DIFFERENT LIBRARY
% TASKS
% LIBPARAMETER FOR EACH OF THE TASKS
STRING ARRAY FILETITLES[O:lO];
EXPORT READFILE.WRITEFILE;
FREEZE(TEMPORARY);
"
FILETITLES[TASKINDEX]
END F I LEMAN AG EJ;~ ;
linkage
.
tt •
672
ALGOL REFERENCE MANUAL
PROCEDURE SELECTION(USERSFILE,MCPCHECK);
VALUE USERSFILE;
EBCDIC STRING USERSFILE;
PROCEDURE MCPCHECK(T); TASK T; FORMAL;
BEGIN
INTEGER TASKINDEX;
BOOLEAN FOUND;
% LOOK ""AT ALL THE FILETITLES. CHECKING TO SEE IF A LIBRARY TASK
% HAS ALREADY BEEN INITIATED FOR FILE TiTLE USERSFILE.
WHILE NOT FOUND AND (TASKINDEX LEQ 10) DO
BEGIN
IF FILETITLES[TASKINDEX] = USERSFILE THEN
FOUND ":= TRUE
ELSE
TASKINDEX := *+1;
END;
IF NOT FOUND THEN
BEGIN
% A LIBRARY TASK DOES NOT EXIST FOR THIS FILE TITLE.
WHILE NOT FOUND DO
% FIND AN UNUSED TASK
BEGIN
TASKINDEX := 0;
WHILE NOT FOUND AND (TASKINDEX LEQ 10) DO
IF LIBTASKS[TASKINDEX].STATUS LEQ 0 THEN
FOUND := TRUE
ELSE
TASKINDEX := *+1;
IF NOT FOUND THEN
% WAIT A SECOND AND MAYBE A LIBRARY TASK WILL GO TO EOT.
WAIT«I»;
END;
PROCESS FILEMANAGER(TASKINDEX) [LIBTASKS[TASKINDEX]];
WHILE LIBTASKS[TASKINDEX].STATUS NEQ VALUE(FROZEN) DO
WAI T ( ( 1 ) ) ;
FILETITLES[TASKINDEX] := USERSFILE;
END;
MCPCHECK(LIBTASKS[TASKINDEX]);
END SELECTION;
673
Interface to the Library Facility
PROCEDURE READFILE~
BY CALLING SELECTION:
PROCEDURE WRITEFILE:
BY CALLING SELECTION;
EXPORT READFILE.WRITEFILE;
FREEZE(TEMPORARY):
END.
At library linkage time. the procedure SELECTION is invoked.
accepts two parameters. USERSFILE and MCPCHECK.
SELECTION
USERSFILE is passed the value of the LIBPARAMETER attribute, which was
assigned a value by the calling program. The SELECTION procedure checks
to see if a library task has been initiiated for the file specified by
USERSFILE.
If it has. then the calling program is linked to that task..
If no library task exists for that file. then a new library task. is
initiated and the calling program is linked to it.
Only one call is made on the SELECTION procedure per linkage: that is,
all links to entry points in this library are resolved duting linkage.
Therefore, any changes made to any library attributes after linkage is
made are ignored.
The attributes can be changed if the library is
delinked.
MCPCHECK is a procedure that is provided by the MCP and must be called
before exiting the SELECTION procedure. The parameter to MCPCHECK is
the task variable of the library task to which the calling program is to
be linked. MCPCHECK verifies that the task is valid and complete. The
actual library linkage is not performed until SELECTION has been exited.
674
ALGOL REFERENCE MANUAL
Calling Program
il
The
following
calling
program
invokes
the
dynamic
library
OBJECT/FILEMANAGER/LIB previously described.
In this example, the user
has set the LIBPARAMETER attribute to "MYFILE", which is the name of the
file to be accessed. At library linkage time, which occurs during the
calIon READFILE, the library procedure SELECTION is invoked. All links
to the library's entry points are resolved during linkage. Changes to
the library attributes are ignored after linkage is made. However,
the
program can delink from the library and change the library attributes
before any re-linking.
BEGIN
LIBRARY L (TITLE="OBJECT/FILEMANAGER/LIB."):
PROCEDURE READFILE;
LIBRARY L;
P~OCEDURE WRITEFILE;
LIBRARY L;
L.LIBPARAMETER .- "MYFILE";
READFILE;
% LINKAGE IS MADE
CANCEL(L):
% LINKAGE IS BROKEN
L.LIBPARAMETER .- "OTHERFILE"; % LIBPARAMETER CAN BE CHANGED·
% BECAUSE THE LIBRARY HAS BEEN
% CANCELED.
WRITEFILE;
END.
% LINKAGE IS MADE AGAIN AND NEW
% VALUE OF LIBPARAMETER IS USED
675
Interface to the Library Facility
Li brary: OBJECT ISAHPL]~/LIBRARY
The f ollowi"ng ALGOL l:l brary. campi led as OBJECT/SAMPLE/LIBRARY, provides
its entry points directly.
BEGIN
ARRAY MSG[0:l20];
INTEGER PROCEDURE FACT(N);
INTEGER N;
BEGIN
IF N LSS 1
FACT .ELSE
FACT :=
END:" % OF
THEN"
1
N * FACT(N FACT
l)~
PROCEDURE DATEANDTIME(TOARRAY,WHERE);
ARRAY TOARRAY[*];
INTEGER WHERE;
BEGIN
REALT:
POINTER PTR;
T .- TIME( 7) ;
PTR .- POINTER(TOARRAY,8) + WHERE:
CASE T. [ 5: 6] OF
BEGIN
0: REPLACE PTR:PTR BY "SUNDAY, " ,
1: REPLACE PTR:PTR BY "MONDAY. " .
2 : REPLACE PTR:PTR BY "TUESDAY. " .,
3 : REPLACE PTR:PTR BY "WEDNESDAY, "
4: REPLACE PTR:PTR BY "THURSDAY, " .
5 : REPLACE PTR:PTR BY "FRIDAY, " .,
6 : REPLACE PTR:PTR BY "SATURDAY, " .
END;
REPLACE PTR BY T.[35:6] FOR 2 DIGITS, "-",
T.[29:6) FOR 2 DIGITS, "-",
T.[47:12] FOR 4 DIGITS, ".
T.[23:6] FOR 2 DIGITS, ":",
.
.
..
.
.
T.[17:6] FOR 2 DIGITS, ":",
T.[11:6] FOR 2 DIG1TS;
END; % OF DATEANDTIME
tI,
/
676
ALGOL REFERENCE MANUAL
EXPORT FACT,DATEANDTIME AS "DAYTIME";
REPLACE POINTER(MSG,8) BY
" - SAMPLE LIBRARY STARTED",
" " FOR 94;
DATEANDTIME(MSG,60);
DISPLAY( MSG);
FREEZE(TEMPORARY);
REPLACE POINTER(MSG,8)+19 BY "ENDED " .
DATEANDTIME(MSG,60);
DISPLAY( MSG);
END.
.
In this library program, two procedures are exported, making them entry
pOints that can be called by calling programs. The two procedures, FACT
and DATEANDTIME, are contained witnin the library program, so they are
provided directly.
In the EXPORT declaration, the procedure DATEANDTIME is given the name
DAYTIME in an AS clause. In the directory built for this library, the
name of this entry point will be DAYTIME. Calling programs must use the
name DAYTIME to call this entry point.
Library: OBJECT/SAMpLE/DYNAMICLIB
The following ALGOL library, compiled as OBJECT/SAMPLE/DYNAMICLIB,
illustrates
dynamic
and indirect library linkage.. This library
references the library OBJECT/SAMPLE/LIBRARY previously described.
BEGIN
TASK LIBITASK,LIB2TASK;
LIBRARY SAMLIB(TITLE=ItOBJECT/SAMPLE/LIBRARY. It );
% ENTRY POINT PROVIDED INDIRECTLY
INTEGE~ PROCEDURE FACT(N);
INTEGER N~
LIBRARY SAMLIB;
% POSSIBLY CALLED BY THE SELECTION PROCEDURE
PROCEDURE DYNLIBl:
BEGIN % PRINTS DATE WITH TIME
LIBRARY SAMLIB( TITLE=ItOBJECT/SAMPLE/LIBRARY."):
% ENTRY POINT PROVIDED INDIRECTLY
PROCEDURE DAYTIME(TOARRAY.WHERE):
ARRAY TOARRAY[*];
INTEGER WHERE;
LIBRARY SAMLIB;
677
Interface to the Library Facility
EXPORT DAYTIME;
FREEZE(TEMPORARY);
END; % OF DYNLIBl
% POSSIBLY CALLED BY THE SELECTION PROCEDURE
PROCEDURE DYNLIB2;
BEGIN % PRINTS DATE WITHOUT TIME.
% ENTRY POINT PROVIDED DIRECTLY
PROCEDURE DAYTIM:E(TOARRAY,WHERE);
ARRAY TOARRAY[*J;
INTEGER WHERE;
BEGIN
REAL T;
T : = TI ME ( 7 ) :
REPLACE POINTER(TOARRAY,8) + WHERE
BY T.[35:6J FOR 2 DIGITS, "_"
·T.[29:6J FOR 2 DIGITS, "-"
T.[47:12J FOR 4 DIGITS;
END; % OF DAYTIME
EXPORT DAYTIME;
FREEZE(TEMPORARY);
END; % OF DYNLIB2
% THE SELECTION PROCEDURE
PROCEDURE THESELECTIONPROC(LIBPARSTR,NAMINGPROC);
VALUELIBPARSTR;
EBCDIC STRING LIBPARSTR:
PROCEDURE NAMINGPROC(LIBTASK); TASK LIBTASK; FORMAL;
BEGIN
IF LIBPARSTR EQL "WITH TIME" THEN
BEGIN
IF LIBITASK.STATUS NEQ VALUE(FROZEN) THEN
PROCESS DYNLIBl [LIBITASKJ;
NAMINGPROC(LIBITASK);
DISPLAY(" *** CALLING DYNLIBI If);
END
ELSE
BEGIN
IF LIB2TASK.STATUS NEQ VALUE(FROZEN) THEN
PR)CESS DYNLIB2 [LIB2TASK];
NAMINGPROC(LIB2TASK);
DISPLAY(" *** CALLING DYNLIB2 ");
END;
END; % OF THE SELECTION PROCEDURE
678
ALGOL REFERENCE MANUAL
% ENTRY POINT PROVIDED DYNAMICALLY
PROCEDURE DAYTIME(TOARRAY,WHERE):
ARRAY TOARRAY[*];
INTEGER WHERE;
BY CALLING THESELECTIONPROC;
EXPORT FACT,
% PROVIDED INDIRECTLY
DAYTIME; % PROVIDED DYNAMICALLY
FREEZE(TEMPORARY);
END.
Calling Program Jl.l.
The following calling program
library described previously.
invokes
OBJECT/SAMPLE/DYNAMICLIB,
the
BEGIN
LIBRARY MYLIB(TITLE="OBJECT/SAMPLE/DYNAMICLIB.");
INTEGER PROCEDURE FAKTORIAL(N);
INTEGER N;
LIBRARY MYLIB(ACTUALNAME="FACT");
PROCEDURE DAYTIME(A,W);
ARRAY A[ *];
INTEGER W;
LIBRARY MYLIB;
REAL T;
ARRAY DATIME[O:120]:
MYLIB.LIBPARAMETER := "WITH TIME":
REPLACE POINTER(DATIME[O],8) BY
" 13 FACTORIAL IS "
FAKTORIAL(13) FOR 12 DIGITS,
" .,
"
DAYTIME(DATIME[*],40);
DISPLAY(DATIME[O]);
END.
In this program, the declaration of the library entry point FAKTORIAL
specifies that the ACTUALNAME of the entry point is FACT.
In the
template built for the library MYLIB, the name of this entry point is
FACT,
so
for
linkage to occur,
the directory of the library
OBJECT/SAMPLE/DYNAMICLIB must contain an entry point named
FACT.
However, within the program.
the entry point is referred to as
FAKTORIAL.
679
~
PHSII INTERFACE
An interface to Burroughs Data Management System II (DMSII) is provided
in the BDMSALGOL (Burroughs Data Management System ALGOL) language. The
BDMSALGOL language is based on Burroughs Extended ALGOL and contains
extensions that enable a programmer to declare and use databases. These
extensions provide the following capabilities:
InVOk.ing a database
Manipulating data through data management statements
Using database items through a mapping syntax
Processing
excep~ions
Programs wiitten in the BDMSALGOL language must
BDMSALGOL
compiler.
Typically,
this
"SYSTEM/BDMSALGOL".
The extensions to ALGOL that
described in this chapter.
mak.e
up
the
be compiled with the
compiler
is
titled
BDMSALGOL
language
are
680
ALGOL REFERENCE MANUAL
INVOKING A DATABASE
9.1
DATABASE DECLARATION
Like all variables. a database must be declared in a BDMSALGOL program
before it is referenced.
However, a DATABASE declaration is unlike
other declarations in that it is actually an invocation of a database
that has already been fully· described and declared in a Data and
Structure Definition Language (DASDL) program.
If the compiler control options LIST and LISTDB, are both TRUE, all
invoked structures, together with the record formats, item and key
descriptions, database titles. and other pertinent information, are
written on the program listing. The LISTDB option should be used, and
the resulting information studied carefully. when database application
programs are being develope'd.
For more information on the LISTDB
option, see "BDMSALGOL Compiler Control Options" in this chapter.
See also
<listdb option> . . . . . . . . . . . . . . . . . . . . . . . . 772
Syntax
<database declaration>
-- DATABASE --<database reference>--I
<database reference>
-------------------------------------------------------------------)
I
1- <internal name>
=
1
-I 1- <logical database name> OF
-I
>-<database name>--------------------------------------------------)
I
I
1- ( TITLE = "<database title>" ) -I
)-------------------------------------------------------------------1
1
1
1
1-
I
1<----------- . -----------1 1
I
i
i
-----<data set reference>-----I
1
1
j-<set reference>------I
681
DMSII Inte:rface
.; internal name>
--<BDMS identifier>--l
<logical database name>
--<BDMS identifier>--I
<database name>
--<BDMS identifier>--I
<database title>
A properly formed <file title constant> (as defined in the "Work
Flow Language (WFL) Reference Manual") that has only one node: that
lS. that contains no slashes (/).
<data set reference>
---------------------------<data set name>-----------------------I
1
1
1- <internal name> =
1
<data set name>
--<BDMS identifier>--I
<set part>
---------------------------1
i
NONE -----------------------1
ALL
i-
1<-------
•
I
------1 1
I
1
1
SET ------<set reference>---I
I
1- SETS -I
j-
<set reference>
---------------------------<set
I
1- <internal name> = -!
1
1- ( <set part> ) -I
-I
name>~-I
682
ALGOL REFERENCE MANUAL
<set name>
--<BDMS identifier>--I
See also
<BDMS identifier) . . . . . . . . . . . . . . . . . . . . . . . 691
Semantics
A DATABASE declaration declares a database and specifies which database
or which parts of a database are to be invoked.
If no <data set
reference> parts and no <set reference> parts are specified in a
DATABASE declaration, then all data sets and all sets for each data set
are implicitly irivoked.
The <internal name> construct assigns an internal name by which a
database, data set, set. or subset is known within the program. When an
internal name is specified, all subsequent references to the structure
must use this internal name.
A database, data set, set, or subset can be invoked more than once;
however,
the external name (the name in the description file) can be
used to reference only one invocation of a structure.
Internal names
must be used to provide unique names for all other invocations of a
structure. The default internal name of a structure is its external
name.
By using the internal names in the <data set reference> or the <set
reference> constructs. multiple record areas or set paths can be
established.
Thus,
several records of a single data set can be
manipulated simultaneously.
The <logical database name> construct allows the program to reference a
~ogical
database.
A program can invoke structures selectively from a
logical database.
or it can invoke the entire logical database.
Selective invocations are specified in the same manner as for physical
databases: however,
the choice of
structures is limited to those
structures included in the logical database.
The <database name> gives the
invoked.
external
name
of
the
database
to
be
683
DMSII Interface
The <database title> construct is an alphanumeric string. The usercode,
if any,
is the usercode of the control file.
The single node of the
title is the directory node under which the database files are stored.
The family name,
if anYt is the family name of the control file.
The
default database title is the external name of the database plus the
control file usercode. and family name, if any. from the description
file.
When opening the database,
the Master Control Program (MCP)
builds the control file title from the database title specified in the
declaration. See the "DMSII DASDL Reference Manual" for a discussion of
control files and description files.
This title equation is used only at run time, and cannot be used at
compile time to specify the title of the database description file.
The
primary use of the <database title> construct is for modeling. See the
"DMSII DASDL Reference Manual" for a description of modeling.
The <data ~et reference> construct specifies a particular data set from
the declared database.
If a
<data set reference> is used, only the
specified structures are invoked. A data set reference must be used to
invoke a disjoint data set.
The <data set name> construct gives the external name of the data set to
be invoked.
The <set part> construct invokes specific sets from the data set
declared in the <data set reference> that contains it.
If the <set
part> construct is omitted, ~ll sets are implicitly invoked.
If the
<set part> construct is used, all sets (ALL), no sets (NONE). or only
the specified sets are invoked.
The <set reference> construct establishes a set that is not implicitly
associated with any particular record area. To load a record area using
the set name specified in a set reference, The "<data set> VIA" form of
the <selection expression> must be used.
The <set name> construct gives the
invoked.
ex~ernal
name
of
the
set
to
be
684
ALGOL REFERENCE MANUAL
Pragmatics
Only disjoint structures can be explicitly invoked. Embedded data sets,
sets. and subsets are always implicitly invoked if their master data
sets are (implicitly or explicitly) invoked. When a data set containing
an embedded set associated with a disjoint data set is invoked, or a
data set containing a link to another. disjoint data set is invoked, then
a path is established. However. the user must invoke the disjoint data
set if it is to be used.
Multiple invocations of a structure provide multiple record areas or set
paths. or both. so that several records of a single data set can be
manipulated simultaneously. Selecting only needed structures for UPDATE
and INQUIRY provides better use of system resources; a smaller Structure
Information Block (SIB) is required, ·and fewer files can be opened.
If remaps are declared in DASDL, they
conventional data sets.
ar~
invoked in the same manner
as
Examples: Simple Database
The following examples apply
following DASDL description:
to
the
database
DB
described
by
the
D DATA SET (
K NUMBER (6) ;
R NUMBER ( 5 ) :
);
Sl SET OF D KEY K:
S2 SET OF D KEY R;
DATABASE DB: D
This declaration establishes one current record area for the data
set D. one path for the set Sl of data set D, and one path for the
set S2 of data set D. The statements "FIND SlIt, "MODIFY SlIt, "FIND
S2", and "MODIFY S2" automatically load the data into the D record
area.
'685
DMSIIlnterface
DATABASE DB: D. X=D (NONE)
This declaration establishes two current record areas (D and X) and
two paths (81 and S2). The sets 81 and S2 are implicitly associated
with the D record area . . The set part NONE prevents a set from being
associated with· X.
Thus, the statements "FIND SIll and "FIND S2"
load the D record area. The statements "FIND X VIA Sl" and "FIND X
VIA S2 11 must be executed to load the X record area using ~ set.
DATABASE DB: D. X=D
Thi·s declaration shows how multiple current record areas and
multiple current paths can be established. The statement "FIND Sl
OF ·D II loads the D record area.without disturbing the path 81 OF X,
and the statement "FIND SI OF XII loads the X record area without
disturbing the path Sl OF D. Qualification of Sl is necessary to
distinguish the paths.
DATABASE DB: D (SET Sl), X=D (SETSl). Y=D (NONE)
This declaration shows how more current record areas than paths can
be established.
Three record areas (D, X, and Y) are established.
but only two paths (81 OF D, and Sl OF X). The program must execute
the statement "FIND Y VIA 81 OF D", "FIND Y VIA S1 OF X", or "FIND
Y" to load the Y record area.
DATABASE DB: X=D (SET SI), Y=D (SET T=SI)
This declaration uses the <set part> syntax to explicitly associate
a set with a given work area. The statement "FIND Sl" loads the X
record area. and the statement "FIND T" loads theY rebord area. Sl
and T both use the same key.
DATABASE DB:
D~
SY=Sl
This declaration shows how a set reference can be used to establish
a set that is not implicitly associated with any particular record
area. The statement "FIND D VIA 8Y" must be executed to load a
record ~rea using ~he set SI.
68t.
ALGOL REFERENCE MANUAL
Example: Invok.ing Disjoint Data Sets
The following example shows when a data set reference must be used to
invoke disjoint data sets.
The database DB is described by the
following DASDL description:
F DATA SET (
FI NUMBER ( 4 ) ;
):
E DATA SET (
EK NUMBER ( 8) :
)
:
D DATA SET (
A NUMBER (6);
SE SET OF E KEY EK;
LINK REFERENCE TO F;
) :
If data set references are not specified to invoke E and F.
declaration
as
in
the
DATABASE DB: D
the paths are established by invok.ing the embedded set SE and the link
item LINK.
However. these paths cannot be used unless data set
references for E and F are specified to establish record areas
associated with these paths. as in the declaration
DATABASE DB: D.E,F
687
DMSII Interface
Example: Invoking a Logical Database
In this example, the database EXAMPLEDB is described
DASDL description:
Dl DATA SET
A REAL:
B NUMBER (5)::
C ALPHA (10)::
):
SIA SET OF DI K~Y IS A:
SIB SET OF Dl KEY IS (A.B~C);
L
DATA SET (
X FIELD (8);
Y NUMBER (2) ':
Z REAL;
E DATA SET (
VI REAL;
V2 ALPHA (2);
):
SE SET OF E KEY IS VI;
):
S2A SET OF D2 KEY IS X;
S2B SET OF D2 KEY IS (X,Y,Z);
LDBI DATABASE (Dl(NONE), D2(SET S=S2A»:
LDB2 DATABASE (Dl(SET Sl=SlB). D2(SET S2=S2B»;
LDB3 DATABASE (D~D2):
by
the
following
688
ALGOL REFERENCE MANUAL
The following BDMSALGOL program invokes the logical database LDBl of
EXAMPLEDB.
The program can see data sets DI and D2, but not any bf the
sets associated with DI. and can see only set S2A associated with D2.
S2A appears as set S.
The output produced by the LISTDB compiler
control option is shown with the program.
$ SET LIST LISTDB
. BEGIN
DATABASE LDBl OF EXAMPLEDB;
*DATABASE TITLE: EXAMPLEDB ON DISK
*01 DI: DATA SET (#2)
INVOKED SETS:
*
RECORD ITEMS:
*
*02
REAL A
*02
INTEGER B: NUMBER (5)
*02
STRING C: ALPHA (10)
*01 D2: -DATA SET (#5)
INVOKED SETS:
*
S (#8, AUTOMATIC), KEY = X
*
RECORD
ITEMS:
*
*02
REAL X: FIELD (8)
*02
INTEGER Y: NUMBER (2)
*02
REAL Z
*02
E: DATA SET (#6)
INVOKED SETS:
*
SE (#7, AUTOMATIC). KEY = Vl
*
RECORD ITEMS:
*
*03
REAL VI
*03
STRING V2: ALPHA (2)
*DESCRIPTION TIMESTAMP: 06/09/82 @ 17:30:34
END.
689
DMSII Interface
DATABASE EOUATION
The term "database
E~quation"
refers to three separate operations:
1.
Specification of database titles during compilation.
2.
Work Flow Language (WFL) database equation
to
override
compiled-in titles. (For more information, refer to the "DMSII
User Language Interface Software Operation Guide" for the WFL
syntax. )
3.
Run-time manipulation of database titles.
To take advantage of the te-entrance capability of the Accessroutines,
the user must be able to specify the title of a database at run time.
Database equation allows the database title to be specified at run time.
and allows access to databases tnat are stored under other usercodes and
on families that are not visible to a task.
Database equation is operationally similar to file equation.
WFL
database equation overrides the specification of a database title in the
DATABASE declaration. and run-time modification of a database title
overrides both WFL database equation and the DATABASE declaration.
However. database equation differs from file equation in that a run-time
error results if a BDMSALGOL program attempts to assign a value to or
examine the TITLE attribute of a database while it is open.
For an
explanation
of the TITLE database attribute. refer to "DATABASE
Declaration" in this chapter.
The following syntax shows how the database
manipulated during program execution.
TITLE
attribute
can
be
Syntax
<database attribute assignment statement>
--<string-valued database attribute>-- := --<string expression>--!
<string-valued database attribute>
--<internal name>-- . -- TITLE
--j
See also
<internal name> . . . . . . . . " . . . . . . . . . . . . . . . 681
690
ALGOL REFERENCE MANUAL
Semantics .
The string expression must evaluate
database title.
to
a
string
in
the
form
of
a
The <string-valued database attribute> construct can be used anywhere
string expression is valid.
a
Database titles never end with a period, and a replace pointer-valued
attribute statement is not valid for making assignments to database
titles.
NOTE
BDMSALGOL programs employing
database
equation must be compiled with a Mark 3.2
or later BDMSALGOL compiler.
Example
BEGIN
STRING S:
DATABASE MY DB (TITLE="LIVEDB n
OPEN UPDATE MYDB;
);
CLOSE MYDB:
MYDB.TITLE := "(UC)TESTDB ON TESTPACK";
OPEN UPDATE MYDB;
CLOSE MYDB;
S := TAKE(MYDB.TITLE.5);
END.
In this example, the first BDMS "OPEN" statement opens the database with
the title "LIVEDB". whose data and control files are stored under the
user's directory.
The second OPEN statement invokes the database
"TESTDB", whose files are stored on TESTPACK under the usercode UC.
691
DMSII Interface
9.2
BDMSALGOL BASIC LANGUAGE
CONS~RUCTS
The following constructs are used within the DATABASE declaration and in
data management statements and functions. These sections describe the
forms of names for databases. 'data sets. sets. items. and so on; input
mapping and output mapping; and the selection expression.
9.2.1
BDMS IDENTIFIERS AND OUALIFICATION
Naming conventions in DASDL for databas~s and their components follow
COBOL rules: that is. names can contain hyphens. and,some item and
structure names can require qualification.
Although both of these
conventions contradict normal ALGOL naming rules. they must be allowed
in programs that declare and use databases.
BDMS IDENTIFIERS
The identifier of a database. datp set. set, item, and so on is
form of a <BDMS identifier>.
in
the
Syntax
<BDMS identifier>.
1<----- - -----1
1
1
----<identifier>----I
Semantics
The <BDMS identifier> construct must be "fewer than 64 characters long.
Examples
If a database is described in DASDL by the following:
D-S DATA SET
A-l NUMBER (5):
A-2 NUMBER (10');
)
:
692
ALGOL REFERENCE MANUAL
then in a eDMSALGOL program. the data set D-S and the items A-l and
can be· referenced as in the following examples:
INTEGE~
A-2
I;
GET D-S (I := A-l);
PUT D-S (A-2 := I):·
IDENTIFIERS OF OCCURRING ITEMS
If an item is declared in the DASDL description to have an OCCURS
clause, then its identifier must be subscripted to denote which of its
occurrences is to be used.
Syntax
<subscripted, BDMS identifier>
1<----------- , ----------1
1
1
--<BDMS identifier>-- [ ---·<arithmetic expression>--- ] --I
Semantics
The leftmost arithmetic expression denotes the subscript of
the
outermost OCCURS clause that affects the item. the next arithmetic
expression to the right denotes the subscript of the next outermost
OCCURS clause, and so on.
693
DMSII In:terface
Examples
If items A and B are described in DASDL as follows:
DS DATA SET (
G GROUP (
A ALPHA (l 0 ) :
B NUMBER (4) OCCURS 3 TIMES:
)
OCCURS 2 TIMES;
);
there are two occurrences of A, denoted
A[ 1 J
A[2]
and there are six occurrences of B, denoted
B[l,lJ
B[1,2J
B[ 1,3]
B[2.1]
B[2.2J
B[2.3]
QUALIFICATION
Database item names need not be unique within a database. Qualification
is used to distinguish between database items with the same names.
Syntax
<qualification>
1<---------------
OF
--------------~I
I
I
------<BDMS identifier>------------------\
I
\
\-<subscripted BDMS identi£ier>-!
Semantics
An item name can be qualified by the name of any structure that
physically contains the item. Any number of qualification names desired
can be used. provided that the result is unique.
If improper or
insufficient qualification is used. a syntax error is given.
694
ALGOL REFERENCE MANUAL
A set name·can be qualified by the name of the data set it spans.
A group name can be used to qualify an item it contains.
Qualification need not be used if the unqualified name is unique.
Qualification must be used whenever there is ambiguity. A variable name
can be declared with the same name as a database item in BDMSALGOL
without requiring qualification of the item name.
Examples
If a database is described in DASDL as follows:
DSl DATA SET (
N NUMBER (4);
);
DS2 DATA SET (
N NUMBER (4);
);
then the following BDMSALGOL statements indicate how qualification
used to distinguish between the two data items named N.
SET N OF DSl TO NULL;
SET N OF DS2 TO NULL;
is
695
DMSII Interface
9.2d
REFERENCING DATABASE ITEMS
The record area (user work area) is not directly accessible to a
BDMSALGOL program.
Instead, an explicit mapping between database data
items and program variables must be specified whenever access to those
items is desired.
Mappings specify the source and destination of data to be transferred
into or out of a user work area. Mappings are of two kinds: input
mappings and output mappings.
Example
If a database is dt?scribed in DASDL by the following:
Dl DATA SET (
A NUMBER (5);
x NUMBER (5) OCCURS 3 TIMES;
);
then the items of data set Dl can be referenced in the following ways:
INTEGER B,Yl,Y2,Y3;
% THE FOLLOWING STATEMENT TRANSFERS THE VALUE OF DATABASE ITEM A
% TO THE LOCALLY DECLARED INTEGER B.
GET Dl (B : = A);
% THE FOLLOWING STATEMENT TRANSFERS THE VALUE OF LOCALLY DECLARED
% INTEGER B TO THE WORK AREA FOR Dl.
PUT Dl (4 := B);
% THE FOLLOWING STATEMENT TRANSFERS THE VALUES OF ALL THREE
% OCCURRENCES OF X INTO Yl, Y2, AND Y3.
GET Dl (Yl .- X[l],
Y2 .- X[2],
Y3 .- X[3]);
% THE FOLLOWING STATEMENT TRANSFERS THE VALUES OF LOCALLY DECLARED
% INTEGERS Yl, Y2, AND Y3 INTO THE THREE OCCURRENCES OF DATABASE
% ITEM X.
PUT Dl (X[l] .-- Yl,
X[2] .-- Y2,
X[3] .-- Y3);
696
ALGOL REFERENCE MANUAL
INPUT MAPPING
Input mappings can be used with the "retrieval" statements DELETE, FIND,
GET. BDMS "LOCK." and MODIFY. Input mappings transfer the value of a
DASDL-declared data item to a program variable. If the data item is an
occurring item (that is. if the item is declared in DASDL with an OCCURS
clause), it must be subscripted appropriately.
Syntax
<input mapping>
1<-------- , --------1
I
I
----<input assignment>----I
<input assignment>
----<arithmetic variable>-- .- ---<count item name>----------I
I
I
1
I-<field item name>-------I
I
I
I
1
I-<numeric item name>-----I
I
I
I
I
I
I-<population item name>--I
I
I
I
I-<real item name>--------I
I
I
I-<record type item name>-I
I
I-<Boolean variable>-- .- --<Boolean item name>---------I
I
I
I-<pointer variable>-- .- ---<alpha item name>----------I
I
I-<group item name>----------I
1
I-<numeric item
I
name>~-------I
697
DMSII Interface
<alpha item name>
<Boolean item name>
<count item name>
<field item name>
<group item name>
<numeric item name>
<population item name>
<real item name>
<record type item name>
----<BDMS identifier>----------------I
!
!
!-<subscripted BDMS identifier>-I
See also
<arithmetic variable>
<BDMS identifier> .
<Boolean variable>. . .
. .... .
<pointer variable>. _ . . . . . .
<subscripted BDMS identifier> . . . . .
.
· 225
· 691
234
· 241
. 692
Semantics
An arithmetic variable can be an integer. real, or double simple or
subscripted variable.
A Boolean variable can be a Boolean simple or
subscripted variable. A pointer variable can be a pointer identifier or
an element of a character array_
<arithmetic variable> := <field item name>
If the field item is defined to contain N bits, then N bits are stored
right-justified in the arithmetic variable. All other bits are set to
zero.
<arithmetic variable> := <numeric item name>
<arithmetic variable> := <real item name>
The numeric item or real item is converted into a binary value with a
scale factor of zero (its true value). The value is stored in the
arithmetiC variable as in a normal arithmetiC assignment: that is, it is
integerized or extended~ if necessary. An error termination results if
necessary integerization is not possible, as in normal ALGOL arithmetic
assignments.
698
ALGOL REFERENCE MANUAL
<arithmetic variable> := <count item name>
<arithmetic variable> := <population item name>
<arithmetic variable> .- <record type item name>
The value of the count item, population item, or record type item is
placed in the arithmetic variable.
Use of a count item, population
item, or record type item allows read-only access to the particular
field.
Those items cannot be Changed directly. They are accessed only
through input mappings, and cannot be used in output mappings.
<Boolean variable> := <Boolean item name>
The Boolean variable is assigned the truth value (the value of bit 0) of
the Boolean item. Bits 1 through 47 of the Boolean variable are set to
zero.
<pointer variable> .- <alpha item name>
<pointer variable> .- <group item name>
If the alpha item or group item is defined to contain N EBCDIC
characters, then N characters are transferred to the location pointed to
by the pointer variable. A fault results if one of the following
conditions is satisfied:
1.
The pointer is uninitialized.
2.
The pointer is not an EBCDIC (8-bit) pointer.
3.
Fewer than N character
array.
positions
remain
A group item is treated as if it were an alpha
data items are transferred without change.
in
item;
the
all
referenced
subordinate
699
DMSII Interface'
<pointer variable> .-- <numeric item name>
This assignment takes advantage of the fact that a numeric item 1s
maintained as a hexadecimal string. 'If the numeric item is defined to
contain N digits (including the sign digit, if specified). the N
hexadecimal characters are transferred to the location pOlnt'ed to by the
pointer variable. A fault results if one of the following conditions is
satisfied:
1.
The pointer is uninitialized.
2.
The pointer is not a hexadecimal
3.
Fewer than J~ hexadecimal
referenced array.
(4~bit)
character
pointer.
positions
remain
in
the
700
ALGOL REFERENCE MANUAL
OUTPUT lAPPING
Output mappings can be used with the "storage" statements PUT and STORE.
Output mappings transfer the value of a program variable or expression
to a DASDL-declared data item. If the data item is an occurring item
(that is, if the item is declared in DASDL with an OCCURS clause), it
must be subscripted appropriately.
syntax
<output mapping>
1<--------- , --------1
I
I
----<output assignment>----I
<output assignment>
----<field item name>----- := --<arithmetic expression>----I
I
I
j-<numeric item name>-I
I
I
I
I
I-<real item name>----I
I
I
I
I-<Boolean item name>-- := --<Boolean expression>-----I
I
i
I-<alpha item name>----- := ---<pointer expression>---I
I
I
I
I-<group item name>---j
I-<string literal>-------I
I
1
I-<numeric item name>-I
See also
<alpha item name> .
<Boolean item name> . .
<field item name> . . .
<group item name> . . .
(numeric item name>
<numeric item name>
<real item name> . . . .
.
.
·
·
·
. .
·
·
. .
697
697
697
697
697
697
697
701
DMSII Int:erface
Semantics
An arithmetic expression used
precision or double precision.
in
an
output
mapping
can
be
single
<field item name> := <arithmetic expression>
If the field item is defined to contain N bits, then the N rightmost
bits of the value of the arithmetic expression are assigned, unaltered.
to the field item. Care should be taken if the arithmetic value is real
or double precision. (that is~ not integer) because the value might be
normalized. in which case the N rightmost bits would not contain the
value.
<numeric item name> ::= <arithme.tic expression>
<real item name>
::= <arithmetic expression>
The value of the arithmetic expression is scaled appropriately and
assigned to the numeric item or real item. If the numeric item or real
item is unsigned, the absolute value of the arithmetic expression is
used.
<Boolean item name> ::= <Boolean expression>
The truth value (the value of bit 0) of the Boolean expression is
assigned to the Boolean item. Bits 1 through 47 of the value of the
Boolean expression are ignored.
<alpha item name> := <pointer expression>
<group item name> .- <pointer expression>
If the alpha item or group item is defined to contain N EBCDIC
characters, then N characters are transferred from the location pointed
to by the pointer expression to the alpha or group item.
A fault
results if any of the following conditions is satisfied:
1.
The value
pointer.
of
the
pointer
expression
2.
The value of the pointer expression is not
pointer.
an
EBCDIC
3.
Fewer than N character
array.
in
the
positions
remain
is
an
uninitialized
(8-bit)
referenced
702
ALGOL REFERENCE MANUAL
<numeric item name> .- <pointer expression>
This mapping takes advantage of the fact that a numeric item is
maintained as a hexadecimal string. If the numeric item is defined to
contain N digits (including the sign digit. if specified), then N
hexadecimal characters are transferred to the numeric item from the
location pointed to by the pointer expression. The user is responsible
for ensuring that the string is a valid representation of the item
declared in DASDL~ that is. the proper sign and numeric characters, in
the proper format, must be used.
A fault results if any of the
following conditions is true:
1.
The value
pointer.
of
the
pointer
2.
The value of the
(4-bit) pointer.
3.
Fewer than N hexadecimal
referenced array.
pointer
expression
expression
character
is
is
an
not
positions
uninitialized
a
hexadecimal
remain
in
the
<alpha item name>. <string literal>
<group item name> .- <string literal>
The string literal is transferred to the alpha item or group item.
The
string literal must be EBCDIC, or a syntax error results. If the string
literal is shorter than the alpha item or group item. it is extended
with blank fill characters on the right. If the string literal is
longer than the alpha item or group item, the excess characters on the
right are truncated.
<numeric item name> .- <string literal>
The string literal is transferred to the numeric item.
The string
literal must be a hexadecimal string and must contain the exact number
of characters for the numeric item or a syntax error results. The user
is responsible for ensuring that the string literal is a valid
representation of the numeric item.
703
DMSII Interface
%HE SELECTION
~.2.3
~PRESSION
A selection expression is used in DELETE, FIND, BDMS "LOCK," and
statements to identify a particular record in a data set.
Syntax
<selection expression>
--------------------------<set selection expression>----I
1
1
[-<data set>-- VIA -I
1
1
I-<link item>----------------I
1
I-----------<data set>-----------------------------I
1
1
1- FIRST -I
1
1- LAST --I
1
1
1- NEXT --I
I
1
1- PRIOR -I
<data set>
--<qualification>--I
<set selection expression>
----------------<s.et>------------------~------------------1
1
1
1- FIRST -I
1
1
1
1- LAST --I
1
1
1- NEXT
1
I
I-<subset>-I
!
1- PRIOR-:
<set>
--<qualification>--:
1
I
1- AT ------<key condition>-I
1
1
1- WHERE -I
MODIFY
704
ALGOL REFERENCE MANUAL
<subset>
--<qualification>--I
<key condition>
1<-----------------
AND
----------------1
I
1
1
1(- OR --I
1
1
1
1
1
------<numeric relation>---------------------I
I
I-<alphanumeric relation>-----------i
1
1--------- (
1
1
--<key condition>-- ) -I
1
1- NOT -I
<numeric relation>
----<numeric item identifier>---<relational operator>-------------->
I
I-<field item identifier>---I
1
I
I-<real item identifier>----I
>---<arithmetic expression>----------------------------------------I
1
1
I-<pointer expression>----I
<numeric item identifier>
<field item identifier>
<real item identifier>
--<BDMS identifier>--I
<alphanumeric relation>
--<alpha item identifier>--<relational operator>------------------->
>---<constant string expression>-----------------------------------I
i-<pointer expression>---------I
<alpha item identifier>
--<BDMS identifier>--i
\
705
DMSII Interface
<link item>
--<qualification>--!
SE?e also
<BDMS identifier> . . . . . .
<constant string expression> . .
<qualif ication > . . .
<relational operator> . . . .
. 691
• 525
693
. . • 493
. .
Slemantics
A set selection expression selects the record to which the set path
refers. A NOT FOUND exception is returned if the record has been deleted
or if the path does not refer to a valid current record.
The construct h<data set> VIA h identifies the record area and current
path to be affected if the desired record is found. This option is used
for link items and for sets that are not implicitly associated with the
data set.
The <link item> form is used to specify a link item defined in the DASDL
description.
The record to which the link item refers is selected. An
exception is returned if the link item is NULL.
The <data set> form is used to select the record to which the data set
path refers.
A NOTFOUND exception is returned if the record has been
deleted or if the path does not refer to a valid current record.
The word "FIRST" selects the first record in the specified data set,
set. or subset. If a key condition is also specified, the first record
of the specified set or subset that satisfies the key condition is
selected. FIRST is assumed by default.
The word "LAST" selects the last record in the specified data set, set.
or subset. If a key condition is also specified, the last record of the
specified set or subset that satisfies the key condition is selected.
The word "NEXT" selects the next record relative to either the set path
(if a set or subset is specified) or the data set path (if a data set is
specified). If a key condition is also specified, the next record
(relative to the current path) of the specified set or subset that
satisfies the key condition is selected.
706
ALGOL REFERENCE MANUAL
The word "PRIOR" selects the prior record relative to either the set
path (if a set or subset is specified) or the data set path (if a data
set is specified). If a key condition is also specified. the prior
record (relative to the current path) of the specified set or subset
that satisfies the key condition is selected.
In a set selection expression, the <set> or <subset> construct selects
the record to which the set or subset path refers. A NOT FOUND exception
is returned if the record has been deleted or if the path does not refer
to a valid current record.
The words "AT" or "WHERE" indicate that a key condition follows.
WHERE are synonyms.
AT and
A key condition specifies values used to locate specific records in a
data set referenced by a particular set or subset~ If the name of a
data item specified in a key condition is not unique, the compiler
provides implicit qualification through the set or subset of the set
selection exp~ession. Qualification of the item name by the name of the
data set that contains the item. while not necessary, is allowed;
however, the compiler handles this qualification as documentation only.
The expressions that appear in
transaction item references.
a
key
condition
cannot
contain
any
A numeric relation specifies a particular numeric, field, or real item
and compares it to the value of an arithmetic expression or a pointer
expression. The pointer expression must evaluate to a hexadecimal
pointer.
An alphanumeric relation specifies a particular alpha item and compares
it to the value of a constant string expression or a pointer expression.
The pointer expression must evaluate to an EBCDIC pointer. The constant
string expression must be an EBCDIC string.
Examples
These examples use the database described in DASDL by the following:
D DATA SET (
A ALPHA (3);
N NUMBER (5);
);
S SET OF D KEY IS N, DATA A:
707
DMSII Interface
LOCK S WHERE N NEQ 10
This LOCK statement acts upon the first S where the value
not equal to 10.
FIND S AT A = "ABC" AND (N = 50 OR N
of
N
is
90)
This statement locates the first S where A is equal to
"ABC" and either N is equal to 50 or N is equal to 90.
the
string
708
ALGOL REFERENCE MANUAL
9.3
BDMSALGOL STATEMENTS
The following data management statements allow a BDMSALGOL program to
use and manipulate the data in a database.
These statements are
described in this section.
<assign statement>
<begintransaction statement>
<BDMS close statement>
<create statement>
<delete statement>
<dmterminate statement)
<endtransaction statement>
<find statement>
<BDMS free statement>
<generate statement>
<get statement>
<insert statement>
<BDMS lock statement>
<midtransaction statement>
<modify statement>
<BDMS open statement>
<put statement>
<recreate statement>
<remove statement>
<BDMS set statement>
<store statement>
709
DMSII Interface
ASSIGN
ASSIGN STATEMENT
The ASSIGN statement E~stablishes a link from one record in a data set to
another record of the same data set. It assigns either the value of the
current record in a data set or the value in a link item to another link
item.
The value of the second link item, called the target link ~tem.
then allows the system to locate the record in the referenced data set.
The ASSIGN statement.is effective immediately, therefore the record
containing the target link item does not need to be stored unless data
items of this record have been modified.
Syntax
<assign statement>
-- ASSIGN ---<data set>---- TO --<link item>----------------------->
I
\
\- NULL ------\
I
I
\-<link item>-\
>-------------------------------------------------------------------1
I
1
I-<exception handling>-I
See also
<data set) . . . . . . . .
<exception handling> . . .
<link item> . . . _ . . .
.
. 703
. 768
. 705
Semantics
The data set must be declared in DASDL as the object data set of the
target link item. A value that points to the current record in the data
set is assigned to that link item.
If the <data set> form is used, the current path of the
set must be valid, but the record need not be locked.
path is not valid, an exception occurs.
specified data
If the data set
710
ASSIGN
ALGOL REFERENCE MANUAL
If the word "NULL" is used, the relationship between records is severed
by assigning a NULL value to the target link item. If that link item is
already NULL. this option is ignored. A FIND, BDMS "LOCK," or MODIFY
statement on a NULL link item results in an exception.
If the ASSIGN statement specifies two link items, the value of the first
link item is assigned to the target link item. The first link item must
be declared in DASDL to have the same object data set as the target link
item and be the same type of link (counted link, self-correcting link,
symbolic link, unprotected link. or verified link). If the link items
are counted links, the count item is automatically updated, even if the
record that is referenced is locked by another program.
The current path of the data set containing the first link must be
valid, but the record need not be locked. If the data set path is not
valid, an exception occurs.
After the ASSIGN statement has executed, the target link item points to
either the current record in the specified data set or to the record
pointed to by the first link item.
The current path of the data set containing the target link item must be
valid, and the record must be locked; otherwise, an exception occurs.
If the target link item references a disjoint data set. then that link
item can point to any record in the data set. If the target link item
references an embedded data set, then only certain records in the data
set can be referenced. In this case. the record being referenced must
be owned by the record containing the target link item or by an ancestor
of the record containing this link item. (An ancestor is the owner of
the record, the owner of the owner, and so forth.)
If an exception is returned. ~he ASSIGN statement is not completed,
a NULL value is assigned to the target link item.
and
711
DMSIIInterface
ASSIGN
Example
If the database EXAMPLEDB is described in DASDL as follows:
D DATA SET (
A ALPHA ( 3 ) ;
B BOOLEAN;
L IS IN E VERIFY ON N;
):
S SET OF D KEY A;
E
DATA SET (
N NUMBER ( 3 ) ;
R REAL~
)
:
T SET OF E KEY N·,
then the following BDMSALGOL program uses the ASSIGN statement to assign
the value of the current record of data set E to link item L.
BEGIN
FILE CARD_FILE(KIND=READER);
DATABASE EXAMPLEDB:
EBCDIC ARRAY X[O:2]:;
INTEGER Y;
OPEN UPDATE EXAMPLEDB;
WHILE NOT READ(CARD_FILE~<A3,I3>jX.Y) DO
BEGIN
FIND S AT A = X:
FIND T AT N = Y;
ASSIGN E TO L;
END:
CLOSE EXAMPLEDB:
END.
712
BEGINTRANSACTION
ALGOL REFERENCE MANUAL
BEGINTRANSACTION STATEMENT
The BEGINTRANSACTION statement places a program in transaction
This statement can be used only with audited databases.
state.
The BEGINTRANSACTION statement performs the following steps in order:
1.
Captures the restart data set if AUDIT is specified
2.
Places a program in transaction state
Refer to the "DMSII User Language Interface Software
for further details regarding audit and recovery.
Operation
Guide"
Syntax
<begintransaction statement)
-- BEGINTRANSACTION -----------------------------------------------)
/
/- ( --<transaction record variable)-- ) -/
I
I
/- AUDIT ---------------------------------/
/
/- NOAUDIT
/
-------------------------------1
)-<restart data set>-----------------------------------------------/
1
/
I-<exception handling>-I
<transaction record variable>
The <transaction record variable> syntax is defined in the
Transaction Processing System (TPS) Programmer's Manual."
"DMSII
<restart data set>
--<qualification>--/
See also
<exception handling>.
<qualification> . . . .
. 768
•
•
• 693
713
DMSII Interface
BEGINTRANSACTION
Semantics
If the <transaction record variable> construct is used, it is the formal
input transaction record variable. and NOAUDIT is the default action.
The word "AUDIT" causes the restart area to be captured.
The path of
the specified restart data set is not altered when the restart record is
stored. AUDIT is the default action.
The word "NOAUDIT" causes the restart area
~restart
data set) construct specifies
updated.
to not be captured.
The
the restart data set to be
An .exception is returned if the BEGINTRANSACTION statement is
while the ~rogram is in transaction state.
attempted
If any exception is returned. the program is not placed in transaction
state.
If an ABORT exception is returned, all records that the program
had locked are freed.
Pragmatics
Deadlock can occur during execution of a BEGINTRANSACTION statement.
Any attempt to modify an audited databaise when the program is not in
transaction state results in a fault. The BDMSALGOL statements that
modify databases are the following:
ASSIGN statement
DELETE statement
GENERATE statement
INSERT statement
REMOVE statement
STORE statement
714
BEGINTRANSACTION
ALGOL REFERENCE MANUAL
Example
If the database DBASE is described in DASDL as follows:
OPTIONS(AUDIT):
R RESTART DATA SET
P ALPHA (10);
Q ALPHA (100);
);
D DATA SET (
A ALPHA (3);
N NUMBER (3):
);
S SET OF D KEY N:
then
the
following
BDMSALGOL
program
BEGINTRANSACTION statement can be used.
demonstrates
BEGIN
FILE CARD_FILE(KIND=READER);
DATABASE DBASE;
EBCDIC ARRAY MY_A[0:2];
INTEGER MY_N;
OPEN UPDATE DBASE;
MY_N := 1;
WHILE MY_N < 100 DO
BEGIN
CREATE LI:
PUT D (N := MY_N);
BEGINTRANSACTION R;
STORE D;
ENDTRANSACTION R:
MY_N := * + 1;
END;
WHILE NOT READ(CARD_FILE.<I3,A3>,MY_N,MY_A[0]) DO
BEGIN
LOCK S AT N = MY_N;
BEGINTRANSACTION R;
PUT D (A := MY_A[O]);
STORE D;
ENDTRANSACTION R;
END;
CLOSE DBASE;
END.
how
the
715
DMSII Interface
BDMS CLOSE
BDKS CLOSE STATEKENT
The BDMS"CLOSE" statement closes a daltabase when further access
longer required.
is
no
The CLOSE statement performs the following steps in order:
1.
Closes the database
2.
Frees all locked records
Syntax
<BDMS close statement>
-- CLOSE
-~<database
identifier>---------------------------!
I
!
I-<exception handling>-I
<database identifier>
--<BDMS identifier>--I
See also
<BDMS identifier> . . .
<exception handling> . .
691
•
• 768
Semantics
The database identifier specifies the database to be closed.
If the
database was declared to have an internal name, this internal name is
the database identifier. If the database does not have an internal name
but is a logical database, then the logical database name is the
database identifier. If the database does not have an internal name and
it is not a logical database, then the database name is the database
identifier.
An exception is returned if the specified database is not open.
/
716
BDMS CLOSE
ALGOL REFERENCE MANUAL
Pragmatics
Use of the CLOSE statement is optional; the
database at the time a program terminates.
system
closes
any
open
The CLOSE statement is the only BDMSALGOL statement in which the status
word has meaning when no exception is indicated. Therefore, after a
CLOSE statement. the status word should be examined by the program and
appropriate action taken. whether or not an exception is returned. An
ABORT exception can be obtained in this manner.
Example
If the database DBASE is described in DASDL as follows:
OPTIONS (AUDIT) :
R RESTART DATA SET
P ALPHA (10);
Q ALPHA (100);
') ;
D DATA SET (
A ALPHA (10);
B BOOLEAN;
N NUMBER (3);
);
S SET OF D KEY N;
SS SUBSET OF D BIT VECTOR;
x SUBSET OF D BIT VECTOR;
Y SUBSET OF D BIT VECTOR;
Z SUBSET OF D BIT VECTOR:
then the following BDMSALGOL
statement to close DBASE.
program
shows
how
to
use
the
CLOSE
717
DMSII Interface
BEGIN
FILE CARD_FILE(KIND=READER),
PRINT_FILE(KIND=PRINTER):
DATABASE DBASE;
BOOLEAN MB;
REAL MR;
INTEGER MN;
EBCDIC ARRAY MA[O:2]:
OPEN INQUIRY DBASE;
WHILE NOT READ(CARD_FILE,<I3>,MN) DO
BEGIN
FIND S AT N = MN:
GET D (MA [ 0] • -- A. MB . - B);
IF ME THEN
GET D (MR . -- N)
ELSE
MR := 0:
WRITg(PRINT~FILE,<I3."
MN , MA [ 0 ] " MB , MR ) ;
END;
CLOSE DBASE;
END.
"~A3."
".LS." ",E4.2>.
BDMS CLOSE
718
ALGOL REFERENCE MANUAL
CREATE
CREATE STATEMENT
The CREATE statement initializes the
record.
user
work
area
of
a
data
set
of
the
The CREATE statement performs the following steps in order:
1.
Frees the current record of the specified data set
2.
Reads any specified expression to determine the format
record to be created
3.
Initializes data items to one of the following values:
a.
The DASDL-declared INITIALVALUE. if present
b.
The DASDL-declared NULL, if present
c.
The default NULL
syntax
<create statement>
-- CREATE --<data set>--------------------------------------------->
1- ( --<arithmetic expression>-- ) -I
>------------------------------------------------------------------1
i
1
I-<exception tandling>-I
See also
<data set> . . . . . . . . . .
<exception handling> . .
. . . . . . . . 703
. . . 768
Semantics
The <data set> construct specifies the data set to be initialized.
The
current path of the data set is not changed until a subsequent STORE
statement has completed successfully.
The arithmetic expression specifies the type of record to be created.
This arithmetic expression is required when a variable-format record is
created; otherWise, it must not appear.
71q
CREATE
DMSII Interface
An exception is returned if the arithmetic expression does not represent
a valid record type.
Pragmatics
Normally. the CREATE statement is eventually followed by a STORE
statement, which places the newly created record into the data set.
However, if a subsequent STORE operation is not desired, the CREATE
statement can be nullified by a subsequent CREATE, DELETE. FIND.
BDMS "FREE." BDMS '''LOCK.'' MODIFY, or RECREATE statement.
The CREATE statement sets·up only a record area. If the record contains
embedded structures, the master record must be stored before entries can
be created in the embedded structures. If only entries in the embedded
structure are created (that is. if items in the master are not altered),
the master need not be stored a second time.
Example
If the database DBASE is described in DASDL as follows:
D DATA SET (
A ALPHA (10);
B BOOLEAN;
N NUMBER (3);
);
S SET OF D KEY N:
then the following BDMSALGOL program shows how a record of
can be created and ~tored.
data
set
D
720
CREATE
ALGOL REFERENCE MANUAL
BEGIN
FILE CARD_FILE(KIND=READER);
DATABASE DBASE:
EBCDIC ARRAY X[O:9];
INTEGER Y.Z;
OPEN UPDATE DBASE;
WHILE NOT READ(CARD_FILE.<AIO,Il.!3>.X[O],Y,Z) DO
BEGIN
CREATE D~
PUT D (A := X[O]):
IF Y = 1 THEN
PUT D (B := TRUE):
PUT D (N : = Z);
STORE D;
END;
CLOSE DBASE;
END.
721
DELETE
DMSll I n:terf ace
DELETE STATEIENT
The DELETE statement is identical to the FIND statement except that if a
record is found, it is locked and then deleted.
The DELETE statement performs the following steps in order:
1.
Frees the current record~ unless the selection expression
the name of the data set amd the current record is locked.
that case, the locke~ status is not altered.
is
In
2.
Alters the current path to point. to the record specified by the
selection expression, and Locks this record.
3.
Transfers that record to the user work area.
4.
Removes the record from all sets and automatic subsets, but not
from manual subsets.
5.
Removes the record from the data set.
If the record is found but cannot be deleted,an exception is returned
and the DELETE statement terminates. leaving the current path pointing
to the record specified by the selection expression.
If a set selection expression is used and the recora 1S not found, then
an exception is returned and the set path is changed and invalid. It
refers to a location between the last key less than the condition and
the first key greater than the condition. A set selection expression
using NEXT or PRIOR: can be done from this point provided keys greater
than and less than the condit.ionexist. The current path of the data
set, the current record, and the current paths of any other sets for
that data set remain unchanged.
It is the responsibility of the programmer
subset refers to the record b~ing deleted.
to
ensure
that
no
manual
722
ALGOL REFERENCE MANUAL
DELETE
Syntax
<delete statement>
-- DELETE --<selection expression>--------------------------------->
1
,
'-<exception handling>-I
>-----~------------------------------------------------------------1
I
1
1- ( --<input mapping>-- ) -I
See also
<exception handling> . . . . . .
<input mapping> . . . . .
<selection expression>.
•
•
•
• • 768
• • 696
• 703
Semantics
The selection expression identifies the record to be deleted.
An exception is returned and the record is not deleted if the record has
counted links pointing to it, or if the record contains a non-NULL link
or a non-empty embedded structure.
Pragmatics
When the DELETE statement completes. the current paths still refer to
the deleted record. Therefore, a FIND statement on the current record
results in a NOTFOUND exception; however. "FIND NEXT" and "FIND PRIOR"
statements are still appropriate.
723
DMSII Interface
DELETE
Example
If the database DBASE is described in DASDL as follows:
D DATA SET (
A ALPHA ( 3 ) ;
B BOOLEAN;
N NUMBER ( 3 ) ;:
R REAL;
);
S SET OF D KEY N;
then the following BDMSALGOL program demonstrates the use of the DELETE
statement to delete a record of the data set D where item N is equal to
the value of X.
BEGIN
FILE CARD_FILE(KIND=READER);
DATABASE DBASE;
INTEGER X;
OPEN UPDATE DBASE;
WHILE NOT READ(CARD_FILE,<I3>,X) DO
DELETE S AT N = X;
CLOSE DBASE;
END.
724
DMTERMINATE
ALGOL REFERENCE MANUAL
DMTERKINATE STATEMENT
The DMTERMINATE statement aborts the curren~ action. When an exception
occurs that the program does not handle. the DMTERMINATE statement can
be called to produce the same results as if the exception-handling
syntax had not been specified in the statement; that is, the DMTERMINATE
statement causes the program to terminate with a fault.
syntax
<dmterminate statement>
-- DMTERMINATE ---<Boolean identifier>----I
I
I
I-<integer identifier>-I
I
I-<real
identif1er~----1
See also
<Boolean identifier>.
<integer identifier>.
<real identifier> . . .
Example
If the database DBASE is described in DASDL as follows:
D DATA SET (
A ALPHA (3):
B BOOLEAN;
N NUMBER (3):
R REAL:
);
S
SET OF D KEY N;
55
123
. . . 182
725
DMSII Interface
DMTERMINATE
then the following BDMSALGOL program shows an example of the use of
DMTERMINATE statement.
BEGIN
FILE CARD_FILE(KIND=READER);
DATABASE DBASE;
BOOLEAN RSLT;
REAL RRSLT = RSLT;
INTEGER X;
OPEN UPDATE DBASE;
FIND FIRST D :RSLT;
IF RSLT THEN
BEGIN
DISPLAY("D IS EMPTY DATA SET");
DMTERMINATE(RSLT);
END
ELSE
WHILE NOT READ(CARD_FILE,<I3>,X) DO
BEGIN
DELETE S AT N X :RSLT;
IF'RRSLT.DMERROR = NOT FOUND THEN
DMTERMINATE(RSLT);
END;
CLOSE DBASE;
END.
=
the
72b
ALGOL REFERENCE MANUAL
ENDTRANSACTION
ENDTRANSACTION STATEMENT
The ENDTRANSACTION statement takes a program out of transaction
This statement can be used only with audited databases.
state.
The ENDTRANSACTION statement performs the following steps in order:
1.
Captures the restart area if AUDIT is specified
2.
Forces a syncpoint if the SYNC option is specified
3.
Implicitly frees all records of the database that
has locked
Refer to the "DMSII User Language Interface Software
for information regarding audit and recovery.
the
program
Operation
Guide"
Syntax
<endtransaction statement>
-- ENDTRANSACTION -------------------------------------------------)
I
1- ( --<endtransaction parameters>-- ) -I
1
1-
I
AUDIT
-------------------------------1
!
!- NOAUDIT
)- <restart data set>
-----------------------------i
---------------------------------------------1
1
1
1
1- SYNC -I I-<exception handling>-I
<endtransaction parameters>
--<transaction record variable>-- , -------------------------------)
)-<saveoutput procedure identifier>--------------------------------I
<saveoutput procedure identifier>
--<procedure identifier>--i
727
DMSII Interface
ENDTRANSACTION
See also
<exception handling> . .
<procedure identifier> . .
<restart data set>.
<transaction record variable> .
. 768
• l6~,
. . . 712
. . 712
Semantics
If the <endtransactlon parameters> form is used, the transaction record
variable
is
the formal input transaction record variable.
The
saveoutput procedurE~ identifier is the name of the SAVEOUTPUT formal
procedure.
For more information about the SAVEOUTPUT procedure, refer
to the "DMSII Transaction Processing System (TPS) Programmer's Manual."
The word "AUDIT" causes the restart area to be captured.
The path of
the restart data set is not altered when the restart record is stored.
The word "NOAUDIT" causes the restart
is the default action.
~rea
to not be captured.
The <restart data set> construct specifies the restart data
used.
set
NOAUDIT
to
be
The word "SYNC" forces a syncpoint.
An exception is returned if an ENDTRANSACTION statement is attempted and
the program is not in transaction state.
Records are freed in all cases.
is not applied to the database.
If an exception occurs, the transaction
728
ENDTRANSACTION
ALGOL REFERENCE MANUAL
Example
If the database DBASE is described in DASDL as follows:
OPTIONS(AUDIT);
R RESTART DATA SET
P ALPHA (10);
Q ALPHA (100);
);
D DATA SET (
A ALPHA (3);
N NUMBER (3);
);
S SET OF D KEY N;
then the following BDMSALGOL program demonstrates how the ENDTRANSACTION
statement can be used.
BEGIN
FILE CARD_FILE(KIND=READER);
DATABASE DBASE:
EBCDIC ARRAY MY_A[0:2];
INTEGER MY_N;
OPEN UPDATE DBASE;
MY_N := 1;
WHILE MY_N < 100 DO
BEGIN
CREATE D;
PUT D (N := MY_N):
BEGINTRANSACTION R:
STORE D;
ENDTRANSACTION R:
MY_N := '* + 1:
END:
WHILE NOT READ(CARD_FILE,<I3,A3>.MY_N,MY_A[0]) DO
BEGIN
LOCK S AT N = MY_N;
BEGINTRANSACTION R:
PUT D (A := MY_A[O]);
STORE D:
ENDTRANSACTION R;
END;
CLOSE DBASE;
END.
72G
DMSII Interface
FIND
FIND STATEMENT
The FIND statement transfers a record to the user work
with a data set or global data.
area
associated
The FIND statement performs the following steps in order:
1.
Frees a locked record in the data set if a data set is
specified in the FIND statement, or frees a locked record in
the associated data set if a set is specified in the FIND
statement
2.
Alters the current path to point to the record specified by the
selection expression or database name
3.
Transfers that record to the user work area
Syntax
<find statement>
FIND
---<sE~lection
expression>-------------------------------->
I
I
1
I-<database identifier>------------I
1
1
1
1- FIND KEY OF --<set selection expression>-I
)--------------.-~--------------------------------------------------1
I
I
I-<exception handling>-I
I
1
1- ( --<input mapping>-- ) -I
See also
<database identifier> .
<exception handling> . .
<input mapping> . . . .
<selection expression> . . . . . .
<set selectiori expression>.
715
. 768
. 696
703
703
730
ALGOL REFERENCE MANUAL
FIND
Semantics
The <selection expression> form is used to
transferred to the user work area.
specify
the
record
to
be
The <database identifier> form is used to specify the global data record
to be transferred to the user work area associated with the global data.
If no global data was described in DASDL for the database. a syntax
error occurs.
The form "FIND KEY OF <set selection expression>" moves the key and anv
associated data (as specified in DASDL) from the key entry to the user
work area.
A physical read 1S not performed on the data set:
consequently. all items in the record area that do not appear in the key
entry retain whatever value they had before the FIND statement.
The
current path of the data set is not affected.
If an exception is returned, the record is not freed.
An exception
expression.
is
returned
if
no
record
satisfies
the
selection
If a set selection expression is used and the record is not found, then
an exception is returned and the set path is changed and invalid. It
refers to a location between the last key less than the condition and
the first key greater than the condition. A set selection expression
using NEXT or PRIOR can be done from this point provided keys greater
than and less than the condition exist. The current path of the data
set, the current record, and the current paths of any other sets for
that data set remain unchanged.
To access data items. input mapping is required.
731
DMSlr Interface
Examples
FIND FIRST EMP AT DEPT-NO = 1019 :RSLT;
IF RSLT THEN
POP-EMPS[l019] := 0:
FINDEMP AT EMP-NO = SSN :RSLT;
IF .RSLT THEN
ERR_OUT(INV_EMP_NO_ERR);
FIND NEXT EMP :RSLT;
IF RSLT THEN
GO NO_MORE_EMP;
FIND FIRST OVR-65 AT DEPT-NO = 1019 :RSLT:
IF RSLT THEN
POP-OVR-65[1019] := 0;
FIND
732
ALGOL REFERENCE MANUAL
BDMS FREE
BDKS FREE STATEIENT
The BDMS "FREE" statement unlocks the current record.
A FREE statement can be executed after any operation.
If the current
record is already free. or if no current record is present, the FREE
statement is ignored.
The FREE statement can be used to unlock a record that the user
anticipates cannot be implicitly freed for a relatively long time. A
FREE statement executed on a record allows other programs to lock the
record.
Syntax
<BDMS free statement>
-- FREE ---<data set>----------------------------------------I
I
I
I
1
I-<database identifier >-1 I-<exception handling>-I
See also
<data set> . . . . . . .
<database identifier> .
<exception handling>.
.
• • 703
• • . 715
768
Semantics
The <data set> form is used to specify the data set whose current record
is to be unlocked.
The data set path and current record area remain
unchanged.
The <database identifier> form is used to specify the global data record
to be unlocked.
The data set path and current record area remain
unchanged.
If an exception
unchanged.
is
returned.
the
state
of
the
database
remains
733
BDMS FREE
DMSII Interface
Pragmatics
The FREE statement is optional in many situations because DELETE, FIND,
BDMS "LOCK," and MODIFY statements cali free a record before "they
execute. FIND. LOCK, and MODIFY statements that use sets or subsets can
free the locked record only if a new record is successfully retrieved.
Otherwise. the previously locked record remains locked. In general, an
implicit FREE statement is performed. if necessary. during any operation
that establishes a new data set path.
Example
If the database DBASE is described in DASDL as follows:
D DATA SET (
A ALPHA (3) ~
B BOOLEAN;
N NUMBER ( 3 ) :
R REAL;
);
S SET OF D KEY N;
then the following BDMSALGOL program demonstrates the use
statement to unlock the current record of data set D.
BEGIN
FILE CARD_FILE(KIND=READER);
DATABASE DBASE;
INTEGER X;
OPEN UPDATE DBASE;
WHILE NOT READ(CARD_FILE,<I3>.X) DO
BEGIN
LOCK S ATN = X;
IF DMTEST(A ISNT NULL) THEN
DELETE D
ELSE
FREE D;
END;
CLOSE DBASE;
END.
of
the
FREE
734
ALGOL REFERENCE MANUAL
GENERATE
GENERATE STATEMENT
The GENERATE statement creates an entire subset in one
subsets must be disjoint bit vectors.
operation.
All
The GENERATE statement performs the following steps in order:
1.
Deletes all the records from the subset
is not already empty
2.
Assigns either a NULL value. the records in another subset. or
a combination of the records in two other subse~s to the subset
that is generated
~o
be generated
if
it
Syntax
<generate statement>
-- GENERATE --<subset>--
--- NULL -------------------------------)
!
I
I-<subset>--------------------I
I
I
1- AND - -<subset>-I
I
1- OR -I
j-
+
---
!-
)------------------------------------------------------------------1
I
I-<exception handling>-i
See also
<exception handling> . .
<subset> . . . . . . . .
. 768
.
• 704
735
DMSII Interfiace
GENERATE
SE~mantics
The <subset> to the left of the equal sign (=) is the name of the subset
to be generated. This subset must be a manual subset, which must be a
disjoint bit vector.
The word "NULL" assigns a NULL value to the generated subset.
If <subset> follows the equal sign, it is the name of the subset whose
records are to be assigned to the generated subset. This subset must be
of the same data set as the generated subset. and it must be a disjoint
bit vector.
If to the right of the equal sign there are two <subset>s joined by the
operation AND, OR, +, or -. then these two subsets are to be combined in
the specified manner. The result is tben assigned to the generated
subset.
The two subsets must be of the same data set, and must be
disjoint bit vectors.
The operator "AND" specifies that the intersection of the two subsets is
to be assigned to the generated subset. The intersection is defined to
be all the records in the first subset that are also in the second
subset.
The operator "OR" specifies that the union of the two subsets is to be
assigned to the generated subset. The union is defined to be all the
records that are in either the first subset or the second subset.
The operator "+" specifies that the exclusive OR of the two subsets is
to be assigned to the generated subset. The exclusive OR consists of
the records in either the first subset or the second subset. but not the
records that appear in both subsets.
The operator "-" specifies that the subset difference of the two subsets
is to be assigned to the generated subset. The subset difference is
defined to be the records in the first subset that are not in the second
subset.
736
GENERATE
ALGOL REFERENCE MANUAL
Example
If the database DBASE is described in DASDL as the following:
D
DATA SET (
A ALPHA (3);
B BOOLEAN:
N NUMBER ( 3) ;
R REAL;
);
X SUBSET OF D WHERE (N GEQ 21 AND NOT B) BIT VECTOR;
Y SUBSET OF D WHERE (R LSS 1000) BIT VECTOR;
Z EUBSET OF D BIT VECTOR;
then the following BDMSALGOL program shows how the GENERATE statement
can be used to assign all the records that are in both X and Y to subset
z.
BEGIN
FILE CARD_FILE(KIND=READER);
DATABASE DBASE;
EBCDIC ARRAY S[0:2J:
INTEGER T,U,V;
OPEN UPDATE DBASE;
WHILE NOT READ(CARD_FILE.<A3.Il,I3.I4),S,T,U.V) DO
BEGIN
CREATE D;
PUT D ( A . - S);
IF T = 1 THEN
PUT D (B := TRUE);
PUT D (N : = U):
PUT D (R : = V):
STORE D;
END;
GENERATE Z = X AND Y;
CLOSE DBASE;
END.
737
DMSII Interface
GET
GET STATEMENT
The GET statement is used to transfer information from the user work
area associated with a data set or global data record into program
variables or arrays.
GET statement does not access the database; it assumes that prior
database operations have loaded the proper record or data items into the
user work area.
~~he
Syntax
<get statement)
--
GET'--~<data
se~t)--------------
( --<input mapping>-- ) --I
i
I-<database identifier>-\
1
See also
<data set> . . . . . .
<database identifier> .
<input mapping> . . . .
. 703
.
. 715
. 696
Semantics
The <data set> construct is used to transfer information from the user
work area associated with this data set into a program variable or
array.
The <database identifier> is used to transfer information from the user
work area associated with the global data record into a program variable
or array.
Pragmatics
No exceptions are associated with the GET statement.
However, if the
database containing the referen~ed data set or global data record ha~
not been opened at the time execution of the GET statement is attempted,
the program terminates with a fault.
738
GET
ALGOL REFERENCE MANUAL
Example
If the database DBASE is described in DASDL as follows:
D DATA SET (
A ALPHA (3);
B BOOLEAN:
N NUMBER ( 3) :
R REAL;
):
S SET OF D KEY N:
then the following BDMSALGOL program demonstrates how the GET statement
can be used to assign current values of data items to program variables
and arrays.
BEGIN
FILE CARD_FILE(KIND=READER),
PRINT_FILE(KIND=PRINTER);
DATABASE DBASE;
BOOLEAN MB;
REAL MR;
INTEGER MN;
EBCDIC ARRAY MA[O:2];
OPEN INQUIRY DBASE;
WHILE NOT READ(CARD_FILE.<I3>.MN) DO
BEGIN
FIND S AT N = MN;
GET D(MA[O] .- A.ME .- B):
IF ME THEN
GET D (MR := R)
ELSE
MR := 0;
WRITE(PRINT_FILE.<I3." "tA3." ".LS." ".E4.2>,
MN , MA [ 0] , ME • MR ) :
END:
CLOSE DBASE;
END.
739
INSERT
DMSII Interface
INSERT STATEMENT
The INSERT statement places a record into a manual subset.
The INSERT statement performs the following steps in order:
1.
Inserts the current record of the specified data set
specified subset
2.
Alters the set path for the speCified subset to
inserted record
point
into
the
to
the
Syntax
<insert statement>
-- INSERT --<data set>-- INTO --<subset>-----------------·----------\
I
I
\-<exception handling>-\
See alsc
<data set> . . . . . . .
<exception handling>.
<subset>. . . . . . . .
703
768
. 704
Semantics
The <data set> construct specifies the data set whose current record 15
inserted into the subset specified by <subset),
The path of the
specified data set must be the object data set of the specified subset.
The path of the specified data set must refer to a valid record: if not.
an exception is return~d.
The subset must be a manual subset. and it
specified data set.
must
be
a
subset
of
the
An exception is returned in the following cases:
1.
If duplicates are not allowed for the specified subset and the
record to be inserted has a key identical to that of a record
currently in that subset
"-
740
INSERT
ALGOL REFERENCE MANUAL
2.
If the specified subset is embedded in a data set that does not
have a valid current record
3.
If "LOCK TO MODIFY DETAILS" was
current record is not locked
specified
in
DASDL
and
the
then the following BDMSALGOL program shows how the INSERT statement
be used to place the current record of data set D into subset X.
can
Example
If the database DBASE is described in DASDL as follows:
D DATA SET (
A ALPHA (3);
B BOOLEAN;
N NUMBER (3);
R REAL;
);
X SUBSET OF D BIT VECTOR;
BEGIN
DATABASE DBASE;
BOOLEAN RSLT;
INTEGER MN:
OPEN UPDATE DBASE:
SET D TO BEGINNING;
FIND NEXT D :RSLT:
WHILE NOT RSLT DO
BEGIN
GET D (MN : = N);
IF MN > 10 THEN
INSERT D INTO X;
FIND NEXT D :RSLT;
END;
CLOSE DBASE;
END.
741
DMSII Interface
BDMS LOCK
BDKS LOCK STATEMENT
The BDMS "LOCK" statement is similar to the FIND statement, except that
if a record is found. it is locked against a concurrent modification by
another user.
"LOCK" and "MODIFY" are synonyms.
If the record to be locked has already been locked by another program,
the system performs a contention analysis. In this case, the present
program waits until the record is unlocked. However, if a wait would
result in a deadlock. all records locked by the program with the lowest
priority involved in the deadlock are unlocked, and the operation in
that program terminates with a DEADLOCK exception.
The LOCK statement performs the following steps in order:
1.
Frees a locked record in the data set if the LOCK statement
specifies a data set, or frees a locked record in the
associated data set if the LOCK statement specifies a set
2.
Alters the current path to point to the record specified by the
selection expression or database identifier
3.
Locks the specified record and then transfers
the user work area
that
record
to
Syntax
<BDMS lock statement>
LOCK -------<selection expression)----------------------------)
I 1
I I
1
1- MODIFY -I I-<database identifier)--I I-<exception handling>-I
)------------------------------------------------------------------1
\- ( --<input mapping>-- ) -I
See also
<database identifier> .
<exception handling) . . .
<input mapping> . . . . .
<selection expression> . . .
·
71::
768
•
6g6
·
703
742
BDMS LOCK
ALGOL REFERENCE MANUAL
Semantics
The selection expression is used to specify the record to be locked.'
The database identifier is used to specify the global data record to
locked.
be
If an exception is returned. the record is not freed.
If a LOCK statement using a set selection expression returns an
exception. the current path of the specified set is invalid. However,
the current path of tne data set. the current record. and the current
paths of any other sets for that data set remain unaltered.
To access data items. the <input mapping> construct must appear.
Pragmatics
Because no other user can lock a record once it is locked. a record must
be freed when it is no longer required to be locked. A record can be
freed explicitly by a BDMS "FREE" statement or implicitly by
a
subsequent CREATE, DELETE. FIND. BDMS "LOCK." or RECREATE statement on
the same data set.
Example
If the database DBASE is described in DASDL as follows:
D DATA SET (
A ALPHA (3);
B BOOLEAN:
N NUMBER (3);
R REAL;
);
X SUBSET OF D BIT VECTOR;
then the following BDMSALGOL program demonstrates the use
statement to lock records of subset x.
of
the
LOCK
743
DMSII Interface
BEGIN
DATABASE DBASE;
BOOLEAN RSLT;
INTEGER MN;
OPEN UPDATE DBASE;
SET X TO BEGINNING;
LOCK NEXT X :RSLT;
WHILE NOT RSLT DO
BEGIN
GET D (MN : = N);
IF MN<= 10 THEN
BEGIN
REMOVE D FROM X;
DELETE D;
END
ELSE
BEGIN
PtrT D (B .- TRUE) ;
STORE D;
END~
LOCK NEXT X : RSL1:';
END:
CLOSE DBASE:
END.
BDMS LOCK
744
MIDTRANSACTION
ALGOL REFERENCE MANUAL
KIDTRANSACTION STATEMENT
The MIDTRANSACTION statement causes the compiler to generat
the given procedure immediately before the calIon the DMS prGc~a
the Accessroutines.
Refer to the "DMSII Transaction Processing system (TPS)
Manual" for more information on transaction processing.
In
Programmer's
syntax
<midtransaction statement>
-- MIDTRANSACTION -- ( --<midtransaction parameters>-- ) ---------->
>-<restart data set>-----------------------------------------------I
I
I
I-<exception handling>-I
<midtransaction parameters>
--<transaction record variable>-- . ------------------------------->
>-<saveinput procedure identifier>----------------------------------!
<saveinput procedure identifier>
--<procedure identifier>--!
See also
<exception handling> . . .
<procedure identifier> . .
<restart data set>.
<transaction record variable> .
•
• 768
165
.
.
.
.
. . 712
. • 712
Semantics
The transaction record variable is the formal input
variable.
The saveinput procedure identifier is the name of the
procedure.
transaction
record
SAVEINPUT
formal
745
DMSII Interface
MIDTRANSACTION
The <restart data set> construct specifies the restart data
used.
F.xample
~nDTRANSACTION
(TRIN.SAVEINPUT) RDS :RSLT;
set
to
be
746
MODIFY
MODIFY STATEMENT
'·Mq~l. Ftj;Atc~~~~rt~ •.~~~ ..
-sect io-1'1'.· : "'MODIFY'tf an:d ",M
';;'l,{'The
ALGOL REFERENCE MANUAL
.
"",
747
BDMS OPEN
DMSII Interface
BDXS OPEN STATEMENT
The BDMS"QP~Nit·staterri$·nt •.opens a database
specifies the access mode.
for
subsequent
access
and
The OPEN statement performs the fOllowing steps in order:
1.
Opens an existing database. Appropriate "NO FILE" messages are
displayed if files required for invoked structures are not
present in the system directory.
2.
Performs an :implicit CREATE statement on the restart data set.
Syntax
<BDMS open statement>
-- OPEN ---------·-------<database identifier>---------------------->
I
1- INQUIl~Y -- I
I
!
1- TRUPDATE-I
1
1
1- UPDATE ---I
>----------------.--------------------------------------------------1
I
I-<exception handling>-l
I
See also
<database identifier> .
<exception handling> . .
. 715
. 768
Semantics
The word "INQUIRY" enforces read-only access to the database.
This
option is specified when no update operations are to be performed on the
database.
An exception is returned if the
following
BDMSALGOL
statements are used when the database has been opened with the INQUIRY
option:
ASSIGN statement
BEGINTRANSACTION statement
DELETE statement
ENDTRANSACTION statement
GENERATE statement
INSERT statement
REMOVE statement
STORE statement
748
BDMS OPEN
ALGOL REFERENCE MANUAL
The data management system does not open any audit files if the "OPEN
INQUIRY" form has been used by all programs accessing the database.
The word "UPDATE" allows the program to modify the database being
opened.
The UPDATE option must be specified in order to use the
BDMSALGOL statements listed above under the INQUIRY option.
UPDATE is
the default option.
The word ttTRUPDATE" must be specified in order to use the MIDTRANSACTION
statement
or
the
<transaction
record
variable>
form of the
BEGINTRANSACTION or ENDTRANSACTION statements.
The database identifier specifies the database to be opened.
If an exception
unchanged.
is
returned,
the
state
of
the
database
remains
An exception is returned if the database is already open.
Pragmatics
An OPEN statement must be executed before the first access
database; otherwise. the program terminates with a fault.
Examples
If the database DBASE is described in DASDL as follows:
OPTIONS(AUDIT);
R RESTART DATA SET
P ALPHA (10);
Q ALPHA (100);
);
D DATA SET (
A ALPHA (10);
B BOOLEAN;
N NUMBER (3);
);
S SET OF D KEY N:
SS SUBSET OF D BIT VECTOR:
X SUBSET OF D BIT VECTOR;
y SUBSET OF D BIT VECTOR;
Z SUBSET OF D BIT VECTOR;
of
the
749
DMSII Interface
BDMS OPEN
then the following BDMSALGOL program demonstrates the use of the OPEN
statement with the INQUIRY option to open database DBASE and perform
read-only actions on the database.
BEGIN
FILE CARD_FILE(KIND=READER),
PRINT_FILE(KIND=PRINTER);
DATABASE DBASE;
BOOLEAN MB;
REAL MR;
INTEGER MN;
EBCDIC ARRAY MA[O:2];
OPEN INQUIRY DBASE;
WHILE NOT READ(CARD_FILE,<I3>,MN) DO
BEGIN
FIND S AT N = MN;
GET D (MA[O] := A,MB := B);
IF MB THEN
GET D (MR := N)
ELSE
MR := 0;
WRITE(PRINT_FILE,<I3," ".A3," ""L5," ",E4.2>,
MN , MA [ 0 ] , MB , MR ) ;
END;
CLOSE DBASE;
END.
The following BDMSALGOL program demonstrates the use of the OPEN
statement with the UPDATE option to open database DBASE and perform
update actions on the database.
BEGIN
FILE CARD_FILE(KIND=READER);
DATABASE DBASE;
INTEGER X;
OPEN UPDATE DBASE;
WHILE NOT READ(CARD_FILE,<I3>,X) DO
BEGIN
LOCK S AT N = X;
IF DMTEST(A ISHT NULL) THEN
DELETE D
ELSE
FREE D:
END:
CLOSE DBASE;
END.
750
PUT
ALGOL REFERENCE MANUAL
PUT STATEMENT
The PUT statement transfers information from program expressions into
the user work area associated with a data set or global data record.
The PUT statement does not update the database; a subsequent STORE
statement must be executed to place the data in the user work area into
the database.
Any number of PUT statements can be used to update items before a
statement is executed.
STORE
Syntax
<put statement>
-- PUT ---<data set)-------------- ( --<output mapping>-- ) --I
/
I
/-<database identifier)-I
See also
<data set> . . . . . . . .
<database identifier> . . . . .
<output mapping> . . . .
.
.
.
.
.
.
.
.
• 703
. 715
. 700
Semantics
The <data set> form is used to transfer information associated with this
data set into the user work area.
The <database identifier> form is used to
transfer
information
associated with the global data record into the user work area.
Pragmatics
No exceptions are associated with the PUT statement.
However, if the
database containing the specified data set or the specified database has
not been opened, the program terminates with a fault.
751
DMSII Interface
PUT
Example
If the database DBASE is described in DASDL as follows:
D DATA SET (
A ALPHA (3):
B BOOLEAN;
N NUMBER (3):
R REAL;
);
X SUBSET OF D BIT VECTOR;
then the following BDMSALGOL program demonstrates how the PUT
can be used to assign values to data items.
BEGIN
FILE CARD_FILE(KIND=READER):
DATABASE DBASE;
EBCDIC ARRAY S[0:2J:
INTEGER T.U,V:
OPEN UPDATE DBASE;
WHILE NOT READ(CARD_FILE.<A3,Il,I3.I4>.S[OJ,T.U,V) DO
BEGIN
CREATE D;
PUT D (A : = S);
IF T = 1 THEN
PUT D (B := TRUE);
PUT D (N .- U.R := V);
STORE D;
END;
CLOSE DBASE;
END.
statement
752
RECREATE
ALGOL REFERENCE MANUAL
RECREATE STATEMENT
The RECREATE statement partially initializes the user work
data items remain unaltered; however, control items such as
counts. and data sets are unconditionally set to NULL.
area.
All
sets.
l1nks~
For variable-format records, the record type supplied must be the same
as that supplied in the CREATE statement that created the record. If
not. the subsequent STORE statement results in a DATAERROR subcategor~
4.
The RECREATE statement performs the following steps in order:
1.
Frees the current record of the specified data set
2.
Reads any specified arithmetic expression
format of the record to be created
~.
Unconditionally sets links, sets, counts, and data sets to NULL
to
determine
the
Syntax
<recreate statement>
-- RECREATE --<data set>------------------------------------------->
I
!
1- ( --<arithmetic expression>-- ) -!
)------------~-----------------------------------------------------1
I-<exception handling>-I
See also
<data set> • . . . . . .
<exception handling> . .
• 703
. • 768
Semantics
The <data set> construct specifies the data set to be initialized.
The arithmetic expression specifies a value indicating the type of
record to be created.
This arithmetic expression is required when a
variable-format record is created: otherwise, it must not appear.
753
DMSII Interface
RECREATE
An exception is returned if the arithmetic expression does not represent
a valid record type.
Example
If the database DBASE is described in DASDL as follows:
OPTIONS(AUDIT);
R RESTART DATA SET
P ALPHA (10);
Q ALPHA (100);
);
D DATA SET (
A ALPHA (l 0 ) ;
B BOOLEAN;
N NUMBER (3);
);
S SET OFD KEY N;
SS SUBSET OF D BIT VECTOR;
X SUBSET OF D BIT VECTOR;
Y SUBSET OF D BIT VECTOR;
Z SUBSET OF D BIT VECTOR;
then the following BDMSALGOL program demonstrates how the RECREATE
statement can be used to partially initialize a record of data set D.
BEGIN
FILE CARD_FILE(KIND=READER);
DATABASE DBASE;
EBCDIC ARRAY X[0:9]; .
INTEGER Y.Z:
OPEN UPDATE DBASE;
WHILE NOT READ(CARD_FILE,<A10.Il,I3>,X[0].Y,Z) DO
BEGIN
CREATE D;
PUT D (A := X[O]);
IF Y = 1 THEN
PUT D (B := TRUE);
PUT D (N : = Z);
STORE D;
RECREATE D;
PUT D (N .- Z+l);
STORE D;
END;
CLOSE DBASE;
END.
754
REMOVE
ALGOL REFERENCE MANUAL
REMOVE STATEIENT
The REMOVE statement is similar to the FIND statement, except that i f a
record is found. it is locked and then removed from the specified
subset.
The REMOVE statement performs the following steps in order:
1.
Frees the current record
2.
Alters the current path to point to
CURRENT or the data set
3.
Locks the previously found record and then removes
from the specified subset
the
record
specified
the
by
record
If an exceptIon occurs after step 2. the current path is invalid.
If an exception occurs after step 3, the operation terminates. leaving
the current path pointing to the record specified by CURRENT or by the
data set.
Syntax
<remove statement>
-- REMOVE --- CURRENT
I
I-<data set>-I
FROM --<subset>-------------------------)
>---------------------------------------------~--------------------1
I-<exception handling>-I
See also
<data set> . . . . . .
<exception handling>.
<subset> . . . . . . . .
• • • 703
• 768
• • • 704
755
DMSII Interface
REMOVE
";i,,':';I"-;';'~hT'l'r,"ti;'.T m",\removes' the curren t record from the specified subset.
","1.'$:' ,~p·e.CJfied, t'he subset must have a valid current
~$·:"p.o:t: hav~ a valid current record, an exception is
>
'~'
j'
<'
il
~;;:S~;ii;(i;, ... 1..
';.,f
,t ii,s",used to find and remove from the
specified
~",,iIfl~A.,,, .... ·,Oij·····,lTe·j'ei.
Ced by the current path. An exception is
"d,"'''''L~I=' :'reC:c)rq' 'is'. nbt in the subset.
en
,
<~'"
..
.:.
,~
, .
:~. y.~~.
;'. \"
:
tr~1;lct'
specifies the subset from which a record is to be
seit:,tUusi be
mG!:nual subset of the specif ied data set.
..·A.
a
.
"'","', ,.., , , '... ,. ;;~}i'~~~1::e.dded
in a data
and that
'or:d ; de'fJned
:.I;'\"l"·'·
,.
"
set,
the data
set must have a
record must be locked; i f not, an
I
re·turnE:~d.
:<~...
-.
~,
!:' . ",
'-fettll;hed in the following cases:
~r~~b·~r;1~ft~:~~i~x,~r,~,'~,~f;t.::t,S· ,s.pecif ied
:';;,"!!;il-\C:i.""CO'''''i'~''!'.~:';bur·te,ntre-cord
' .. '7'
'
,
and the specif ied subset does not
have
'
:i.s:·;~s,p,e,cif ied and the record is not in the subset
;> '.'~'
.,vJ:jl'.!:;:',,·>;::t'I..,:t'\;;,if~:i.;~d<s:ub'se,tis
. . .' . ....
i ';.'.
.,>~
~::
'!.~
;1f!1P.f~;t:~,n.().,F;bcfV~
I
,'a: curr,en t
}~;J~lf:[j::ij,:··
embedded in a data set. and the data
record def i ned and lock.ed
;'st,l,t'emenf :1s executed. the current paths still refer to
subsequent
FIND statement on the
,-\~!t;!iq:G):tp t'es:uJLts in..,a
NOTFOUND exception.
However,
the
"FIND
{';;'i~i""i1i.t'h·;'\PR!l()R;"·'fotms
the FIND statement give valid results.
,~,C~:r'Cl"~:'" The,n:?f ore,' a
of
756
ALGOL REFERENCE MANUAL
REMOVE
Example
If the database DBASE is described in DASDL as follows:
D DATA SET (
A ALPHA (3);
B BOOLEAN;
N NUMBER (3);
R REAL;
);
SS SUBSET OF D BIT VECTOR;
then the following BDMSALGOL program demonstrates the use of the REMOVE
statement to lock and remove the record of data set D that is referenced
by the current path from the subset SS.
BEGIN
DATABASE DBASE;
BOOLEAN RSLT;
INTEGER MN;
OPEN UPDATE DBASE;
SET SS TO BEGINNING;
FIND NEXT SS :RSLT;
WHILE NOT RSLT DO
BEGIN
GET D (MN : = N);
IF MN < 10 THEN
REMOVE D FROM SS;
FIND NEXT SS :RSLT;
END;
CLOSE DBASE;
END.
757
DMSII Int,erface
BDMS SET
BDl!IS SET STATEMENT
The BDMS "SET" statement alters the current path or changes the value of
an item in the current record. Only the record area is affected. The
data set is nOt affected until a subsequent STORE statement is executed.
The SET statement performs the following steps in
order~
1.
Frees the current path of the data set. set, or subset
2.
Performs one of the following actions:
a.
Alters: the current path of the data set, set, or subset to
point to the beginning or the ending of the indicated
struct.ure
b.
Alters: the set or subset path to point to the current path
of another data set
b.
Assigns a NULL value to a particular item
.syntax
<BDMS set statement>
-- SET ---<set)------ TO ---<data set>-----<exception handl:ing>----I
I
I
I
I
I
I-<subset>-I
1- BEGINNING --1
I
i
I
1- ENDING -----1
I
I
I
I
I-<data set>-- TO
BEGINNING -I
I
I
I
I
I
1- ENDING ----I
I
I
1
I
I-<item>-- TO -- NULL ----~----------~------------------I
<item>
--<qualification>--I
See also
<data set> . . . . . . .
<exception handling>.
<qua 1 i fica t ion> . .
<set> . . .
<subset). . . .
•
• 703
768
.
•
• 693
• . . 703
. • 704
758
BDMS SET
ALGOL REFERENCE MANUAL
Semantics
The constructs <data set>, <set>, or <subset> following the word "SET"
specify the data set, set. or subset. respectively, whose path is
altered.
If "TO <data set>" is specified, the current path of the set or subset
is altered to point to the current record of the specified data set.
If "TO BEGINNING" is specified. the current path of the set, subset, or
data set is altered to point to the beginning of the set, subset, or
data set, respectively.
If "TO ENDING" is specified, the current path of the set. subset. or
data set is altered to point to the ending of the set, subset, or data
set, respectively.
The <item) construct specifies an item of the current record that is
assigned a NULL value.
The item cannot be a link item. NULL is the
DASDL-declared NULL value if present; otherwise, it is the system
default NULL value.
Pragmatics
After a "SET TO BEGINNING" form of the SET statement. the "FIND NEXT"
and "FIND FIRST" forms of the FIND statement are equivalent; similarly,
after a "SET TO ENDING", a "FIND PRIOR" and "FIND LAST" are equivalent.
Example
If the database DBASE is described in DASDL as follows:
D
DATA SET (
A ALPHA ( 20 ) ~
B BOOLEAN;
N NUMBER ( 2 ) ;
R REAL;
);
S SET OF D KEY (N) :
SS SUBSET OF D WHERE (N
3) :
759
DMSII Interface
BDMS SET
then the following BDMSALGOL program demonstrates different ways to
the SET statement.
BEGIN
FILE CARD_FILE(KIND=READER).
PRINT_FILE(KIND=PRINTER);
DATABASE DBASE:
BOOLEAN MB,RSLT;
REAL MR;
INTEGER MN;
EBCDIC ARRAY MA[O:2];
LABEL CLOSE_DATABASE;
OPEN INQUIRY DBASE;
SET SS TO BEGINNING :RSLT;
IF RSLT THEN
BEGIN
WRITE(PRINT_FILE.<"** NO ENTRIES IN S8. **"»;
GO CLOSE_DATABASE;
END;
WHILE NOT READ(CARD_FILE,<I3>,MN) DO
BEGIN
FIND S AT N = MN;
SET SS TO D :RSLT;
IF RSLT THEN
WRITE(PRINT_FILE,<I3," NOT IN SS.">.MN)
ELSE
BEGIN
GET D( MA [ 0:1 : = A, MB : = B);
IF MB THEN
GET D O~R := R)
ELSE
MR : = O:~
WRITE(PRINT_FILE,<I3," ".A3." ",LS," ".E4.2>.
MN , MA [ 0] ,MB , MR ) ;
END;
END;
CLOSE_DATABASE:
CLOSE DBASE:
END.
use
760
STORE
ALGOL REFERENCE MANUAL
STORE STATEMENT
The STORE statement places a new or modified record into a data set or a
global record area. The data from the user work area for the data set
or global record is inserted into the data set or global record area.
The STORE statement performs the
prior operation.
1.
2.
following
actions
depending
on
the
After a CREATE or RECREATE statement:
a.
Checks the data in the user work area for validity
VERIFY condition is specified in the DASDL
if
a
b.
Tests the record for validity for insertion in each set in
the data set (for example, tests whether or not duplicates
are allowed)
c.
Evaluates the WHERE condition for each automatic subset
d.
Inserts the record into all sets and automatic sUbsets
all conditions are satisfied
e.
Locks the new record
f.
Alters the data set path to point to the new record
if
After a BDMS "LOCK" or MODIFY statement:
a.
Checks the data in the user work area for validity
VERIFY condition is specified in the DASDL.
if
a
b.
Re-evaluates the conditions if items involved in the
insertion conditions have changed.
If the condition
yields FALSE, the record is removed from eaCh automatic
subset that contains the record. If the condition yields
TRUE, the record is inserted into each automatic subset
that does not contain the record.
c.
Deletes and re-inserts the record in the proper position
if a key used in the ordering of a set or automatic subset
is modified so that the record must be moved within that
set or automatic subset.
d.
Stores the record in a manual subset. but performs no
reordering on that subset. The user is responsible for
maintaining manual subsets. A subsequent reference to the
record using that subset produces undefined results.
7b1
STORE
DMSII lnt!erface
Syntax
<store statement>
STORE ---<data set)--------~------------------------------------>
I I !
!
I-<database identifier>'-I !-<exception handling>-I
>------------------------------------------------------------------1
!
1
1- ( --<output mapping>-- ) -I
See also
<data set> . . . . . . .
<database identifier> .
<exception handling> . .
<output mapping> . . .
703
715
•
• 768
• • • .
• 700
Semantics
If the <data set> form is used, the data in the user work area
data set is returned to the specified data set.
for
the
If the <database identifier> form is used~ the data in thE,) user work
area for the global data is returned to the global data record area.
The global data record must be locked before a STORE statement
references it; otherwise. the STORE statement is terminated with an
exception.
An exception is returned and the record is not stored if the record does
not meet any of the validity conditions.
An exception is returned if the data set path is valid and the current
record is not locked. or if the global data record is not locked.
762
ALGOL REFERENCE MANUAL
STORE
Example
If the database DBASE is described in DASDL as follows:
OPTIONS(AUDIT);
R RESTART DATA SET
P ALPHA (10);
Q ALPHA (100);
);
D DATA SET (
A ALPHA (3);
N NUMBER (3);
);
S SET OF D KEY N;
then the following BDMSALGOL program demonstrates how the
statement can be used to place a record into the data set D.
BEGIN
FILE CARD_FILE(KIND=READER);
DATABASE DBASE;
EBCDIC ARRAY MY_A[0:2]:
INTEGER MY_N;
OPEN UPDATE DBASE;
MY_N := 1;
WHILE MY_N < 100 DO
BEGIN
CREATE D;
PUT D (N := MY_N);
BEGINTRANSACTION R;
STORE D;
ENDTRANSACTION R;
MY_N := *+1;
END;
WHILE NOT READ(CARD_FILE,<I3,A3>,MY_N,MY_A[0]) DO
BEGIN
LOCK S AT N = MY_N;
BEGINTRANSACTION R;
PUT D (A := MY_A[O]);
STORE D:
ENDTRANSACTION R:
END:
CLOSE DBASE;
END.
STORE
763
DMSII Interface
BDXSALGOL
~
FU~rCTIONS
There are two data management functions available in the BDMSALGOL
language: DMTEST and STRUCTURENUMBER. These functions are described in
this section.
DXTEST FUNCTION
The DMTEST function determines whether an item is NULL.
The function
returns a Boolean value. which is TRUE if the value of the relationship
expressed between the parentheses is TRUE and FALSE otherwise.
No
status value is associated with the DMTEST function.
syntax
<dmtest function>
-- DMTEST -- ( ----<alpha item>------- EQL ---- NULL -- ) --I
1
1
1
1
1-< link. i tern >~---I \- = ----I
1
I !
1
I-<numeric item>-I 1- IS ---I
I i i
I
I-<real item>----\ \- NEQ --I
1
1-
\
1,=
---I
1
1- ISNT -\
<alpha item>
<numeric item>
<real item>
--<qualification>--I
See also
<link. item> . .
<qualification>
705
693
764
ALGOL REFERENCE MANUAL
Semantics
The <alpha item> construct specifies an alpha item declared in the
DASDL.
The alpha item contains a NULL value after a "SET <item> TO
NULL" form of the BDMS "SET" statement, where <item> is the alpha item.
The <numeric item> construct specifies a numeric item declared in the
DASDL.
The numeric item contains a NULL value after a "SET <item> TO
NULL" form of the BDMS "SET" statement, where <item> is the numeric
item.
The <real item> construct specifies a real item declared in the DASDL.
The real item contains a NULL value after a "SET <item> TO NULL" form of
the BDMS "SET" statement. where <item> is the real item.
The <link item> construct specifies a link item declared in the DASDL.
The link item contains a NULL value if either of the following is TRUE:
1.
The link item does not point to a record.
2.
No current record is present for the data set that contains the
link item.
This condition occurs following a BDMS "OPEN"
statement, following the "SET TO BEGINNING" and "SET TO ENDING"
forms
of
the BDMS "SET" statement, or when the record
containing the link item has been deleted.
The link item contains a non-NULL value if the link
item
record. even if that record has been deleted.
The word "NULL" represents the DASDL-defined NULL value.
points
to
a
765
DMSII Interface
Example
If the database DBASE is described in DASDL as follows:
D DATA SET (
A ALPHA (3) ~
B BOOLEAN;
N NUMBER (3);
R REAL;
);
S SET OF D KEY N;
then the following BDMSALGOL program demonstrates how the DMTEST
function can be used to determine whether or not the alpha item A is
NULL.
BEGIN
FILE CARD_FILE(KIND=READER);
DATABASE DBASE;
INTEGER X;
OPEN UPDATE DBASE;
WHILE NOT READ(CAlRD_FILE,<I3>,X) DO
BEGIN
LOCK S AT N = X;
IF DMTEST(A ISNT NULL) THEN
DELETE D
ELSE
FREE D;
END;
CLOSE DBASE;
END.
766
ALGOL REFERENCE MANUAL
STRUCTVRENUIBER FUNCTION
The STRUCTURENUMBER function allows the programmer
to
determine
programmatically the structure number of a data set, set, subset, or of
global data. This function can be used to analyze the result of
exception conditions.
This capability is most useful when several sets span a data set and the
previous operation against the data set yielded an exception. The
program can determine which structure caused the exception from the
corresponding structure number.
Syntax
<structurenumber function>
-- STRUCTURENUMBER -- ( ---<database identifier>--- ) --I
1
I-<data set>------------!
I
1
I-<set>-----------------I
1
I
I-<subset>--------------/
See also
<data set> . . . . . .
<database identifier>
<set> . . .
....... .
<subset.>. . . . . . . . . . .
.
.
.
• .
.
•
. .
• •
.
•
•
.
703
715
703
704
Semantics
If the <database identifier)
construct is used, the STRUCTURENUMBER
returns the structure number of the global data. Otherwise.
the function returns the structure number of the data set, set, or
subset specified, respectively, by the <data set>, <set>, or <subset>
construct.
f~nction
767
DMSII Interface
Pragmatics
When a partitioned structure is declared in DASDL. it is assigned one or
more
structure
numbers, depending on <unsigned integer> in the
"OPEN PARTITIONS = <unsigned integer>" form of the DASDL "OPEN" data set
option.
(For more information. refer to the "DMSII DASDL Reference
Manual.") For example, if "OPEN PARTITIONS = 3" is specified. three
structure numbers are assigned to the partitioned structure. The
STRUCTURENUMBER function returns the smallest structure number assigned
to the structure; however. DMSTRUCTURE. the value in the exception
status word, can evaluate "to any of these values: that is. it does not
necessarily evaluate to the same structure number every time.
Example
REAL ERRORWORD:
IF STRUCTURENUMBER(D) =: ERRORWORD.DMSTRBCTURE THEN
REPLACE EA BY "D FAULT";
768
ALGOL REFERENCE MANUAL
9.5
EXCEPTION PROCESSING
When executing BDMSALGOL statements, anyone of several exception
conditions.
which prevent the operation from being performed as
specified, can be encountered. These conditions result if the operation
encounters a fault or does not produce the expected action. For
example, execution of the statement
FIND S AT NAME = "JONES"
would result in an exception if there is no entry in S that has a value
of "JONES" for the key item. If the operation terminates normally, no
exception occurs.
A database status word is returned to the BDMSALGOL program at the
conclusion of each BDMSALGOL statement.
The value of this word
indicates whether or not an exception has occurred and specifies the
nature of the exception.
DATABASE STATUS WORD
In a BDMSALGOL statement, the user must specify
variable or Boolean variable in which the value
word is stored at the completion of the BDMSALGOL
variable is specified, the status value cannot be
the name of a real
of the database status
statement. If no such
interrogated.
The <exception handling> construct is used in the syntax of the
BDMSALGOL statements to denote those statements where a program variable
can be designated to receive the value of the database status word,.
Syntax
<exception handling>
-- : --<exception
variable>--I
<exception variable>
----<Boolean variable>----I
I
I-<real variable>----I
DMSII Interface
See also
<Boolean variable> . .
<real variable> . . .
234
447
Semantics
A Boolean variable is a Boolean simple variable or an element of a
Boolean array. A real variable is a real simple variable or an element
of a real array.
Example
REAL ERRORWORD;
OPEN UPDATE DBASE :ERRORWORD:
EXCEPTION HANDLING
If· the. database status word is treated as a Boolean quantity, its value
is TRUE if the operation containing it results in an exception;
otherwise, it is FALSE.
If an exception results from a database operation. but the value of the
database status word is not assigned to an exception variable in the
program. the program is terminated. If the value is assigned to an
exception variable. no other indication of the exception is given. The
BDMSALGOL program is responsible for determining the nature of the
exception and responding appropriately.
Failure to do so can cause
unpredictable results.
To determine the nature of an exception, the database status word is
interrogated by specifying a period ( .. ) and an attribute name following
the exception variable. The attribute names are recognized by the
BDMSALGOL compiler as representations of the apprapriate fields of the
database status word.
770
ALGOL REFERENCE MANUAL
Syntax
<exception value>
--<exception variable>--
DMERROR
--------i
I
1- DMERRORTYPE -I
!
j-
1
DMSTRUCTURE -I
Semantics
The attribute "DMERROR" yields a numeric value identifying a major
category.
Mnemonic names are also available to represent these numeric
values. Either the category number or the category mnemonic can be used
to test for a particular category.
The attribute "DMERRORTYPE" yields
subcategory of the major category.
a
numeric
value
identifying
the
The attribute "DMSTRUCTURE" yields a numeric value identifying the
structure number of ~he structure involved in the exception. The
structure numbers of all invoked structures are shown in the program
listing if the program was compiled with the compiler control options
LIST and LISTDB equal to TRUE.
Example
The following example illustrates one way of handling
BDMSALGOL program:
exceptions
REAL ERRORWORD:
OPEN UPDATE DBASE :ERRORWORD:
IF BOOLEAN(ERRORWORD) THEN
IF ERRORWORD.DMERROR = OPENERROR THEN
IF ERRORWORD.DMERRORTYPE = I THEN
DISPLAY("I/O ERROR ON ACCESSROUTINES CODE FILE");
:in
a
771
DMSII Interface
If the exception variable is a
is changed as follows:
Bool~an
variable, the
preceding
BOOLEAN ERRORWORD;
OPEN UPDATE DBASE : ERRORWORD;
IF ERRORWORD THEN
IF REAL(ERRORWORD).DMERROR = OPENERROR THEN
IF REAL(ERRORWORD).DMERRORTYPE= 1 THEN
DISPLAY("I/O ERROR ON ACCESSROUTINES CODE FILE");
example
772
ALGOL REFERENCE MANUAL
9.6
BDBSALGOL COMPILER CONTROL OPTIONS
The following compiler control options are available in the BDMSALGOL
language in addition to the options available in the ALGOL language.
For information on the compiler control options available in ALGOL,
refer to "Compiler Control Options" in the chapter "Compiling Programs."
See also
Compiler Control Options . . . . . . . . . .
~
. . . . . . . . . 595
<datadictinfo option>
-- DATADICTINFO --I
(Type:
Boolean. Default value:
FALSE)
If the DATADICTINFO option is TRUE, information about the usage of
database structures and items is placed into the object code file. This
usage information shows which database structures and items were invoked
by the program and whether they were read or written. This option
cannot be assigned a value after the appearance of the first syntactical
item in the program.
<listdb option>
-- LISTDB --I
(Type:
Boolean, Default value:
FALSE)
If both the LIST option and the LISTDB option are TRUE, the printer
listing contains information about the invoked databases, structures,
and items, including the declared database titles. If the LIST option
is TRUE but the LISTDB option is FALSE, the printer listing does not
contain this information. The value of LISTDB is ignored if the LIST
option is FALSE.
773
DMSII Interface
~:nodmdefines
option>
-- NODMDEFINES --I
(Type:
Boolean, Default
valu~:
FALSE)
If the NODMDEFINES option is TRUE. no defines are expanded in
constructs.
When the NODMDEFINES option is FALSE, defines in BDMSALGOL
are expanded. including defines in the following situations:
BDMSALGOL
constructs
~.
A database item has the same identifier as a define.
2.
An alphanumeric string that is part of a database item
identifier (between two hyphens, before the first hyphen, or
after the last hyphen) is the same as the identifier of a
define.
<tracedb option>
-- TRACEDB
(Type:
Boolean. Default value:
FALSE)
If the TRACEDB option is TRUE. the printer listing contains a trace of
the
communication
between
the
BDMSALGOL
compiler
and
the
DATABASE/INTERFACE program.
The action of this option is independent of
the value of the LIST option.
774
ALGOL REFERENCE MANUAL
9. 7
BINDING AND SEPCOIP Q[ DATABASES
BINDING
Programs that declare and reference databases can be bound together by
the Binder program.
The following example shows a BDMSALGOL host
program that declares a database and an external procedure, and a
separate procedure that is to be bound to the host and that declares the
database in its global part.
The DASDL description of the database TESTDB is as follows:
DS DATA SET (
NAME GROUP
LAST ALPHA (10):
FIRST ALPHA (10):
);
AGE NUMBER (2):
SEX ALPHA (1);
SSNO ALPHA (9):
):
NAME SET SET OF DS KEY (LAST, FIRST):
The following program,
host program:
compl1~d
BEGIN
DATABASE TESTDB:
PROCEDURE P: EXTERNAL;
OPEN UPDATE TESTDB:
P:
CLOSE TESTDB;
END.
with the name SEP/HOST. is the BDMSALGOL
775
DMSII Interface
The following separate procedure, P, compiled with the name SEP/P. is to
be bound to the external procedureP of the host. Note how the database
TESTDB is declared in the global part.
[DATABASE TESTDB:]
PROCEDURE P;
BEGIN
BOOLEAN EXCEPTIONWORD:
EXCEPTIONWORD := FALSE;
SET NAMESET TO BEGINNING:
WHILE NOT EXCEPTIONWORD DO
BEGIN
FIND NEXTNAMESET AT LAST = "SMITH"
AND FIRST = "JOHN" : EXCEPTIONWORD;
% OTHER STATEMENTS
END:
END;
The separate procedure P in SEP/F can be bound to
using the following Work Flow Language (WFL) job.
code file is named GLOBDB.
?BEGIN JOB BIND/GLOB;
BIND GLOBDB WITH BINDER LIBRARY:
BINDER DATA
HOST IS SEP/HOST;
BIND P FROM SEP/P;
?END JOB.
the host SEP/HOST
The resulting bound
776
ALGOL REFERENCE MANUAL
SEPCOKP
Programs that declare and use databases can also make use of the, seppPIIlF,
facility of the compiler, as shown in the following example.
The DASDL description of the database TESTDB is as follows:
DS DATA SET (
NAME GROUP
LAST ALPHA (10);
FIRST ALPHA (10):
):
AGE NUMBER (2):
SEX ALPHA (1):
SSNO ALPHA (9);
);
NAMESET SET OF DS KEY (LAST. FIRST):
Because the MAKEHOST compiler control option is TRUE,
the following
program. compiled as MY/HOST, can be used as a host program for SEPCOMF.
$ SET MAKEHOST
BEGIN
DATABASE TESTDB;
PROCEDURE P;
BEGIN
BOOLEAN EXCEPTIONWORD;
EXCEPTIONWORD := FALSE;
SET NAMESET TO ENDING:
WHILE NOT EXCEPTIONWORD DO
BEGIN
FIND NEXT NAMESET AT LAST = "SMITH"
AND FIRST = "JOHN": EXCEPTIONWORD:
% OTHER STATEMENTS
END;
END;
OPEN UPDATE TESTDB;
P;
CLOSE TESTDB;
END.
1
2
3
4
5
t
7
8
9
10
11
12
13
14
15
16
17
18
The following source input invokes the SEPCOMP facility to change the
record of
the host MY/HOST witt sequence number 7, recompile the
procedure F. and bind the new P to ,the host.
$ SET SEPCOMP "MY/HOST"
SET NAMESET TO BEGINNING:
~~
PATCH FOLLOWS
777
!Q
COMPILE-TIlE FACILITY
The compile-time facility is used to conditionally and lteratively
compile ALGOL source data. This chapter describes the declaration and
use of compile-time variables. compile-time identifiers. compile-time
statements. an extension to the DEFINE declaration. and compiler control
options that pertain to the compile-time facility.
The compile-time facility is available only in ALGOL compilers that have
been compiled with the CTPROC c6mpiler-generation option set to TRUE.
~~OIlPILE-TIME
VARIABLE
Syntax
(compile-time variable declaration>
1<-------------------- . --------------------1
I
-- NUMBER
1
---<identifier>-------~--------------------------I
I
1
1- := --<starting value>----I
1
I
1- [ --(vector length>-- ] -I
<number identifier>
An <identifier> that is associated with a compile-time variable in a
compile-time variable declaration.
<starting value>
--<compile-time arithmetic expression>--I
<compile-time arithmetic expression>
Any <arithmetic expression> that can be fully evaluated at compile
time.
A compile-time arithmetic expression consists of constants
and <compile-time variable>s.
<vector length>
--<compile-time arithmetic expression>--I
778
ALGOL REFERENCE MANUAL
<compile-time variable>
--<number identifier)-----------------------------------------------)
>------------------------------------------------------------------1
1
1
1- [ --<compile-time arithmetic expression>-- ] -I
Semantics
An identifier declared in a
compile-time variable declaration is a
"number
variable"
or
an
arithmetic
compile-time variable.
A
compile-time variable represents a
single-precision arithmetic value.
It can be used wherever an arithmetic value is allowed and represents
the value most recently assigned to it.
The value of a
compile-time
variable can be changed at any time during compilation by using the
compile-time 'LET statement.
A compile-time variable can be declared
with a
starting value; if a starting value is not explicitly declared,
the starting value is zero.
If a compile-time variable is declared with a vector length, a vector or
"array" of
compile-time variables
is created.
When an identifier
declared in this way is used, it must be subscripted by a
compile-time
arithmetic
expression
with
a
value
in
the range 0 through
(vector length - 1).
The value of the vector length must be in the
range 1 to 1023.
779
Compile-Time Facility
COIPILE-TlIlEIDENTIFIEi;
Syntax
<compile~time
identifier>
--<identifier>-- , --<number identifier>--!
Semantics
A compile-time identifier can appear anywhere an identifier can be used,
including
declarations.
No blank characters can appear between
<identifier> and the apostrophe (').
The created identifier is the
<identifier>. followed by an apostrophe, followed by numeric characters
corresponding to the value of the number identifier, with leading zeros
suppressed.
780
ALGOL REFERENCE MANUAL
COMPILE~TlKE
STATElENTS
Syntax
<compile-time statement>
----<compile-time begin statement>-----I
I
-<compile-time define statement>-I
I
-<compile-time for statement>----I
-<compile-time if statement>-----I
I
-<compile-time invoke statement>-I
I
-<compile-time let statement>----I
I
-<compile-time thru statement>---I
I
-<compile-time while statement>--I
Semantics
Compile-time statements
begin
with
an
apostrophe
(').
which
distinguishes them from other ALGOL constructs. They are recognized at
a very primitive level in the compiler and can, therefore, appear almost
anywhere (for example, between any two ALGOL language components).
The compile-time statements are intended to provide a method for
altering the normal flow of compilation. primarily by conditional and
iterative compilation.
Compile-time statements are terminated
statements.
in
the
same
manner
as
ALGOL
Note that through the use of compile-time variables, a compile-time
arithmetic or Boolean expression can be fully evaluated at compile time
and yet not have the same value each time it is evaluated.
781
compile-Time Facility
'BEGIN Statement
Syntax
<compile-time begin statement>
-- 'BEGIN --<compile-time text>-- 'END --<end remark>--I
<compile-time text>
Any ALGOL source text, including complete compile-time statements.
Semantics
A 'BEGIN statement delimits a portion of ALGOL source text.
It is
normally used in conjunction with 'FOR statements, 'IF statements, and
'THRU statements. If the 'BEG1N statement is executed. the compiler
processes
all the delimited text; otherwise, the compiler skips
(ignores) the text. Anything following the 'END up to the first special
character, END, ELSE, 'END. 'ELSE, or UNTIL is considered to be an <end
remark> and is ignored.
'DEFINE Statement
Syntax
<compile-time define statement>
-- 'DEFINE --<identifier>--
= --<compile-time
statement>--I
<compile-time define identifier>
An <identifier> that is associated with a compile-time statement
a compile-time define statement.
in
782
ALGOL REFERENCE MANUAL
Semantics
The 'DEFINE statement declares an identifier to represent a compile-time
statement.
The compile-time statement is processed when it
identifier in a subsequent 'INVOKE statement.
is
referenced
by
the
'FOR Statement
Syntax
<compile-time for statement)
-- 'FOR --<number ident1f1er)-- := -------------------------------->
>-<compile-time arithmetic expression>-- STEP ---------------------)
>-<compile-time arithmetic expression>-- UNTIL -------------------->
>-<compile-time arithmetic expression>-- DO
>-<compile-time
---~------------------->
statement>-----------------------------------~-----I
Semantics
The 'FOR statement provides iterative compilation of ALGOL source input.
The value of the compile-time arithmetic expression following "STEP" can
be positive or negative but must not be equal to zero.
The action of this statement is similar to that of the non-compile-time
FOR statement.
One exception is that the compile-time arithmetic
expressions following "STEP" and "UNTIL" are evaluated only once. at the
beginning of the 'FOR statement. and are not re-evaluated. even though
their compile-time components can change value.
783
Compile-Time Facility
~
Statement
syntax
<compile-time if statement>
-- 'IF --<compile-time Boolean expression>-- THEN -----------------)
>-<compile-time
statement>-----------------------~-----------------I
I
j-
'ELSE
--<compile-t~me
I
statement>-I
<compile-time Boolean expression>
Any <Boolean expression> that can be fully evaluated at compile
time.
A compile-time Boolean expression consists of constants and
<compile-time variable>s.
Semantics
The 'IF statement
input.
provides
conditional
compilation
of
ALGOL
source
If the value of the compile-time Boolean expression is TRUE. then the
compile-time statement following "THEN" is processed: if it is FALSE.
the compile~time statement following "'ELSE" is processed. if present.
In either case, compilation continues with the statement following the
'IF statement.
784
ALGOL REFERENCE MANUAL
'INVOKE Statement
Syntax
<compile-time invoke statement>
-- 'INVOKE --<compile-time define identifier>--I
Semantics
The 'INVOKE statement causes the compile-time statement
associated
with the compile-time define identifier in
statement to be processed.
previously
'DEFINE
a
'LET Statement
Syntax
<compile-time let statement>
-- 'LET --<compile-time variable>-- .- ----------------------------)
>-<compile-time arithmetic
expression~-----------------------------i
Semantics
The 'LET statement is used to modify the value of a compile-time
variable.
If the compile-time variable was declared using the <vector
length> construct, it must be subscripted by a compile-time arithmetic
expression with a value in the range 0 to (vector length - 1).
785
Compile-Time Facility
'TURU Statement
Syntax.
<compile-time thru statement>
-- 'THRU
--<compile~time
arithmetic expression>-- DO -------------->
>-<compile-time statement>-----------------------------------------I
Semantics
The 'THRU statement provides iterative compilation of ALGOL source
input. The compile-time arithmetic expression must have a value greater
than or equal to zero.
The compile-time statement following
arithmetic expression> times.
If
statEment is skipped.
"DO"
this
is processed <compile-time
value is zero, the 'THRU
'WHILE Statement
Syntax
<compile-time while statement>
-- 'WHILE --<compile-time Boolean expression>-- DO ---------------->
>-<compile-time
Btatement>-------------------------------~---------I
Semantics
The 'WHILE statement provides iterative compilation of ALGOL source
input.
The compile-time Boolean expression is evaluated at the
beginning of the statement. If it is TRUE. tne compile-time statement
is processed. the compile-time Boolean expression is evaluated again,
and this sequence is repeated.
Whenever the compile-time Boolean
expression is FALSE. the 'WHILE statement is finished, and compilation
continues with the following statement.
78b
ALGOL REFERENCE MANUAL
EXTENSION TO IDE DEFINE DECLARATION
The following extension to the DEFINE
using the compile-time facility.
declaration
is
available
when.
Syntax
<definition>
--<identifier>---------------------------- =
I
1
I
i-<formal symbol part>-i 1- :=
>-<compile-time text>-- #
-----------------.--~-->
-j
-----------------------------------------1
See also
<formal symbol part>. . . . . . . . . . . • . . . . . . . . . .
60
Semantics
If a define identifier is declared using the assignment operator (:=).
then any compile-time statements in the compile-time text are evaluated
once at the time of, and in the scope of. the DEFINE declaration.
Otherwise~ the compile-time items in the compil~-tim~ text are evaluated
on each invocation of the define identifier.
787
Compile-Time Facility
COMPILE-TIME COMPILER CONTROL OPTIONS
The following compiler control options are available only in the
compile-time facility.
For more information on compiler control options
and the printer listing file of the compiler, refer to the "Compiling
Programs" chapter.
<ctlist option>
-- CTLIST --I
(Type:
Boolean. Default value:
FALSE)
If both the LIST option and the CTLIST option are TRUE, all input
records processed are written to the printer listing.
In particular.
during iterative compile-time statements,
input records that
are
compiled repeatedly are listed repeatedly.
These input records are
identified by an asterisk (*) just to the left of the sequence number.
If the LIST option is TRUE but the CTLIST option is FALSE, input records
are written to the printer listing only the first
time they are
compiled.
The value of the CTLIST option is ignored if the LIST option
is FALSE.
<ctmon option>
-- CTMaN --I
(Type:
Boolean. Default value:
FALSE)
If both the LIST option and the CTMaN option are TRUE, all assignments
to compile-time variables are monitored and written to the printer
listing.
The current value of a compile-time variable when it 1s
referenced and the new value when it is changed are listed.
If the LIST
option is TRUE and the CTMaN option is FALSE, this monitor information
does not appear in the printer listing. The value of the eTMaN option
is ignored if the LIST option is FALSE.
788
ALGOL REFERENCE MANUAL
<cttrace option>
-- CTTRACE --I
(Type:
Boolean, Default value:
FALSE)
If both the LIST option and the CTTRACE option are TRUE, values of
certain expressions that are components of compile-time statements are
written to the printer listing. If the LIST option is TRUE and the
CTTRACE option is FALSE, this information does not appear in the printer
listing. The value of the CTTRACE option is ignored if the LIST option
is FALSE.
<listSkip option>
-- LISTSKIP --I
(Type:
Boolean, Default value:
TRUE)
If both the LIST option and the LISTSKIP option are TRUE. all records
are written to the printer listing whether or not they are skipped.
Skipped records are denoted in the listing by the word "SKIP" to the
right of the sequence number.
If the LIST option is TRUE and the
LISTSKIP option is FALSE. source records that are skipped by the
compile-time facility are not written to the printer listing. The value
of the LISTSKIP option is ignored if the LIST option is FALSE.
11
BATCH FACILITY
The batch facility allows more efficient use of system resources by
enabling a group of programs possessing certain common characteristics
to share many systerr. overhead functions normally associated with
individual jobs.
Overhead functions that can be shared include job
initialization. job termination,
linking
of
intrinsics.
memory
allocation, and so on.
Programs submitted as part of a batch
according to the following restrictions:
for
are
syntax
compiled
errors
and
only
executed
1.
The programs are compiled
one-time execution.
or
for
2.
If a program declares more than one printer file. all output is
directed to the same physical file. Likewise. if a prograrr
declares more than one card file, all input is taken from the
same physical file.
3.
If a program explicitly opens or closes the printer file. that
program is discontinued. and the next program in the batch is
initiated.
4.
If a
program
requires
operator
intervention.
it
is
discontinued, and the next program in the batch is initiated.
5.
If a program attempts to initiate a task, it is
and the next program in the batch is initiated.
b.
WAIT statements are allowed but have no effect.
7.
The source records of all programs in the batch
same character type.
8.
In FILE declarations, the values assigned to file attributes
must not be variables or expressions involving variables.
discontinued.
must
use
the
790
ALGOL REFERENCE MANUAL
9.
The following compiler control options are invalid or ignored.
AUTOBIND
BIND
BINDER
DUMPINFO
ERRLIST
EXTERN A:'
GO TO
HOST
INCLNEW
INCLSEQ
INCLUDE
INITIALIZE
INSTALLATION
INTRINSICS
LEVEL
LIBRARY
LINEINFO
LISTINCL
LOADINFO
MAKEHOST
MCP
MERGE
NEW
NEWSEQERR
NOBINDINFO
NOXREFLIST
PURGE
SEGDESCABOVE
SEPCOMP
SHARING
STOP
TARGET
TIME
USE
VERSION
XDECS
XREF
XREFFILES
XREFS
791
Batch Facility
ll!fY.7
BATCH SOURCE
The ALGOL compiler performs batch compilation only if the compiler is
initiated by the Work Flow Langua.ge (WFL). and the source input is in
th~ form of <batch source input>.
If a ~job specifier> occurs in a
CANDE-initiated compilation, the compilation is discontinued.
All batch source ihput must have the following form:
Syntax
I <------{
---------~------------------(job>--~-!
I
I
I-<time restr1ctions)-1
<time restrictions>
! <---------------------------_·_----------1
I
1
I
1
1<--·--------------------·--------1 I
I
1
I
S -----<procesitlme restriction>--------I
I
I
I-<iotime restriction~---~--I
<processtime restriction>
-- PROCESSTIME --
= --<deCimal
number>--I
<iotime restriction>
-- IOTIME -- = --<decimal number;--!
792
ALGOL REFERENCE MANUAL
<job"
S --<job specifier>-------------------------<bloCk>-- . --------)
1
j-<time restrictions>-I
)------------------------------------------------------------------1
1
1-
S --<entry specifier>----------!
!
i-<data>-i
<job specifier>
-- JOB -----------------I
I
I-<job title>-I
<job title>
Any valid file title.
<entry specifier>
ENTRY --I
<data>
Input data to be read by the program when it is executed.
Semantics
Batch source input consists of one or more individual programs or
"jobs." Jobs are delimited in batch source input by "$ <job specifier>"
records. Each job can be either compiled for syntax only or compiled
and then executed. A job is executed if it contains a "$ ENTRY" record.
and if the job needs input during its execution, this data follows the
"$ ENTRY"
record.
Maximum proces sor times. and I/O times can be
specified for each job or for all jobs in a batch. Printed output for
all jobs in a batch is written to the same file and is printed in one
listIng. '
The <processtime restriction>, <iotime restriction>,
<job specifier;,
and <entry specifier> constructs are valid only for batch compilatio~
and are not compiler control options.
792
Batch Facility
The individual syntactic constructs of <batch source
described in more detail in the following paragraphs.
input>
are
<time restrictions>
The <processtime restriction) and <iotime restriction>
constructs
specify the maximum processor time and maximum I/O time, respectively,
allowed for the execution of a job before it is discontinued.
If the time restrictions appear before the first job in a batch,
apply to the execution of every job in the batch.
If the
restrictions appear within a job, they apply to the execution of
job only, but they are meaningful only if they specify less time
the time restrictions. if any. appearing before the first job in
batch.
they
time
that
than
the
<job>
Each job in the batch source data consists of a complete program that is
compiled for syntax only or for one-time execution. A job can include
its own time restrictions and compiler control records.
<job specifier>
The first record in leach job must be the "$ <job specifier>" record. If
a job title is specified in the <jab specifier> construc~. it is used to
identify the printed output produced by that job.
<block.>
The
<block>
and
any
compiler
control
records
that
follow
"$ <job specifier>"
record and precede the next "$ ENTRY" record,
any, or "$ <job specifier>" record make up the ALGOL program.
the
if
<entry specifier>
The "s <entry specifier>" record specifies that the program is to be
executed if no syntax errors are found and indicates the beginning of
any input data to be used during executio~. If no "$ <entry specifier>"
record appears in the job., then the program is compiled for syntax
errors only; it is not executed.
794
ALGOL REFERENCE MANUAL
<data>
If a jOb needs input data during execution, the input data appears after
the "$ ENTRY" record and before the next job. if any.
Example
?BEGIN JOB EXAMPLEBATCH;
?COMPILE BATCHA ALGOL:
?ALGOL DATA
S PROCESSTIME = 5.5 IOTIME = 1
$ JOB Al
$ SET LIST SEQ
BEGIN
FILE RDR(KIND = READER);
INTEGER I:
ARRAY Z[0:2J;
READ(RDR,/,FOR I .- 0 STEP 1 UNTIL 2 DO Z[IJ):
END.
$ ENTRY
2.315.3.71828 .. 5772,
$ JOB A2
BEGIN
INTEGER A.B,C;
A := B ++ C; % A SYNTAX ERROR
END.
SENTRY
$ JOB A3
BEGIN
REAL PI;
PI .- 22/7;
END.
S JOB AI.!
$ PROCESSTIME = 2.5 IOTIME
0.5
BEGIN
LABEL AGAIN;
REAL X;
AGAIN:
X := 355/133;
GO TO AGAIN;
END.
SENTRY
?END JOB
This example shows a WFL job consisting of one batch compilation.
The
batch contains four programs or jobs. No job in this batch is allowed
more than 5.5 seconds of processor time or I second of I/O time.
795
Batch Faci lity
JOb Al compiles correctly and is executed using the one record of data
immediately following its "$ ENTRY" record.
Job A2 is not executed
because it contains a syntax error but would be executed if it were free
of errors.
Job A3, though syntactically correct. is not executed
because it does not contain a "$ ENTRY" record.
JOb A4 is allowed only 2.5 seconds of processor time and 0.5 seconds of
I/O time, compared to 5.5 seconds and 1 second, respectively, for the
other thre~ jobs in the batch.
Job .A4 compiles correctly and is
executed;
however, because it contains an infinite loop, it is
discontinued after its allotted 2.5 seconds of processor time.
796
ALGOL REFERENCE MANUAL
IMPLEMENTATION SCHEME
The goal of the batch facility is to eliminate as much system overhead
as possible by reducing the number of tasks initiated within the running
environment of A Series and B 5000/B 6000/B 7000 Series systems.
An entire batch is presented to the compiler as one file. thereby
avoiding repeated initiation of the compiler. The compilation process
for each individual job within a batch is virtually the same as that for
nonbatched programs and yields equally efficient object code. When the
compiler finishes compiling the batch, it generates special object code
that links each job to the next one. When a job is not to be executed
(the "$ ENTRY" record is not present or syntax errors occurred during
compilation), it is not linked to the other jobs. When compilation is
complete, the object code for all jobs in the batch resides in onE~ disk
file.
The printed output from the compiler is directed to a backup printer
file with an alter~d BDNAME task attribute so that the output is not
automatically printed. Logging information regarding the compilation is
also saved in this file. The execution of the object code proceeds as
follows:
1.
The D2 stack is built.
2.
The batchmonitor intrinsic is called and
that serially calls each individual job.
3.
The batchmonitor intrinsic processes the procedure passed to
it. If any job causes a fatal run-time error. the batchmonitor
intrinsic executes a procedure that goes automatically to the
next individual job.
4.
The batchmonitor intrinsic rewinds the two backup printer
files. extracts the logging information. collates the output
into a new printer file, and returns control to the Master
Control Program (MCP).
passed
a
procedure
All jobs share the same printer file and intrinsics and can even share
the same object code segments. The individual jobs run serially and
share the same stack space.
Batch Facility
A job is protected from previous jobs by the batchmonitor intrinsic. If
one job is discontinued with an error. execution is re-initiated by the
batchmonitor intrinsic at the next individual job.
If any job uses
excessive I/O or processor time. the batchmohitor intrinsic terminates
that job. Likewise,the batchmonitor intrinsic enforces the rule that
no operator messages requiring responses are allowed by terminating any
job that causes such a message.
The batchmonitor intrinsic extracts the logging information from the two
printer files and summarizes it at the end of the output for each job.
This summary procedure is easily modified to provide an interface with
the accounting system of a given installation. Two words in each log
record furnished by the compiler and the individual job are spares, thus
facilitating any installation extensions.
A
RESERVED
wmum
A <reserved word> in Extended ALGOL has the same syntax
identifier. The reserved words are divided into three types.
as
an
A reserved word of type 1 can never be declared as an identifier; that
is, it has a predefined meaning that can'not be changed. For example,
because LIST is a type 1 reserved word. the declaration
ARRAY LIST[O:999]
is flagged with a syntax error.
A reserved word of type' 2 can be redeclared as an identif ier; it then
loses its predefined meaning in the scope of that declaration. For
example, because IN is a type 2 reserved word, the declaration
FILE IN(KIND
= READER)
is legal. but in the scope of the declar;ation. the statement
SCAN P WHILE IN ALPHA
is flagged with a syntax error on the word "IN".
If a type 2 reserved word is used as a variable in a program but it
is
not declared as a variable. then the error message that results 1s not
the expected "UNDECLARED IDENTIFIER." Instead. it may be "NO STATEMENT
CAN START WITH THIS."
A reserved word of type- 3 is con text - sens it i ve.
I t can be redeclared as
an identifier. and, if it is used where the syntax calls for that
reserved word. it carries the predefined meaning; oth~rwise. it carries
the user-declared meaning.
The different meanings for the type 3
reserved word STATUS are illustrated in the following example.
BEGIN
TASK 'I':
REAL STATUS:
"0 IN THE NEXT STATEMENT. "STATUS'" IS A REAL VARIABLE
STATUS := 4.5:
~~ IN THE NEXT STATEMENT, "STATUS'" IS A TASK ATTRIBUTE
IF T.STATUS = VALUE(TERMINATED) THEN
% IN THE NEXT STATEMENT. "STA'Ims" IS A REAL VARIABLE
STATUS := 10.0:
END.
800
ALGOL REFERENCE MANUAL
Type 3 reserved words include the following:
File attribute names
Task attribute names
Library attribute names
Direct array attribute names
Mnemonics for attribute values
All file attributes, direct array attributes, and mnemonics described in
the "I/O Subsystem Reference Manual" are type 3 reserved words in ALGOL.
All task attributes and mnemonics described in the "Work Flow Language
(WFL) Reference Manual" are type 3 reserved words tn ALGOL.
RESERVED WORDS LIST
The following is an alphabetical list of reserved words for Extended
ALGOL. The number in parentheses following each word indicates the type
of the reserved word.
For example, "FOR (1)" indicates that FOR is a
type 1 reserved word.
ABS (2)
ACCEPT (2)
ACTUALNAME ( 3 )
ALL (3)
ALPHA (1)
ALPHA6 (3)
ALPHA7 (3)
ALPHA8 (3)
AND (2)
ANY FAULT (3)
ARCCOS (2)
ARCSIN (2)
ARCTAN (2)
ARCTAN2 (2)
ARRAY (1)
ARRAYS (3)
ARRAYSEARCH ( 2 )
AS (3)
ASCII ( 2 )
ASCIITOBCL (3)
ASCIITOEBCDIC (3)
ASCIITOHEX ( 3 )
ATANH (2)
ATTACH (2)
AVAILABLE (2)
BACKUPPREFIX ( 3 )
BASE (3)
BCL (2)
BCLTOASCII ( 3)
BCLTOEBCDIC (3)
BCLTOHEX (3)
BEGIN (1)
BOOLEAN (1)
BREAKPOINT ( 2 )
BY (2)
BYFUNCTION (3)
BYTITLE (3)
CABS (2)
CALL (2)
CALLING (2)
CANCEL (2)
CASE (2)
CAT (2)
CAUSE (2)
CAUSEANDRESET ( 2 )
CCOS (2)
CEXP (2)
CHANGEFILE ( 2 )
CHARGECODE ( 3 )
CHECKPOINT ( 2 )
CHECKSUM (2)
CLASS (3)
CLN (2)
CLOSE (2)
CODE (3)
COMMENT (1)
COMPILETIME ( 2 )
COMPILETYPE ( 3 )
COMPLEX (2)
CONJUGATE (2)
CONTINUE (1)
COREESTIMATE ( 3 )
COS (2)
COSH (2)
COTAN (2)
CRUNCH (3)
CSIN (2)
CSQRT (2)
DABS (2)
DAND (2)
DARCCOS (2)
DARCSIN (2)
DARCTAN (2)
DARCTAN2 (2)
DBS (3)
801
Reserved Words
Reserved Words. Continued
DCOS (2)
DCOSH (2)
DEALLOCATE (2)
DECIMAL (2)
DECIMALPOINTISCOMMA (3)
DECLAREDPRIORITY (3)
DEFINE (2)
DELINKLIBRARY (2)
DELTA (2)
DEQV (2)
DERF (2)
DERFC (2)
DETACH (2)
DEXP (2)
DGAMMA (2)
DICTIONARY (2)
DIGITS (2)·
DIMP (2)
DINTEGER (2)
DIRECT (1)
DISABLE (2)
DISCARD (3)
DISK (3)
DISKPACK (3)
DISPLAY (2)
DIV (2)
DLGAMMA (2)
DLN (2)
DLOG (2)
DMAX (2)
lDMIN (2)
lDNABS (2)
DNOT (2)
DO (1)
DONTWAIT (2)
DOR (2)
DOUBLE (1)
DROP (2)
DSCALELEFT (2)
DSCALERIGHT (2)
DSCALERIGHTT (2)
DSIN (2 ~i
DSINH (2)
DSQRT (2)
DTAN (2)
DTANH (2)
DUMP (2)
EBCDIC (2)
EBCDICTOASCII (3)
EBCDICTOBCL (3)
EBCDICTOHEX (3)
ELAPSEDTI ME (3)
ELSE (1)
EMPTY (2)
EMPTY4 (2)
EMPTY7 (2)
EMPTY8 (2)
ENABLE (2)
END (1)
ENTlER (2)
EQL (2)
EQV (2)
ERF (2)
ERFC (2)
EVENT (1)
EXCEPTIONEVENT (3)
EXCEPTIONTASK (3)
EXCHANGE (2)
EXP (2)
EXPONENTOVERFLOW (3)
EXPONENTUNDERFLOW (3)
EXPORT (2)
EXTERNAL (2)
FALSE (1)
FAMILY (3)
FILE (1)
FILECARDS (3)
FILES (3)
FILL (2)
FIRST (2)
FIRSTONE (2)
FIRSTWORD (2)
FIX (2)
FOR (1)
FORMAL (2)
FORMAT (1)
FORWARD (2)
FREE (2)
FREEZE (2)
FUNCTIONNAME (3)
GAMMA (2)
GEQ (2)
GO (1)
GTR (2)
HAPPENED (2)
HEAD (2)
HEX (2)
HEXTOASCII (3)
HEXTOBCL (3)
HEXTOEBCDIC (3)
HISTORY (3)
IF (1)
IMAG (2)
IMP (2)
IN (2)
INITIATOR (3)
INTEGER (1)
INTEGEROVERFLOW (3)
INTEGERT (2)
INTERRUPT (2)
INTNAME (3)
INVALIDADDRESS (3)
INVALIDINDEX (3)
INVALIDOP (3)
INVALIDPROGRAMWORD (3)
IS (2)
ISNT (2)
JOBNUMBER (3)
LABEL (1)
LB (2)
LENGTH (2)
LEQ (2)
LIBACCESS (3)
LIBERATE (2)
LIBPARAMETER (3)
LIBRARIES (3)
LIBRARY (2)
LINE (2)
LINENUMBER (2)
LINKLIBRARY (;~)
LIST (1)
LISTLOOKUP (2)
LN (2)
LNGAM~..A
(2)
LOCK (2)
LOCKED (3)
LOG (2)
LONG (1)
LOOP (3)
LSS (2)
MASKSEARCH (2)
MAX (2)
MAXCARDS (3)
MAXIOTIME (3)
MAXLINES (3)
MAXPROCTIME (3)
MEMORYPARITY (3)
MEMORYPROTECT (3)
MERGE (2)
MESSAGESEARCHER (2)
MIN (2)
MOD (2)
MONITOR (2)
802
ALGOL REFERENCE MANUAL
Reserved Words, Continued
MUX (2)
MYJOB (2)
MYSELF (2)
NABS (2)
NAME (3)
NEQ (2)
NO (2)
NORMALIZE (2)
NOT (2)
NUMERIC (2)
OF (2)
OFFER (3)
OFFSET (2)
ON (2)
ONES (2)
OPEN (2)
OPTION (3)
OR (2)
ORGUNIT (3)
OUT (3)
OUTPUTMESSAGE (2)
OWN (1)
PACK (3)
PAGED (3)
PARTNER (3)
PERMANENT (3)
PICTURE (2)
POINTER (1)
POTC (2)
POTH (2)
POTL (2)
PRIVATELIBRARIES (3)
PROCEDURE (1)
PROCESS (2)
PROCESSID (2)
PROCESSIOTIME (3)
PROCESSTIME (3)
PROCURE (2)
PROGRAMDUMP (2)
PROGkAMMEDOPERATOR (3)
PURGE (2)
RANDOM (2)
RB (2)
READ (2)
READLOCK (2)
REAL (1)
REEL (3)
REFERENCE (1)
REMAININGCHARS (2)
REMOVEFILE (2)
REPEAT (2)
REPLACE (2)
RESET (2)
RESIZE (2)
RESTART (3)
RETAIN (3)
REWIND (2)
RUN (2)
SCALELEFT (2)
SCALERIGHT (2)
SCALERIGHTF (2)
SCALERIGHTT (2)
SCAN (2)
SCANPARITY (3)
SDIGITS (2)
SECONDWORD (2)
SEEK (2)
SET (2)
SETACTUALNAME (2)
SIBS (3)
SIGN (2)
SIN (2)
SINGLE (2)
SINH (2)
SIZE (2)
SKIP (2)
SORT (2)
SPACE (2)
SQRT (2)
STACKER (2)
STACKNO (3)
STACKSIZE (3)
STARTTIME (3)
STATION (2)
STATUS (3)
STEP (1)
STOP (2)
STOPPOINT (3)
STRING (2)
STRINGPROTECT (3)
STRING4 (2)
STRING7 (2)
STRING8 (2)
SUBFILE (2)
SUBSPACES (3)
SWITCH (1)
TADS (3)
TAIL (2)
TAKE (2)
TAN (2)
TANH (2)
TARGETTIME (3)
TASK (1)
TASKATTERR (3)
TASKFILE (3)
TASKVALUE (3)
TEMPORARY (3)
THEN (1)
THRU (2)
TIME (2)
TIMELIMIT (2)
TIMES (2)
TITLE (3)
TO (2)
TRANSLATE (2)
TRANSLATETABLE (1)
TRUE (1)
TRUTHSET (1)
TYPE (3)
UNTIL (1)
USERCODE (3)
VALUE (1)
WAIT (2)
WAITANDRESET (2)
WHEN (2)
WHILE (1)
WITH (2)
WORDS (2)
WRITE (2)
ZERODIVIDE (3)
ZIP (1)
803
Reserved Wo:rds
R1!:SERVED WORDS BY TYPE
~
1. Reserved Words
ALPHA
ARRAY
BEGIN
BOOLEAN
COMMENT
CONTINUE
DIRECT
DO
DOUBLE
ELSE
END
EVENT
FALSE
TY~
2
FILE
FOR
FORMAT
GO
IF
INTEGER
LABEL
LIST
LONG
OWN
POINTER
PROCEDURE
REAL
REFERENCE
STEP
SWITCH
TASK
THEN
TRANSLATETABLE
TRVE
TRUTHSET
UNTIL
VALUE
WHILE
ZIP
CLOSE
COMPILETIME
COMPLEX
CONJUGATE
COS
COSH
COTAN
CSIN
CSQRT
DABS
DAND
DARCCOS
DARCSIN
DARCTAN
DARCTAN2
DCOS
DCOSE
DEALLOCATE
DECIMAL
DEFINE
DELINKLIBRARY
DELTA
DEQV
DERF
DERFC
DETACH
DEXP
DGAMMP.
DICTIONARY
DIGITS
DIMP
DINTEGER
DISABLE
DISPLAY
DIV
DLGAMMA
DLN
DLOG
Reserved Words
ABS
ACCEPT
AND
ARCCOS
ARCSIN
ARCTAN
ARCTAN2
ARRAY SEARCH
ASCII
ATANH
ATTACH
AVAILABLE
BCL
BREAKPOINT
BY
CABS
CALL
CALLING
CANCEL
CASE
CAT
CAUSE
CAUSEANDRESE'T
ecos
CEXP
CHANGEFILE
CHECKPOINT
CHECKSUM
CLN
DMAX
DMIN
DNABS
DNOT
DONTWAIT
DaR
DROP
DSCALELEFT
DSCALERIGHT
DSCALERIGHTT
DSIN
DSINH
DSQRT
DTAN
DTANH
DUMP
EBCDIC
EMPTY
EMPTY4
EMPTY7
804
ALGOL REFERENCE MANUAL
Type 2 Reserved Words. Continued
EMPTY8
ENABLE
ENTlER
EQL
EQV
ERF
ERFC
EXCHANGE
EXP
EXPORT
EXTERNAL
FILL
FIRST
FIRSTONE
FIRSTWORD
FIX
FORMAL
FORWARD
FREE
FREEZE
GAMMA
GEQ
GTR
HAPPENED
HEAD
HEX
lMAG
IMP
IN
INTEGERT
INTERRUPT
IS
ISNT
LB
LENGTH
LEQ
LIBERATE
LIBRARY
LINE
LINENUMBER
LINKLIBRARY
LISTLOOKUP
LN
LNGAMMA
LOCK
LOG
LSS
MASKSEARCH
MAX
MERGE
MESSAGESEARCHER
MIN
MOD
MONITOR
MUX
MYJOB
MYSELF
NABS
NEQ
NO
NORMALIZE
NOT
NUMERIC
OF
OFFSET
ON
ONES
OPEN
OR
OUTPUTMESSAGE
PICTURE
POTC
paTH
POTL
PROCESS
PROCESSID
PROCURE
PROGRAMDUMP
PURGE
RANDOM
RB
READ
READLOCK
REMAININGCHARS
REMOVEFILE
REPEAT
REPLACE
RESET
RESIZE
REWIND
RUN
SCALELEFT
SCALERIGHT
SCALERIGHTF
SCALERIGHTT
SCAN
SDIGITS
SECONDWORD
SEEK
SET
SETACTUALNAME
SIGN
SIN
SINGLE
SINH
SIZE
SKIP
SORT
SPACE
SQRT
STACKER
STATION
STOP
STRING
STRING4
STRING;
STRING8
SUBFILE
TAIL
TAKE
TAN
TANH
THRU
TIME
TIMELIMIT
TIMES
TO
TRANSLATE
WAIT
WAITANDRESET
WHEN
WITE
WORDS
WRITE
805
Reserved Words
.I~
1 Reserved Words
ACTUALNAME
ALL
ALPHA6
ALPHA7
ALPHA8
ANY FAULT
ARRAYS
AS
ASCIITOBCL
ASCIITOEBCDIC
ASCIITOHEX
BACKUPPREFIX
BASE
BCLTOASCII
BCLTOEBCDIC
BCLTOHEX
BYFUNCTION
BYTITLE
CHARGECODE
CLASS
CODE
COMPILETYPE
COREESTIMATE
CRUNCH
DBS
DECIMALPOINTISCOMMA
DECLAREDPRIORITY
DISCAR[:
DISK
DISKPACY
EBCDICTOASCII
EBCDICTOBCL
EBCDICTOHEX
ELAPSEDTIME
EXCEPTIONEVENT
EXCEPTIONTASK
EXPONENTOVERFLOW
EXPONENTUNDERFLOW
FAMILY
FILECARDS
FILES
FUNCTIONNAME
HEXTOASCII
HEXTOBCL
HEXTOEBCDIC
HISTORY
INITIATOR
INTEGEROVERFLOW'
INTNAME
INVALIDADDRESS
INVALIDINDE}:
INVALIDOP
INVALIDPROGRAMWORD
JOBNUMBER
LIBACCESS
LIBPARAMETER
LIBRARIES
LOCKED
LOOP
MAXCARDS
MAXIOTIME
MAXLINES
MAXPROCTIME
MEMORYPARITY
MEMORY PROTECT
NAME
OFFER
OPTION
ORGUNIT
OUT
PACK
PAGED
PARTNER
PERMANENT
PRIVATELIBRARIES
PROCESSIOTIME
PROCESSTIME
PROGRAMMEDOPERATOR
REEL
RESTART
RETAIN
SCANPARITY
SIBS
STACKNO
STACKSIZE
STARTTIME
STATUS
STOPPOINT
STRINGPROTECT
SUBSPACES
TADS
TARGETTIME
TASKATTERR
TASKFILE
TASKVALUE
TEMPORARY
TITLE
TYPE
USER CODE
ZERODIVIDE
807
~
DATA REPRESENTATION
£IELD NOTATION
The notation "[m:nJ" is used in this manual to describe fields within
data words. The 48 accessible bits of a data word are considered to be
numbered. with the leftmost bit numbered as bit 47 and the rightmost bit
numbered as bit O. In the notation [m:nJ. "m" denotes the number of the
leftmost bit of the field being d~scribed, and "n" denotes the number of
bits in the field. For example. the field indicated by the shaded area
in Figure B-1 (bits 28 through 24) is described as [28:5J.
47'
43
39
19
15
11
7'
3
42
38
18
14
10
e
2
41
37'
17'
13
5
1
40
36
16
12
Figure B-1.
8
o
Field Notation, [28:5J
All data words have a field associated with them that is called the
"tag" of the word. The tag identifies the type of the data word; that
is, whether the word is an operand. descriptor, and so on. The tag is
not accessible to ALGOL programs.
Hexadecimal format is used extensively in this manual to indicate word
contents. This format is particularly suited to describe the value of a
data word. because each hexadecimal digit indicates the contents of a
4-bit field.
Such fields can be visualized as the columns in Figure
B-1.
808
ALGOL REFERENCE MANUAL
CHARACTER REPRESENTATION
Characters are stored in fields of one. two. three, four. six. or eight
bits.
In the table below. the Character Type column lists the valid
ALGOL character types. The Field Size and Bits Used columns show the
field
size in bits and the number of bits within that field.
respectively. that are used for storing each type of character.
The
Valid Constructs column shows the character-oriented ALGOL constructs
that are used to manipulate each character type.
Character Type
Field
Size
Bits
Used
---------
Valid Constructs
----------------
EBCDIC
8
8
ASCII
8
7
BCL
b
6
Hexadecimal (HEX)
4
4
Octal
3
3
pointer, character array,
string. string literal
pointer. character array.
string, string literal
pointer, character array.
string literal
pointer, character array,
string. string literal
string literal
Quaternary
2
2
string literal
Binary
1
1
string literal
Figures B-2 through B-5 illustrate how the various character
stored within a data word.
types
are
Data Representation
o
I
/
-
2
1
I
v
v
47
43
39
:::15
31
46
42
38
:;14
45
41
37
44
40
36
I
4
3
I
I
5
I
I
v
27
23
1.9
15
11
7
3
30
26
22
1.8
14
10
6
2
:13
29
25
21
17
13
9
5
1
~32
28
24
20
1.6
12
8
4
0
I
1
I
,,------.-----/
I
Most Significant
Character
Least Significant
Character
,.,'----.-----/
Figure B-·2.
EBCDIC Characters (8-Bit Fields)
Figure B-3 shows that ASCII characters~ which are 7-bit characters, are
stored in 8-bit fields (as are EBCDIC characters). The zeros shown for
bits 7. 15. 23. 31. 39, and 47 indicate that these bits are a when ASCII
characters are stored.
o
2
1
I
I
I
-.
0
0
4
3
I
v
0
5
I
v
I
0
0
0
47
4::3
39
35
31
27
23
19
15
11
46
42
38
34
30
26
22
18
14
10
45
41
37
33
29
25
21
17
13
9
44
40
36
32
28
24
20
16
12
8
!
7
3
6
2
5
1
4
0
,,'-_---,_---J/
"'----..------//
I
I
~1ost
Significant
Character
Figure B-3.
least Significant
Character
ASCII Characters (8-Bit Fields)
810
ALGOL REFERENCE MANUAL
Most Significant
Character
oI
,/
6
4
I
/
I
/
41
43
3~
35
31
21
23
19
15
1.1
7
3
46
42
39
34
30
26
22
18
14
10
6
2
45
4.1
37
33
2Q
25
21
17
13
9
5
1
44
40
36
32
28
24
20
16
1.2
8
4
"-
/
I
1
"-
"-
/'
I
I
5
3
'---
/
0
I
/
7
least Significant
Character
Figure B-4.
o
1
2
3
BCL Characters (6-Bit Fields)
5
4
6
8
7
10
9
11
47
43
39
35
31
27
23
19
15
11
7
3
46
42
38
34
30
26
22
18
14
10
6
2
45
41
37
33
29
25
21
.17
13
Q
5
1
44
40
36
32
28
24
20
16
.12
8
4.
0
'--,--/
'--,--/
Most
Least
Significant
Character
Significant
Character
Figure B-5.
Hexadecimal Characters (4-Bit Fields)
811
Data Representation
Character Values and Graphics
The following is a list of the 256 EBCDIC values represented in binary.
octal. decimal, and hexadecimal formats. The corresponding BCL, ASCII.
and EBCDIC graphics (as they appear when printed using an EBCDIC96 print
t.rain) are also sholwn.
In the EBCDIC column. corresponding standard
mnemonics appear for some nonprintable EBCDIC values.
Binary
00000000
00000001
00000010
00000011
00000100
00000101
00000110
00000111
00001000
00001001
00001010
00001011
00001100
00001101
00001110
00001111
00010000
00010001
00010010
00010011
00010100
00010101
00010110
00010111
00011000
00011001
00011010
00011011
00011100
00011101
00011110
00011111
00100000
00100001
00100010
00100011
00100100
00100101
00100110
00100111
00101000
Octal Decimal Hexadecimal BCL ASCII EBCDIC
000
001
002
003
004
005
006
007
010
011
012
013
014
015
016
017
020
021
022
023
024
025
026
027
030
031
032
033
034
035
036
037
040
041
042
043
044
045
046
047
050
o
o
3
4
7
00
01
02
0:3
04
0.5
0:6
07
8
Oi8
8
1
2
4
5
b
NUL
SOH
STX
ETX
1
2
HT
5
6
DEL
7
9
Oi9
9
10
11
12
13
14
15
OA-
11
OS
OC
@
VT
?
Ib
10
11
1:2
13
14
15
FF
CR
SO
SI
DLE
DCl
DC2
DC3
17
18
19
20
21
OD
OE
OF
22
16
23
24
25
17
18
19
+
A
B
C
D
E
F
NL
BS
G
CAN
EM
H
26
1A
27
28
lC
29
ID
30
31
32
1:E
RS
IF
210
US
IE
33
2:1
34
22
36
37
38
40
2:3
2;4
21:·
2;6
2:7
2;8
FS
&
(
K
L
M
N
o
p
Q
GS
"
#
$
%
&
LF
ETB
ESC
/.
812
ALGOL REFERENCE MANUAL
Character Values and Graphics. continued
Binary
-----00101001
00101010
00101011
00101100
00101101
00101110
00101111
00110000
00110001
00110010
00110011
00110100
00110101
00110110
00110111
00111000
00111001
00111010
00111011
00111100
00111101
00111110
00111111
01000000
01000001
01000010
01000011
01000100
01000101
01000110
01000111
01001000
01001001
01001010
01001011
01001100
01001101
01001110
01001111
01010000
01010001
01010010
01010011
01010100
01010101
01010110
01010111
01011000
01011001
Octal Decimal Hexadecimal BCL ASCII EBCDIC
------------ ----------R
051
41
29
$
052
2A
42
*
+
053
43
2B
*
054
2C
44
ENQ
055
2D
45
ACI<
056
46
2E
057
BEL
47
2F
/
060
48
30
0
061
1
49
31
/
.,
SYN
062
32
S
50
T
063
3
51
33
U
4
064
52
34
V
065
53
35
5
W
066
54
30
0
X
7
067
37
EOT
55
070
Y
38
56
8
57
071
39
Z
9
3A
072
58
073
59
3B
7e
DC4
074
3C
60
<
=
NAI<
3D
=
075
61
3£
076
62
>
?
SUB
077
3F
63
"
@
SP (blank)
100
64
40
A
101
65
41
102
42
B
66
67
C
103
43
104
44
D
68
105
69
E
45
106
70
F
40
71
107
47
G
72
110
H
48
III
73
49
I
74
112
4A
J
113
75
4B
K
114
76
4C
L
77
115
4D
M
+
78
4£
N
116
79
117
4F
0
&
120
80
P
50
Q
121
51
81
122
R
52
82
123
83
53
S
124
84
54
T
125
85
U
55
V
126
86
56
127
87
57
W
130
X
88
58
8e;
131
Y
59
4-
0'
813
Data Representation
Character Values and Graphics, continued
Binary
-----0.10.110.10.
0.10.110.11
0.10.1110.0.
0.10.1110.1
0.10.11110.
0.1011111
0.110.0.0.0.0.
0.110.0.0.0.1
0.110.0.0.10.
0.110.0.0.11
0.110.0.10.0.
01100.10.1
0110.0110.
0.110.0.111
0110.10.0.0
0110.10.0.1
0.110.10.10
0.110.10.11
0110110.0.
0110.110.1
0110.1110
0110.1111
01110.000.
0.1110.0.0.1
01110.010
0.1110.011
0.1110.10.0.
0.1110.10.1
0.1110.110.
0.1110.111
0.11110.0.0.
011110.0.1
0.11110.10.
0.11110.11
0111110.0.
0111110.1
01111110.
01111111
10.0.00.0.0.0.
10.0.0.0.0.0.1
10.0.0.0.0.10.
100.0.0.0.11
10.00.0.10.0.
10.0.0.0.10.1
100.0.0.110.
10.0.0.0.111
10.0.0.10.0.0.
10.0.0.10.0.1
10.0.0.10.10.
Octal Decimal Hexadecimal BeL ASCII EBCDIC
------------ ----------]
Z
SA
90.
132
[
$
5B
91
133
5C
\
92
134
*
]
93
5D
135
5E
94
136
5F
137
95
60.
96
140.
a
61
97
/
141
b
62
98
142
c
63
99
143
d
64
144
10.0
e
65
10.1
145
f
66
102
146
g
67
147
103
h
68
104
150
i
69
151
105
j
6A
106
152
k
6B
153
10.7
1
%
bC
154
10.8
m
6D
155
109
n
>
bE
156
110
?
0
6F
III
157
70.
112
160
P
q
71
113
161
r
72
114
162
s
73
163
115
t
74
116
164
u
75
117
165
v
76
118
166
w
77
167
119
x
78
120.
170.
7q
121
171
Y
z
7A
172
122
{
#
7B
123
173
@
7C
I
174
124
}
7D
125
175
=
7E
126
176
"
7F
127
177
80.
;~OD
128
a
81
;~01
129
b
82
130
202
c
83
131
~~C3
d
84
;~C4
132
e
133
85
;~C5
f
86
134
206
g
87
~~07
135
h
88
136
210.
i
89
137
~~11
8A
212
138
814
ALGOL REFERENCE MANUAL
Character Values and Graphics, continued
Binary
Octal Decimal Hexadecimal BCL ASCII EBCDIC
------10001011
10001100
10001101
10001110
10001111
10010000
10010001
10010010
10010011
10010100
10010101
10010110
10010111
10011000
10011001
10011010
10011011
10011100
10011101
10011110
10011111
10100000
10100001
10100010
10100011
10100100
10100101
10100110
10100111
10101000
10101001
10101010
10101011
10101100
10101101
10101110
10101111
10110000
10110001
10110010
10110011
10110100
10110101
10110110
10110111
10111000
10111001
10111010
10111011
-------
213
214
215
210
217
220
221
222
223
224
225
226
227
230
231
232
233
234
235
236
237
240
241
242
243
244
245
246
247
250
251
252
253
254
255
256
257
260
261
262
263
264
265
266
267
270
271
272
273
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
106
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
18b
187
----------8B
8C
8D
8E
8F
90
91
92
93
94
9'5
96
97
98
99
9A
9B
9C
9D
9E
9F
AO
Al
A2
A3
A4
A5
A6
A7
A8
A9
AA
AB
AC
AD
AE
AF
BO
Bl
B2
B3
B4
B5
B6
B7
B8
B9
B.A.
BE
------
j
k
1
m
n
0
P
q
r
s
t
u
v
w
x
Y
z
815
Data Representation
Character Values and Graphics, continued
Binary
-----10111100
10111101
10111110
10111111
11000000
11000001
11000010
11000011
11000100
11000101
11000110
11000111
11001000
11001001
11001010
11001011
11001100
11001101
11001110
11001111
11010000
11010001
11010010
11010011
11010100
11010101
11010110
11010111
11011000
11011001
11011010
11011011
11011100
11011101
11011110
11011111
11100000
11100001
11100010
11100011
11100100
11100101
11100110
1110011l
11101000
11101001
11101010
11101011
11101100
Octal Decimal Hexadecimal BCL ASCII EBCDIC
------- ----------274
275
276
277
300
301
302
303
304
305
306
307
310
311
312
313
314
315
316
317
320
321
322
323
324
325
326
327
330
331
332
333
334
335
336
337
340
341
342
343
344
345
346
347
350
351
352
353
354
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
BC
BD
BE
BF
CO
C1
C2
C3
C4
C5
C6
C7
C8
C9
CA
CB
CC
CD
CE
CF
DO
Dl
D2
D3
D4
D5
D6
D7
D8
D9
DA
DB
DC
DD
DE
DF
EO
El
E2
E3
-------
{
A
B
C
D
E
F
G
H
I
}
J
K
L
M
N
0
P
Q
R
\
S
T
E4
U
E5
V
E6
W
E7
E8
X
y
2""~
,:)~
E9
Z
234
235
236
EA
EE
Ee
816
ALGOL REFERENCE MANUAL
Character Values and Graphics. continued
Binary
-----11101101
11101110
11101111
11110000
11110001
11110010
11110011
11110100
11110101
11110110
11110111
11111000
11111001
11111010
11111011
11111100
11111101
11111110
11111111
Octal Decimal Hexadecimal BCL ASCII EBCDIC
355
356
357
360
361
362
363
364
365
366
367
370
371
372
373
374
375
376
377
------- ----------237
ED
EE
238
239
EF
240
FO
241
Fl
F2
242
243
F3
244
F4
245
F5
246
FE:
247
F7
248
F8
249
F9
FA
250
251
FB
Fe
252
FD
253
254
FE
FF
255
------
0
1
2
3
4
5
6
7
8
9
817
Data Representation
Default Character
n~
The default character type is the character type assumed by pointers,
string variables, string literals. and so on when a character type is
not explicitly specified. The default character type is also used as
the default value of the INTMODE file attribute. For more information
on INTMODE. refer to the "I/O Subsystem Reference Manual."
Two compiler control options ~ffect the default character type:
the
ASCII option and the BCL option. (For more information, refer to the
ASCII option and the BCL option under "<ASCII option>" and "<BCL
option>," respectively, in the "Compiling Programs" chapter.) If the
ASCII option is TRUE, the default character type is ASCII. If the BCL
option is TRUE, the default character type is BCL. If neither the ASCII
option nor the BCL option is TRUE, the default character type is EBCDIC.
Free-field and formatted I/O generate either EBCDIC or BCL data
depending on the default character type. If the default character type
is BCL, BCL data is generated. If the default character type is EBCDIC
or ASCII,EBCDIC data is generated.
The example programs below demonstrate the effects of different
character types.
See also
<ASCII option> . .
<BCL option>. .
Examples
%%% PROGRAM 1 %%%
BEGIN
% OPTION RECORD
FILE F(KIND=DISKiNEWFILE=TRUE);
ARRAY A[0:9];
POINTER P;
STRING S;
%, DECLARATION OF S
OPEN ( F);
P := POINTER(A):
% STRING ASSIGNMENT
S .- "ABC";
END.
default
• • • 603
• 605
818
ALGOL REFERENCE MANUAL
If this example is compiled and executed as is~ the default character
type is EBCDIC.
Thus, the INTMODE attribute of file F is EBCDIC, the
character size of pointer P is eight bits. the String type of string S
is EBCDIC, and, after the string assignment is executed. S contains the
EBCDIC string "ABC".
If "% OPTION RECORD" on the third line is replaced by the compiler
control record "$ SET ASCII", and the program is compiled and executed,
the default character type is ASCII. Thus. the INTMODE of file F is
ASCII. the character size of pointer P is eight bits, the string type of
string S is ASCII. and, after the string assignment is executed, S
contains the ASCII string "ABC".
If program 1 is compiled after "% OPTION RECORD" is replaced by the
compiler control record "$ SET BCL", the default character type is BCL
and the program is flagged with two syntax errors--one on
the
declaration of string S and one on the string assignment--because string
variables cannot be of type BCL.
%%% PROGRAM 2 %%%
BEGIN
$ SET BCL
FILE F(KIND=DISK,NEWFILE=TRUE):
ARRAY A[O:9];
POINTER P;
OPEN( F) :
P : = PO INTER ( A) ;
REPLACE P BY "ABC":
% REPLACE STATEMENT
END.
Program 2 contains the compiler control record "$ SET BCL" and has no
string constructs. It compiles without error. If program 2 is compiled
and executed. the default character type is BCL. Thus, the INTMODE of
file F is BCL, the character size of pointer P is six bits, and. after
the REPLACE statement is executed, P references the BCL characters "ABC"
stored in array A.
Program 2 is flagged with a warning message when it is compiled, because
the
BCL
character
type is not supported on all A Series and
B 5000/B bOOO/B 7000 Series systems.
Data Representation
Signs of Numeric Fields
Certain operations in ALGOL require an indication of a numeric sign in
character data. The sign of a numeric field is represented as follows:
8-bit characters
The sign is in the zone field of
the
least
significant character (field [7:4J of the character).
A bit configuration of
1"1101" (4"D") indicates a
negative
number;
any
other
bit configuration
indicates a posi t:ive number.
6-bit characters
The sign is in the zone field of
the
least
significant character (field [5:2J of the character).
A bit configuration of
1"10" indicates a negative
number: any other bit configuration indicates a
positive number.
4-bit digits
The sign is carried as a separate digit, and it is
,the most significant digit of the field. A bit
configuration of 1"1101" (4"D") indicate.s a negative
number: any other bit configuration indicates a
positive number.
820
ALGOL REFERENCE MANUAL
ONE-WORD OPERAND
Real, integer, and Boolean operands each require one word of storage.
Real Operand
The internal structure of a real operand is illustrated in Figure B-6.
Not
Used
41
E
X43
39
35
31.
46
042-
23
19
15
11
1
3
Mantissa
P
M
21
38
34
30
26
22
18
14
10
6
2
31
33
29
25
2J.
11
13
9
5
1
36
32
28
24-
20
16
12
8
4
0
n
E
45
e 41
n
44
t4C
Tag
C
[47:1J
[46:1J
Not used
Sign of mantissa: 1
Sign of exponent: ~
Exponent
Mantissa
[45:1J
[44:6J
[38:39J
Figure B-o.
= negative.
0
= positive
negative. 0
positive
Real operand
Real
(single-precision.
floating-paint)
values
are
represented
internally in Signed-magnitude, mantissa-and-exponent notation. The
sign of the mantissa is contained in bit 4b. and the sign of the
exponent is contained in bit 45. A minus sign is denoted by a 1 in the
appropriate sign bit. The magnitude of the exponent is contained in
field [44:6J; hence. the maximum absolute value of an exponent in a real
operand is 2**6-1 = 63. The magnitude of the mantissa is contained in
field [38:39J; hence, the maximum absolute value of a mantissa in a real
operand is 2**39-1. Tnere is an implied radix point to the right of bit
zero.
821
Data Representation
The value representE?d by a real operand can be obtained by the following
formula:
(mantissa) * 8 ft *(exponent)
Certain operations, such as the
NORMALIZE
function,
return
a
"normalized" real operand as their result. A normalized real operand is
a real operand in which the leftmost octade (3-bit field) of the
mantissa is nonzero.
For example. the real value 0.5. in normalized
form. is represented internally as 4"26COOOOOOOOO".
In this example,
the mantissa is 4 * 8**12 and the exponent is -13.
Integer Operand
The internal structure of an integer operand is
illustrated
in
Figure
B-7.
"01:
U.ed
47
81_
Btt
0
U.ed
45
35
42
38
34
30
26
41
37
33
29
40
36
32
28
31
0
19
15
11
7
3
22
18
14
:LO
6
2.
25
21
17
13
9
5
1 ,-
24
20
1e
12
e
4
0
27
23
M.R~tude
.....
0
46
"01:
0
39
43
0
0
44
Tag
[47:1J
[46:1J
[45:1J
[44:6J
[38:39J
o
Not used
Sign: 1
Not used
= negative,
0 = positive
o
Magnitude
Figure B-7.
Integer ,Operand
Integer values are represented internally in Signed-magnitude notation.
The sign of the value is denoted by bit 46 of the data word. A minus
sign is denoted by a 1 in bit 46. The magnitude of the value is stored
in field [38:39J. The maximum ab~olute value of an integer operand is
2**39-1. There is an implied radix point to the right of bit zero.
822
ALGOL REFERENCE MANUAL
For example, the internal representation of the integer 10 is
4"OOOOOOOOOOOA"
The internal representation of -10 is
4"40000000000A"
The internal representation of 99,999,999,999 is
4"00174876E7FF"
The internal representation
4"007FFFFFFFFF"
represents the decimal value 549,755,813,887 (the maximum value an
integer operand can contain). A larger value would have to be stored in
a real operand or a double-precision operand.
Note that the internal format of an integer operand is the same
internal format of a real operand with an exponent of zero.
as
the
823
Data Representation
. Boolean Operand
The internal structure of a Boolean operand
B-8.
v
4'1
V
46
V
45
V
44
V
43
V
42
V
41
V
40
Field
Tag
[47:47J
[O:lj
V
V
39
V
35
V
38
V
34
V
3'1
V
33
V
36
32
V
31
V
30
V
29
V
28
V
V
21
V
23
V
26
V
22
V
25
V
21
V
24-
20
is
illustrated
V
19
V
18
V
17
V
16
V
15
V
14
V
V
12
V
V
1
V'
6
2
V
V
5
9
e
3
V
V
10
V
Figure
V
11
13
V
in
1
V
4
Use
0
Any bit or field within this field can be referenced
as a Boolean value uSing the <partial word part> or
<concatenation> constructs.
The Boolean value of the operand as a whole.
Figure B-8.
Boolean Operand
Boolean operations are performed on a bit-by-bit basis on all 48 bits o!
a Boolean operand. The one exception is the NOT operation performed on
an arithmetic relaLLon, where NOT is performed on the low-order bit (bit
zero), but not nE~cessarily on the other 47 bits. However. when a
Boolean operand is referenced as a whole. only the low-order bit (bit
zero) is significant (0 is FALSE. 1 is TRUE).
In Figure B-8. the shaded V's indicate that each bit of the entire
48-bit Boolean operand can be used to store an individual Boolean value.
The individual bits can be referenced by using the <partial word part)
and <concatenation> constructs.
824
ALGOL REFERENCE MANUAL
TWO-WORD OPERAND
Double-precision and complex operands each require two words of storage.
Double-Precision Operand
The internal structure of a double-precision operand is
Figures B-9 and B-IO.
Not
Used.
41
46
X
43
39
36
.42
38
34
31
0
45
e
21
23
19
15
11
f
3
18
14
10
6
2
Mantissa
30
261
221
(Most S4~icant Part)
n
E
in
(LeU't
E S1P,1£1CUlt
Par1:)
P
M
illustrated
41
31
33
29
25
21
11
13
9
6
1
40
36
32
28
24
20
16
12
8
4.
0
n
44
t
Tag
[47:1J
[46:1J
[45:1J
[44:6J
[38:39J
2
Not used
Sign of mantissa: 1 = negative, 0 = positive
Sign of exponent: 1 = negative. 0 = positive
Least significant portion of the exponent
Most significant portion of the mantissa
Figure B-9.
First Word. Double-Precision Operand
825
Data Representation
.E (~.1:
Sl~"lcan1:
PaM)
43
X41
39
36
3l
i"'-
23
1e
15
11
1
3
18
14
10
8
2
Mantissa
P
-
21
046
42
38
34
30
261
221
(Least S~').lificB.nt Part)
n
e 46
41
31
33
29
25
21
11
13
S.
S
1
n
t ....
40
36
32
28
Z4
20
18
12
II
..
0
Tag
2
[47:9J
[38:39J
Most significant portion ·of the exponent
Least significant portion of the mantissa
Figure B-IO.
Second Word, Double-Precision Operand
Double-precision values are represented internally in signed-magnitude.
mantissa-and-exponent notation.
The sign of the mantissa is contained
in bit 4b of the first data word, and the sign of the exponent is
contained in bit 4~5 of the first data word. A minus sign is denoted by
a 1 in the appropriate sign bit.
The magnitude of the exponent of a double-precision operand is contained
in a total of 15 bits. The most significant nine of these 15 bits are
contained in field [47:9J of the second data word.
The
least
significant six of these 15 bits are contained in field [44:6] of the
first data word.
The magnitude of the mantissa of a double-precision operand
is
represented by a total of 78 bits. The most significant 39 bits are
contained in field [38:39J of the first data word.
The
least
significan~
39 bits are contained in field [38:39J of the second data
word. There is an j.mplied radix point to the right of bit zero Of the
first data word: that is. between the most significant and least
significant parts of the mantissa.
826
ALGOL REFERENCE
MANUA~
The value represented by a double-precision operand can be
the following formula:
(MM + LM * 8**(-13»
obtained
by
* 8**(ME * 2**6 + LE)
where
MM is the most significant part of the mantissa.
LM is the least significant part of the mantissa.
ME is the most significant part of the exponent.
LE is the least significant part of the exponent.
Certain operations return a "normalized" double-precision operand as
their
result.
A
normalized
double-precision
operand
is
a
double-precision operand in which the leftmost octade (3-bit field) of
the full 78-bit mantissa is nonzero. For example, the double-precision
value l@@O. in normalized form. is represented internally as
4"261000000000". 4"000000000000"
In this example, the mantissa is 1 * 8**12 and the exponent is -12.
Complex Operand
A complex operand requires two words of s~orage.
The first word
contains the real part of the complex value; the second word contains
the imaginary part.
The internal structure of both the real and
imaginary parts of the complex value is identical to the internal
structure of a real operand. (For more information, refer to "Real
Operand" ·in this appendix.)
827
Data Representation
12AIA DESCRIPTORS Am! POINTER
An unindexed data descriptor is the mechanism used on A Series and
B 5000/B 6000/B 7000 Series systems to represent the contents of an
array. An indexed data descriptor is used to reference one element of a
word array.
A pointer references one character within a word or
character array.
The internal structures of . unindexed data descriptors, indexed data
descriptors. and pointers are illustrated in Figures B-11, B-12. and
B-13, respectively.
828
ALGOL REFERENCE MANUAL
-
a47
cap,
BIt
46
......
cm\Y
Blt 43
38
36
42
38
34
41
31
40
38
27
23
18
1&
30
26
22
18
14
' 33
29
25
21
11
13
8
6
1
32
28
Z6
20
US
12
8
"
0
Size
31
..
1
3
45
2
Address
LengtJl
I
10
I
(Mem~ry O~ Disk)
IIw.taK
"046
11
llIIiIId
44
Tag
[47:1J
[46:1J
[45:1]
[44:1J
[43:1J
[42:3J
[39:20
[19:20
5
Presence bit: 1 = present, 0 = absent
Copy bit: 1 = copy, 0 = mom (original)
Indexed bit: 0 = unindexed
Paged bit: 1 = paged. 0 = unpaged
Read-only bit: 1 = read-only. 0 = read/write
Element size (type of the array):
o = single precision, 1 = double precision.
2 = hexadecimal. 3 = BCL, 4 = EBCDIC/ASCI:
Length (number of elements in the array)
Address:
- When present, the memory address of the beginning
of the array
- When absent and mom, the software-encoded address
of the array in storage
- When absent and copy, the memory address of the
associated mom descriptor
Figure B-11.
Unindexed Data Descriptor
829
Data Representation
-
~
47
·Ocw
-1
Beid.~
Bit
39
35
42
38
34
41
37
40
36
43
27
23
1~
15
30
26
22
18
·1.4
33
29
26
21
1.7
32
28
24-
20
1.6
l.1.
7
3
1.0
6
2
1.3
9
5
1
i2
e
4
0
Address
Index
Size
46
31
JrwitD4
-1
45
PIIaI4
-044
Tag
[47:1j
[46:1J
[45:1J
[44:1J
[43:1J
[42: 3 ]
[39:20J
[19:20J
5
Presence bit: 1 = present, 0 = absent
Copy bit: 1 = copy
Indexed bit: 1 = indexed
Pagedbit~ 0 = unpaged
Read-only bit: 1 = read-only. 0 = read/write
Element size (type of the array):
o = single preclslo~. 1 = double precision
Index of the e1em~nt in the array {relative to
zero)
Address:
- When present, the memory address of the beginning
of the array
- When absent. the memory address of the associated
unindexed mom data descriptor
Figure B-12.
Indexed Data Descriptor
830
ALGOL REFERENCE MANUAL
_
l\'Mmce BeId-
cm\'r
41
Cli::IW
-1
46
Bit
C
43
h
Size
a
r
42
39
36
31
21
23
19
Word Index
-1
45
41
·044
40
~
Tag
[47:1J
[46:1J
[45:1J
[44:1J
[43:1J
[42:3J
[39:4J
[35:16J
[19:20J
11
1
3
Address
38
34
30
26
22
18
14
10
6
2
31
33
29
25
21
11
13
9
S
1
x 36
32
28
24-
20
16
12
8
4
0
I
n
IIIdaId
16
d
e
5
Presence bit: 1 = present, 0 = absent
Copy bit: 1 = copy
Indexed bit: 1 = indexed
Paged bit: 0 = unpaged
Read-only bit: 1 = read-only, 0 = read/write
Element size (type Of the pointer):
2 = hexadecimal. 3 = BCL, 4 = EBCDIC/ASCII
Character index: the zero-relative index in the
word of the referenced character
Word index: the zero-relative index in the array of
the referenced word
Address:
- When present. the memory address of the beginning
of the array
- When absent. the memory address of the associated
unindexed mom data descriptor
Figure B-13.
Pointer
831
~
FJree~field
RUB-TIME FORHAT-ERROR IESSAGES
In.put
The meanings of the format-error numbers pertaining to free-field
are given in the following table.
Number
input
Error Message
400
An error occurred on free-field input.
41b
Evaluation of a list element caused an I/O action on the
file.
current
420
Input from the <core-to-core file part> required
than allowed by the <core-to-core blocking part>.
records
442
The input data correspond~ng to a single-precision list element
consisted of a hexadecimal string of more than 12 significant
digits.
443
The input data contained
nonhexadecimal characters.
444
The input data corresponding to a double-precision list element
consisted Of a hexadecimal string of more than 24 significant
digits.
462
The next list element was a pointer. and the corresponding input
data consisted of a quoted string that had been only partially
assigned.
467
The input data contained a value greater than the
allowed for the corresponding list element.
473
The input data contained a string with no trailing quotation mark
character.
484
An expression was used as a list element on input.
a
he~adecima1
more
string
containing
maximum
valUE
ALGOL REFERENCE MANUAL
Formatted Output
The meanings of the format-error numbers pertaining to formatted
are given in the following table.
Number
output
Error Message
100
An error occurred on formatted output.
102
The editing phrase letter was V. and the data specified by the
list element did not produce an A, C. D. E. F. G. H, I, J. K. L.
O. P. R. S. T. U. Y.. or Z in the appropriate character position.
102
The editing phrase was of the form
specifier required a <field width).
104
The editing phrase was of the form rV. and the resulting
specifier required a <field widtn> and <decimal places>.
105
The editing phrase was of the form Fw.d.
zero.
106
The editing phrase used was Fw.d. and d was less than zero.
107
The editing phrase used was Ew.d or Dw.d. and
zero.
10q
The editing phrase used was Zw. and the
element was not of type INTEGER or BOOLEAN.
110
The type of the input data was not compatible with
the corresponding list element.
111
The editing phrase was of tne form Zw.d. The phrase
edit the output was Ew.d. but d was less than zero.
rV.
and
and
d
the
resulting
less
was
less
than
corresponding
list
d
was
than
the
type
of
chosen
to
113
The editing phrase used was Ew.d or Dw.d. and w was less than
equal to d.
or
114
The value of a dynamic w or d part was greater than
allowable integer (54G.755.8l3.887l.
the
maximum
116
Evaluation of a list element caused an I/O action on the
file (recursive I/O).
current
117
An attempt was made to write a number of characters greater
the record size.
120
Output to the <core-to-core file part> required more records than
allowed by tne <core-to-core blocking part).
than
833
Run-Time Format-Error Messages
Formatted Output. continued
Number
Error Message
131
The value of a dynamic r part was greater than
allowable real value (4.3l35Q14bb73 * 10**&8).
the
maximum
132
The value of a dynamic w part was
allowable integer (549.755.813.887).
greater
than
the
maximum
133
The value of a dynamic d part was
allowable integer (549,.755.813. 8i87).
greater
than
the
maximum
lb3
The record size was not large
write specified.
enough
to
allow
the
free-field
834
ALGOL REFERENCE MANUAL
Formatted Input
The meanings of the format-error numbers pertaining to
are given in the following table.
Number
formatted
input
Error Message
200
An error occurred on formatted input.
202
The editing phrase letter was V, and the data specified by the
list element did not produce an At C t D, E. F, G, H, I. J, K. L,
0, P, R. S, T. D, X. or Z in the appropriate character position.
203
The editing phrase was of the form
specifier required a <field width>.
204
The editing phrase was of the form rV, and the resulting
specifier required a <field width> and <decimal places>.
205
The editing phrase was of the form
specifier required <decimal places> .
206
The editing phrase used was Fw.d, and d was less than zero.
207
The editing phrase used was Ew.d or DW.d, and
zero.
209
The editing phrase used was Zw. and the
element was not of type INTEGER or BOOLEAN.
210
The type of a list elemenx
corresponding editing phrase.
213
The editing phrase used was Ew.d or DW.d, and w was less than
equal to d.
214
The value of a dynamic w or d part was greater than
allowable integer (549.755,813.887).
the
maximum
216
Evaluation of a list element caused an I/O action on the
file (recursive I/O).
current
217
An attempt was made to read a number of characters
the record size.
218
The editing phrase letter was H or
contained
nonblank,
nonhexadecimal
nonoctal characters, respectively.
was
rV,
rVw,
and
the
and
resulting
the
was
resulting
less
than
corresponding
list
with
the
d
incompatible
greater
or
than
K. but the input data
characters or nonblank.
835
Run-Time Format-Error Messages
Formatted Input. continued
Number
Error Message
220
Input from the <core-to-core file part> required
than allowed by the <core-to-core blocking part>.
more
records
231
The value of a dynamic r part was greater than
allowable real value (4.31359146673 * 10**68).
the
maximum
232
The value of a dynamic w part was
allowable integer (549,755.813.887).
greater
than
the
maximum
233
The value of a dynamic d part was
allowable integer (549,755,813,887).
greater
than
the
maximum
250
Input was attempted using a U editing phrase.
271
Input was attempted using a $ or P format modifier.
281
The input data was invalid for an I editing phrase.
284
An expression was used as a list element on input.
285
The list element was of type REAL. but the corresponding input
data contained a value greater than the maximum allowable real
value (4 .. 31359146673 * 10**68).
286
The list element was of type INTEGER or BOOLEAN, but the input
data contained a value greater than the maximum allowable integer
(549.755.813.887).
291
The input data corresponding to a numeric editing
phrase
contained a nondigit character in the exponent part following at
least one valid digit.
292
The
293
The input data corresponding to a numeric editing
phrase
contained an invalid character after the exponent sign and before
the exponent value.
294
The input data corresponding to a numeric editing
contained an invalid character after the deCimal point.
phrase
295
The input data corresponding to a numeric
contained more than one sign in the mantissa.
phrase
input data corresponding to a numeric editing
contained more than one sign in the exponent part.
editing
phrase
837
UNDERSTANDING RAILEOAD pIAGRAJlS
1#HAT IS fA RAILROAD
~GRAM?
A railroad diagram is a way of repr,esenting the syntax ofa command or
statement graphically.
It shows which items are required or optional.
the order in which they should appear. how often you can repeat them,
and any required punctuation.
]flOW TO READ A
RAILROAl~
DIAGRAlf
Normally. you read a railroad diagram from
there
are
some
E~xceptions;
in those
right-to-left direction.
left to right.
However~
cases. arrows indicate a
If a diagram is too long to fit on one line and must continue on the
next, a right arrow (» appears at the end of the first line and another
at the beginning of the next line, like this:
--------------------_._------------------------------------------------->
>----------The end of a railroad diagram is denoted by a vertical bar (I) or
percent sign (~O.
The vertical bar means the command or statement can
be followed by a semicolon and another command or statement.
The
percent sign means the command or statement must be on a line by itself.
CONSTANTS AND VARIABLES
Consider a hypothetical command
paint.er:
PAINT ------------- LIVING
for
ROO~
giving
---<color>--\
1
1- THE -I 1- DINING ROOM -!
!
1- BEDROOM -----!
\
1- BATHROOM ----I
I
j-
instructions
1
KITCHEN -----jI
to
a
house
838
ALGOL REFERENCE MANUAL
This command tells the painter to paint a designated room in
you specify.
the
color
The example introduces two important features of railroad diagrams:
Constants
Variables
Constants
constants are items that you cannot vary. You must enter a constant as
it appears in the diagram, either in full or abbreviated. If you
abbreviate a constant. you must enter everything that is underlined in
the railroad diagram. optionally followed by one or more of the
remaining characters.
You can recognize constants in railroad diagrams by the fact
are never enclosed in angle brackets.
that
they
In the example. the word PAINT is a constant. You could enter PAINT in
full or abbreviate it to PAl or PAIN, but not to PA or PAN. If no part
of the constant is underlined, you cannot abbreviate it at all.
Variables
Variables are items that you can replace with other data t9 suit a
particular situation; that is. you can vary the information you enter in
place of the variable. subject to rules defined for the particular
command or statement.
Variables appear in a railroad diagram enclosed in angle brackets
«».
In the example. <color> is a variable iterrl. If the description of the
PAINT command defines the allowable colors as BLUE. GREEN, PINK, and
YELLOW, you can enter anyone of these in your command.
830,
Understanding Railroad Diagrams
FOLLOWING THE PATHS OF
A RAILROAD
DIAGRAM
The paths of a railroad diagram lead you through the diagram from
beginning to end.
They are represented by horizontal and vertical
lines.
A path shows the allowable syntax. Some diagrams have just one path
that goes from the beginning to the end of the diagram. Others contain
several paths. each covering a part of the diagram. A path shows which
items you can include in a command or statement, which you can omit, and
the number of times you can include a particular item or group of items.
To' follow a path through a railroad diagram, you need to understand
items you may encounter along the way. These items are
the
Required items and punctuation
Optional items
Loops
A
description of each item follows.
Required
.Item~
and Punctuation
Required items and punctuation must be entered in the command or
statement: you cannot omit them. A required item appears by itself in a
path (horizontal line). A required item can be either a constant or a
variable. For example, if a railroad diagram indicates
-- PAINT -- BEDROOM --<color>--I
the words PAINT and BEDROOM are required constants,
required variable. You could correctly enter
PAINT BEDROOM BLUE
but
not
PAINT BEDROOM
because the required item <color> would be missing.
and
<color>
is
a
840
ALGOL REFERENCE MANUAL
Optional Items
Optional items appear one below another in a vertical list.
You can
choose anyone of the items 1n the list. If the list also contains an
empty path (all dashes), you can omit the item entirely.
An optional
item can be either a variable or a constant. The PAINT command in the
example contains two lists. The first is
-------------1
1
I
1- THE -I
which gives you two options:
Enter the constant THE
Omit it (because there is an empty path)
The second list has five optional constants:
LIVING ROOM - --I
1
1- DINING ROOM I
1- BEDROOM ----1
1- BATHROOM ---I
1- KITCHEN ----You must enter one of the optional items (LIVING ROOM. DINING ROOM,
"BEDROOM, BATHROOM. or KITCHEN) because there is no empty path in this
list.
A loop is an item or group of items that you can repeat. The number
repetitions allowed is controlled by an item called the bridge.
of
841
Understanding Railroad Diagrams
A loop can span all or part of a railroad diagram. It always consists
at least two horizontal lines, one below the other, like this:
of
I<----~--
<return character>
1
~--------I
I
-----<bridge>--<content of the loop>------or
1<-- <bridge> -- <return character> --I
I
----..,.---- <content of the loop> ----------The bridge shows the maximum number of times you
loop.
The bridge can precede the contents
precede the return character on the upper line of
the number of times the right-to-left path can be
1s an integer enclosed in sloping lines. / \. for
loops have bridges.
Those that do not can be
times.
can go through the
of the loop~ or it can
the loop to specify
traversed. The bridge
example, /4\. Not all
repeated any number of
top line is a right-to-Ieft path that contains information about
repeating the loop. The return character is the character to use before
each repetition of the loop (often, a comma). Not all loops contain a
return character; if none is shown, just enter one or more spaces before
repeating the loop.
~rhe
The other lines show the content of the loop (the data you enter each
time you go through the loop). This can be any combination of optional
items, required items, lists. and even other loops. The con~ent of a
loop can range from simple (one item), to very complex (many items.
lists. and loops).
lE:xample 1.
A Simple l.oop
The PAINT command as first shown is of limited usefulness. To tell the
painter to do several rooms, you need a separate command for each room.
It would be much easiE~r if you could tell him to do several rooms in one
command.
You can do that by making the list of rooms into a
would then look like this:
loop.
The
command
842
ALGOL REFERENCE MANUAL
1<---------- . ---------1
I
-- PAINT -------------/5\--- LIVING ROOM -----<color>--I
1
I
1
I
1- THE -I
I- DINING ROOM -I
I
I
I- BEDROOM -----\
I
I
I- BATHROOM ----I
I
I
1- KITCHEN -----1
The bridge has a value of 5, so you can go through the loop up to five
times, for a total of five rooms. The return character is a comma,
which you must enter before repeating the loop content.
You can now enter
PAINT THE LIVING ROOM, BEDROOM. KITCHEN YELLOW
or
PAINT DINING ROOM, BEDROOM, BATHROOM BLUE
or
PAINT BEDROOM PINK
or
PAINT BEDROOM, BATHROOM, BEDROOM, BEDROOM BLUE
or any other valid combination.
This simple loop makes the PAINT command more versatile, but a
significant drawback remains. Although you can include up to five rooms
in a command, you cannot specify different colors.
843
Understanding
]~am.ple
2.
Rail~oad
Diagrams
A More Comlplex Loop
If the content of the loOp were to include the color. you could
a different color for each room.
1<------------~-
,
specify
~------------I
1
-- PAINT -------------/5\--- LIVING ROOM ---<color>----I
I
1
I
j- THE -I
1- DINING ROOM -I
I
1- BEDROOM -----i
I
I
1- BATHROOM - - - - j
I
I
1- KITCHEN ~----!
The content of the loop now consists of the
List of optional constants that indicate rooms
Required variable <color>
The bridge value 1s 5, and the return character is a comma.
railroad diagram. som€~ valid PAINT commands would be
Given
PAINT THE BEDROOM PINK
PAINT THE LIVING
~~OOM
BLUE, DINING ROOM GREEN, KITCHEN YELLOW
PAINT BEDROOM GREEN. KITCHEN BLUE
and so on.
this
844
ALGOL REFERENCE MANUAL
Example 3.
Another Loop
In some bridges an asterisk follows the number.
For example,
---------1
1<-/4*\--------- .
I
1
-- PAINT --------------- LIVING ROOM ---<color>----I
1
1
1- THE -I
1
1- DINING ROOM -I
1
1
1- BEDROOM -----1
I·
I
1- BATHROOM ----I
I
1- KITCHEN -----1
The asterisk means you must take the right-to-left path at least once.
You cannot. for example. enter PAINT BEDROOM BLUE; you must tell the
painter at least two rooms to paint. The maximum number of rooms to be
painted is still five: the first time through the loop with up to four
repetitions.
A valid form of the command would be
PAINT BEDROOM BLUE, KITCHEN YELLOW
Example 4.
Another Use of the Bridge
A bridge can also control the number of times you take an individual
path within a loop. For example. another command to the painter might
be:
-- WORK
-----------------------------i
I I <,. - - - - - - - - - - - - - - - - - - - i /
I !
I I
1-----/1\- EVENINGS -----1
1-/1\- WEEKENDS -I
1-/1\- HOLIDAYS -j
845
Understanding Railroad Diagrams
Each bridge /1\ indicates you can take that path once or not at all.
That· is. YOllcan enter each of t:he i terns EVENINGS • WEEKENDS. and
HOLIDAYS once at most. Some valid commands are
WORK EVENINGS WEEKENDS HOLIDAYS
WORK WEEKENDS
WORK HOLIDAYS EVENINGS
but
WORK EVENINGS EVENINGS
js invalid.
To familiarize you with railroad diagrams. this explanation describes
the elements of the diagrams and gives a few simplified examples. Some
()f the actual diagrams you will encounter in a book may be considerably
more complex.
However. the principles are the same no matter how complex the diagram.
The more you work with railroad notation. the more easily you will
understand even the most complex diagrams.
847
(lLQSSARX
accIdental entry
See "thunk.·i
address couple
A representatioh of the address of an item in a program~ An address
couple consists of two numbers:,
the first number is a lexical
level; and the ~:econd number is at di splacemen t (of f set) wi th in that
lexical level.
address equation
The process of declaring an identifier to have the same address as a
previoUsly declared identifier.
ASCII
American Standard Code for Information Interchange. A 7- or 8-bit
code representing a set of 128 control and graphic characters.
asynchronous proces!.
A procedure initiated by a program as a separate task that is
dependent on the initiating program for globals but otherwise runs
independent of and in parallel with the initiating program.
bad go to
A GO TO state~ent in an
label that is global
"bad go to" is that the
and local variables are
inner block that transfers control to a
to that block. A necessary side effect of a
block in which it occurs is exited abruptly
deallocated immediately.
BeL
See "Burroughs Common Language."
848
ALGOL REFERENCE MANUAL
Burroughs Common Language (BCL)
An obsolete code using b-bit character representation. BeL is not
available on A Series or on most B 5000/B 6000/B 7000 Series systems
(such as B 5900 systems).
call-by-name
A method of passing a parameter to a procedure where every reference
to the formal parameter within the procedure body causesttie actual
parameter to be evaluated. Any change made to the value of the
formal parameter within the procedure body also changes the value of
the corresponding actual parameter outside the procedure body.
call-by-reference
A method of passing a parameter to a procedure where the actual
parameter's address 1s evaluated once and passed to the formal
parameter. Every reference to the formal parameter within the
procedure body thus references this address. Any change made to the
value of the formal parameter within tne procedure body also changes
the
value of the corresponding actual parameter outside the
procedure body.
cal1-by-value
A method of passing a parameter to a procedure wnere the value of
the actual parameter is assigned to the formal parameter. which is
thereafter handled as a variable that is local to the procedure
body.
Any change made to the value of a call-by-value formal
parameter has no effect outside the procedure body.
CANDE
Command AND Edit. A Burroughs Message Control System (MCS) that
provides generalized file preparation and updating capabilit:ies and
task control in an interactive. terminal-oriented environment.
character array
An array whose elements
characters.
are
ASCI:,
BCL.
EBCDIC.
or
hexadecimal
849
Glossary
code segment descriptor
A descriptor that references a code segment.
control variable
The variable that controls the repetitive execution of an
statement.
iteratiVe
copy descriptor
A descriptor that has a one in the. copy bit (bit 46).
A copy
descriptor is derived from a mom descriptor, and there can be
mul tiple copy descriptors to the 'same data segment.
coroutine
A process in which two
simultaneously, passing
running alternately.
programs execute in parallel, but not
control back and forth to each other and
critical block
The block within a program initiating an asynchronous process or a
coroutine that must not be exited until the process or coroutine
finishes executing. AS long as the critical block is not exited.
the process or coroutine has access to necessary globals in the
initiating program.
descriptor
A word, distinguiShed by its format, that is used to refer
segments and code segments.
to
data
Dl stack (D[l] stack)
A stack created for each object code file that contains code segment
descriptors and descriptors to read-only arrays. The DI stack is
also referred to as the "segment dictionary."
850
ALGOL REFERENCE MANUAL
D2 stack (D[2] stack.)
A stack initiated for each executing program that is used for
storage of items declared in the outer block and other items
allocated at lexical level two.
EBCDIC
Extended Binary Coded Decimal Interchange Code.
An 8-bit code,
capable of representing 25b graphic and control characters that are
the native character set of A Series and B 5000/B bOOO/B 7000 Series
systems.
equivalent array
An array that 1s declared to refer
array.
to
the
same
data
as
another
external sign flip-flop (EXTF)
A hardware flip-flop (a register that has two states) that is
assigned values by and affects the actions of certain hardware
operators. The state of EXTF reflects information about the signs
of numeric quantities.
EXTF
See "external sign flip-flop."
fault
An error encountered by a hardware operator.
FIB
See "File Inf orma t ion Block.·
t
file equation
A mechanism for specifying the values
program is compiled or executed.
of
file
attributes
when
a
851
Glossary
File Information Block (FIB)
A data structure in an object code file
describing a file.
that
contains
information
float flip-flop (FLTF)
A hardware flip-flop (a register that has two states) that is
assigned values by and afJect:s the actions of certain hardware
operators.
The state of FLTF reflects information about the
insertion of floating characters into character strings.
FLTF
See "float flip-flop."
fully specified formlal procedure
A procedure parameter (formal procedure) that is declared with the
word "FORMAL" in its declaration.
With such procedures, the
compiler checks the parameters of the actual procedure passed to it
at compile time.
global identifier
Within a given block, an identifier that is declared in an outer
block.
A global identifier retains its values and characteristics
as the bloCkS to which it'is global are entered and exited.
Halt/Load
A system-initialization procedure that loads a fresh version of
Master Control Program (MCP) from disk or pack to main memory.
the
host program
A program to which separately compiled procedures can
the Binder program or by using the sepcomp facility.
be
bound
by
852
ALGOL REFERENCE MANUAL
lex level· .
See "lexical level."
lexical level (lex level)
A number that indicates the relative level of a local addressing
space within the staCk of an executing program. The outer block of
an ALGOL program is allocated at lexical level two.
Procedures
declared at the outer block level execute at lexical level three,
procedures declared within those procedures execute at lexical level
four. and so on. up to lexical level 15 or 31, depending on the
computer family. The first number in an address couple is the
lexical level of the item.
library
A program containing one or more procedures or "entry points" that
can be called by other programs. Unlike a regular program. which is
always entered at the beginning, a library can be entered at any of
these entry points.
local identifier
Within a given block, an identifier that is declared in that block.
The value or values associated with that identifier inside the block
are not associated with that identifier outside the block. In other
words. on entry to a bloCk, the values of local identifiers are
undefined~ on exit from the bloCk. the values of
local identifiers
are lost.
Kaster Control Program (KCP)
The operating system on A Series and B 5000/B bOOO/B 7000 Series
systems:
the program that controls the operational environment of
the system. This control includes memory management. job selection,
peripheral management, system utilization. program segmentation,
subroutine linkage. and error logging.
IICP
See "Master Control Program."
853
Glossary
mom
~escriptor
A descriptor that has a zero in the copy bi: (bit 46).
For every
data segment in a program. there is one and only one mom descriptor.
OFFF
S~e
"overflow flip-flop."
original array
An array that is declared with a bound pair list.
array is distinct from all other original arrays.
Each
original
overflow flip-flop (OFFF)
A hardware flip-flop (a register that has two states) that is
assigned values by and affects the actions of certain hardware
operators. The state of OFFF reflects whether or not an overflow
occurred when a numeric quantity was converted to a character string
of fixed length.
paged array
An array that is automatically divided ("paged" or
run time into segments of· 25b words each.
"segmented")
at
primary coroutine
A program that initiates a procedure as a corbutine.
ready queue
A queue of tasks that are capable of running.
begin executing are taken from this queue by
~he
Tasks that
system.
are
to
referred array
An array identifier that--through array row equivalence, an array
reference assignment. or because it is a formal array--refers to
data in another array.
854
ALGOL REFERENCE MANUAL
save memory
An area of memory that cannot be overlaid as long as the
which it is associated is allocated.
item
with
scope
The portion of an ALGOL
successfully
be used to
characteristics.
program in
denote its
which an identifier
corresponding values
can
and
secondary coroutine
A procedure that is initiated as a coroutine by a program.
segment dictionary
See "Dl stack."
segmented array
See "paged array."
separately compiled procedure
A procedure that is compiled on its own, rather than as part of a
program. so that it can be bound into a host program by the Binder
program.
SIB
See "Structure Information Block."
stack
A contiguous area in memory assigned to a task during its execution.
Structure Information Block (SIB)
On Mark 3.4 and earlier releases. a "pseudo-stack" that contains
addressing environments for eacn structure of a database. SIBs do
not exist on Mark 3.5 and later releases.
855
Glossary
subroutine
A procedtire to which program' control is transferred when it is
invoked and that transfers control back to the statement fOllowing
the invocation statement when·itis eXited.
task.
A single, comple·te uni t of work performed by the system, such as
compiling or executing a program or copying a file from one disk to
another. Tasks are initiated by a job, by another task. or directly
by a user.
tbunk.
A compiler-generated typed procedure that calculates and returns the
value of an expression passed to a call-by-name formal parameter of
a procedure. The value of the expression is calculated and returned
each. time the formal parameter is used. A thunk is also referred to
as "accidental entry."
touched array
An array that. has been referenced bya statement.
unpaged array
An array that is not automatically divided ("paged" or "segmented")
at run time into segments of 256 words each. Arrays smaller than
1024 words are always unpaged.
unsegmented array
See "unpaged array."
up-level event
The situation that arises when either of the following is true:
1.
The. block containing an event is exited before the block
containing the interrupt attached to the event is exited.
2.
The block containing the finished event for a direct I/O
statement is exited before the block containing the direct
array is eoX:i ted.
85b
ALGOL REFERENCE MANUAL
up-level pointer assignment
Any construct that could result in a pointer pointing to an array
declared at a higher lexical level than that at which the pointer is
declared. Such a construct is disallowed by the compiler. because
the array can be deallocated. leaving the pointer pointing to an
invalid portion of memory.
WFL
See "Work Flow Language."
word
A unit
of
computer
memory.
On
Burroughs
A Series
and
B 5000/B 6000/B 7000 Series systems. a word consists of 48 bits used
for storage plus a tag field used to indicate how the word is
interpreted.
word array
An array whose elements are single- or double-precision operands.
Work Flow Language (WFL)
The Burroughs language used to write jobs that control the
programs and tasks on the operating system.
flow
of
zone field
The leftmost (high order) four bits of an ASCII or EBCDIC
or the leftmost two bits of a BCL character.
character
857
Index
<abs function>, 532
<accept statement>~ 221
Accidental entry (thunk), 171
<action labels or finished event>, 362
semantics. 371
<actual parameter>, 347.
<actual parameter part>. 346
<actual text part>. 62
ACTUALNAME, 173
Addition, 478
ALPHA, 208
<alpha item>, 763
<alpha item identifier>. 704
<alpha item name>. 697
<alpha string literal>, 34
<alphanumeric relation>, 704
ALPHA6, 208
ALPHA7, 208
ALPHA8, 208
AND, 496
<append version>, 647
<arccos function>, 532
<arcsin function>, 532
<arctan function>, 533
<arctan2 function>, 533
<arithmetic assignment>, 225
<arithmetiC attribute>, 226
<arithmetiC attribute specification>. 86
<arithmetic case expression>. 476
<arithme~ic concatenation expression>, 484
<arithmetic direct array attribute>, 226
<arithmetiC expression>, 475
precision of, 481
<arithmetic file attribute>. 226
<arithmetic function designator>. 515
<arithmetic intrinsic name>. 515
alphabetical listing of. 529
<arithmetic operand>. 476
<arithmetic operator>, 475
Arithmetic operators, 478
DIV, 479
MOD, 479
MUX, 479
precedence of, 480
TIMES, 478
-, *.
**. 479
+,
I,
478
Arithmetic primaries. 477
strings used as. 478
<arithmetic primary>, 476
<arithmetic relation>, 493
<arithmetic table membership>, 495
<arithmet~c task attribute>. 227
858
ALGOL REFERENCE MANUAL
<arithmetic type transfer variable>. 226
<arithmetic update assignment>. 227
<arithmetic variable>. 225
Arithmetic-valued attributes
assigning values
arithmetic assignment target <arithmetic attribute>. 226
FILE declaration. 85
multiple attribute assignment statement. 332
interrogating
arithmetic operand <arithmetic attribute>, 476
VALUE function. 585
<arithmetic-valued direct array attribute name>. 227
<arithmetic-valued file attribute name>, 86
<arithmetic-valued task attribute name>. 227
Array
allocation. 44
array class, 45
array reference, 52
array row, 49
array row equivalence. 47
array row read, 370
array row write, 467
bits per element. 45
bound pair list, 46
character array, 45
default type. 45
descriptor. 46
dimensions. 47
direct array. 68
element width. 45
equivalent. 47
in sort procedures. 443
long (unpaged), 44
lower and upper bounds, 46
original. 46
own, 44
paged (segmented), 44
referenced (touched), 50
referred. 46
resizing referenced unpaged (unsegmented) arrays, 420
row selector, 49
string array, 187
subarray selector, 4g
unpaged (unsegmented), 44
value array. 214
word array. 45
ZIP WITH array. 470
<array class>. 41
<array declaration>. 41
<array designator>, 43
Array handling
ARRAY declaration. 41
array reference assignment. 231
859
Index
Array handling (cant.)
ARRAYREFERE.NCE d,eclaration. 52
ARRAYSEARCH function, 534
CHECKSUM function, 537
DEALLOCATE statement, 287
DIRECT ARRAY declaration, 68
FILL statement, 300
LISTLOOKUP function, 561
MASKSEARCH function, 562
NOSTACKARRAYS option, 631
RESIZE statement, 415
SIZE function, 577
STRING ARRAY declaration, 187
VALUE ARRAY declaration, 214
<array identifier>, 42
<array name>, 43
Array parameters, 171, 174
<array reference assignment>, 231
<array reference declaration>, 52
<array reference identifier>, 52
<array reference variable>, 231
<array row>, 43
in LIST declaration~ 134
<array row equivalence>, 43
Array row read, 370
<array row resize parameters>, 415
Array row write. 467
<array sp~cification>, 168
<array type>, 168
Arrays of strings, 187
<arraysearch function>, 534
<ASCII character}, 36
<ASCII code>, 35
<ASCII option>, 603
<ASCII string>, 35
<ASCII string constant>, 524
<assign statement>. 709
<assignment statement>, 223
Assignment statement, 223
arithmetic assignment, 225
array reference aSSignment, 231
Boolean assignment. 234
complex assignment. 237
mnemonic attribute assignment. 239
mriltiple attribute assignment statement, 332
pointer assignment. 241
string aSSignment, 243
swap stat~ment, 447
task aSSignment. 246
<atanh function>, 534
<attach statement>. 248
Attribute handling
assigning arithmetic-valued attributes
860
ALGOL REFERENCE MANUAL
Attribute handling (cont.)
arithmetic assignment target <arithmetic attribute>, 226
FILE declaration, 85
multiple attribute assignment statement, 332
assigning Boolean-valued attributes
Boolean assignment target <Boolean attribute>, 234
FILE declaration, 85
multiple attribute assignment statement, 332
assigning pointer-valued attributes
FILE declaration, 85
multiple attribute assignment statement. 332
replace family-change statement, 409
replace pointer-valued attribute statement. 411
assigning string-valued attributes
LIBRARY declaratior, 129
string assignment target <string-valued library attribute>, 243
assigning task-valued attributes
task assignment, 246
assigning the LIBACCESS library attribute
LIBRARY declaration. 129
mnemonic attribute assignment, 239
assigning translate-table-valued attributes
FILE declaration, 85
multiple attribute assignment statement, 332
interrogating arithmetic-valued attributes
arithmetic operand <arithmetic attribute>, 476
interrogating Boolean-valued attributes
Boolean operand <Boolean attribute>, 492
interrogating event-valued attributes
<event designator>, 78
interrogating pointer-valued attributes
REPLACE statement source part <pointer-valued attribute>, 380.
407
interrogating string-valued attributes
string primary <string-valued library attribute>. 523
interrogating task-valued attributes
<task designator>, 200
VALUE function, ~85
<attribute parameter list>, 226
<attribute parameter specification>, 226
<attribute specifications>, 85
<autobind option>, 603
<available function>. 535
Bad go to, 313
<basic symbol>, 16
Batch source input, 791
<BCL code>, 35
<BCL option>, 605
<BCL string>. 35
<BDMS close statement>. 715
<BDMS free statement>. 732
861
Index
<BDMS identifier>, 691
<BDMS lock statement>, 741
<BDMS open statement>. 747
<BDMS set statement>, 757
BDMSALGOL, 679
<alpha item>, 763
<alpha item identifier>, 704
<alpha item name>. 697
<alphanumeric relation>. 704
<assign statement>, 709
<BDMS close statement>, 715
<BDMS free statement>, 732
<BDMS identifier>, 691
<BDMS lock statement>. 741
<BDMS open statement>, 747
<BDMS set statement>, 757
<begintransaction statement>. 712
binding databases. 774
<Boolean item name>, 697
compiler control options. 772
DATADICTINFO option, 772
LISTDB option, 772
NODMDEFINES option, 773
TRACEDB option, 773
<count item name>. 697
<create statement>, 718
<data set>. 703
<data set name>, 681
<data set reference>, 681
<database attribute assignment statement>, 689
<database declaration>. 680
<database identifier>, 715
<database name>, 681
<databa~e reference>. 680
<database title>, 681
<datadictinfo option>, 772
<delete statement>, 722
<dmterminate statement>, 724
<dmtest function>. 763
<endtransaction parameters>. 726
<endtransaction statement>, 726
<exception handling>, 768
<exception value>, 770
<exception variable)~ 768
<field item identifier>, 704
<field item name>. 697
<find statement>~ 729
<generate statement>, 734
<get statement>, 737
<group item name>, 697
<input assignment>. 696
<input mapping>. 696
<insert statement>, 739
862
ALGOL REFERENCE MANUAL
BDMSALGOL (cant.)
<internal name>. 681
<item>. 757
<key condition>. 704
<link item>. 705
<listdb option>, 772
<logical database name>. 681
<midtransaction parameters>, 744
<midtransaction statement>, 744
<modify statement>
as synonym for <BDMS lock statement>. 741
<nodmdefines option>, 773
<numeric item>, 763
<numeric item identifier>, 704
<numeric item name>, 697
<numeric relation>, 704
<output assignment>, 700
<output mapping>. 700
<population item name>, 697
<put statement>. 750
<qualification>, 693
<real item>. 763
<real item identifier>. 704
<real item name>, 697
<record type item name>, 697
<recreate statement>, 752
<remove statement>. 754
<restart data set>. 712
<saveinput procedure identifier>. 744
<saveoutput procedure identifier>, 72t
<selection expression>. 703
separate compilation (sepcomp) of databases. 776
<set>, 703
<set name>, 682
<set part>, 681
<set reference>, 681
<set selection expression>. 703
<store statement>. 761
(string-valued database attr~bute). b8~
<structurenumber function>, 76b
<subscripted BDMS identifier>. 692
<subset>. 704
<tracedb option>. 773
<transaction record variable>. 712
<beginsegment option>, 605
<begintransaction statement>. 712
<binary code>. 3:
Binary read. 369
<binary string>. 3~
Binary write. 466
<bind option>, 607
<binder command>, 599
<binder option>. 607
863
Index
B.inding
AUTOBIND option. 603
BIND option, 607
BINDER option. b07
DUMPINFO option. 611
EXTERNAL option. 612
HOST option. 614
INITIALIZE option. 617
INTRINSICS option. 619
LEVEL option. 619
LIBRARY option. 620
LOADINFO option. 623
of databases, 774
PURGE option. 634
STOP option. 642
USE option, b4b
Bit manipulation. 484
concatenation expression. 484
partial word expression. 489
<bit manipulation expression>, 484
<block>. q
<Boolean assignment>, 234
<Boolean attribute>, 234
<Boolean attribute specification>. 86
<Boolean case expression>, 493
<Boolean concatenation expression>. 484
Boolean data type
Boolean array declaration. 41
Boolean array reference declaration. 52
Boolean assignment. 234
BOOLEAN declaration. 55
Boolean expression. 491
Boolean functions
ACCEPT statement. 222
AVAILABLE function. 535
BOOLEAN function. 535
CHANGE~ILE statement, 270
CHECKPOINT statement, 274
FIX statement. 303
FREE statement, 311
HAPPENED function, 555
READ statement. 363
READLOCK function. 570
REMOVEFILE statement. 377
SEEK statement. 433
SPACE statement. 445
WAIT statement. 454
WRITE statement, 462
Boolean operand internal structure. 823
Boolean procedure dec1aratiop. 165
Boolean value array declaratioc. 214
direct Boolean array declaration. 68
functions With Boolean parameters
864
ALGOL REFERENCE MANUAL
Boolean data type (cant.)
READLOCK function, 570
REAL function, 570
intrinsic functions returning values of type BOOLEAN, 531
width of Boolean array elements, 45
<Boolean declaration>. 55
<Boolean direct array attribute>, 235
<Boolean expression>, 491
<Boolean file attribute>. 235
<Boolean function>, 535
<Boolean function designator>, 515
<Boolean identifier>, 55
<Boolean intrinsic name>, 516
alphabetical listing of. 531
<Boolean item name>, 697
<Boolean operand>, 492
Boolean operand internal structure, 823
<Boolean operator>, 491
Boolean operators, 496
precedence of, 498
<Boolean option>, 597
Boolean primaries. 499
<Boolean primary>, 492
<Boolean task attribute>, 235
<Boolean type transfer variable>, 234
<Boolean update assignment>, 235
<Boolean value>, 492
<Boolean variable>. 234
Boolean-valued attributes
assigning values
Boolean assignment target <Boolean attribute>, 234
FILE declaration, 85
multiple attribute assignment statement, 332
interrogating
Boolean operand <Boolean attribute>, 492
VALUE function, 585
<Boolean-valued direct array attribute name>. 235
<Boolean-valued file attribute name>, 86
<Boolean-valued task attribute name>. 235
<bound pair>, 42
<bound pair list>, 42
Bound pair lists in array declarations, 46
<bounds part>, 74
<bracket>, 17
<breakhost option>. 608
Breakpoint
BREAKHOST option, 608
breakpoint intrinsic, 251
BREAKPOINT option, 609
BREAKPOINT statement, 250
control commands. 253
display commands, 251
reformat commands. 254
865
Index
<breakpoint option>, 609
<breakpoint statement>, 250
By-calling procedure. 172
<B7700 option>, 609
<cabs function>, 535
<call statement>. 259
Call-by-name parameters, 170
Call-by-reference parameters, 171
Call-by-value paramete~rs. 170
Calling procedures with parameters, 348
<cancel statement>. 261
CARD file, 589
<case body>, 263
<case expression>, 504
<case head>, 263
<case statement>. 263
CAT, 526
<cause statement>. 2~6
<causeandreset statement>. 268
<ccos function>, 535
<cexp function>. 536
<changefile statement>. 270
Character array. 45
<character array identifier>. 42
<character array name>. 520
<character array part>. 520
<character array row>, 520
<character set>. 203
<character size>, 565
Character string manipulation
ASCII collating sequence, 811
ASCII option. 603
BCL collating sequence, 811
BeL option. 605
character array. 45
default character type, 817
DELTA function, 543
DOUBLE function, 548
EBCDIC collating sequence, 811
INTEGER function. 558
internal representation of characters, 808
intrinsic functions returning values of type POINTER. 531
OFFSET function, 564
PICTURE declaration, 147
pointer assignment~ 241
POINTER declaration, 160
pointer expression. 519
POINTER function, 565
pointer relation, 501
READLOCK function, 570
REAL function, 571
866
ALGOL REFERENCE MANUAL
Character string manipulation (cont.)
REMAININGCHARS function, 571
REPLACE statement, 379
SCAN statement. 427
SIZE function, 577
string literal, 30
string relation, 500
TRANSLATETABLE declaration, 202
TRUTH SET declaration, 207
<character type>, 42
<check option>, 610
Checkpoint, 273
checkpoint/restart messages, 277
effect on the PROCESSID function, 568
with the sort intrinsic, 441
<checkpoint statement>. 273
<checksum function>. 537
<cln function>. 537
<close option>, 280
<close statement>, 280
<closed text>, 62
CODE file, 591
Code optimization
BEGINSEGMENT option, 605
B7700 option, 609
END SEGMENT option, 611
OPTIMIZE option, 633
TARGET option, 644
<code option>. 610
Code-compa.tible families, 645
<column width>, 361
<comment characters>. 27
<comment remark>, 27
<commentary>. 372
<compare procedure>, 437
Compile-time facility
<compile-time arithmetic expression>, 777
<compile-time begin statement>. 781
<compile-time Boolean expression>. 783
compile-time compiler control options. 787
CTLIST option, 787
CTMON option. 787
CTTRACE option, 788
LISTSKIP option. 788
<compile-time define identifier>, 781
<compile-time define statement>. 781
<compile-time for statement>. 782
<compile-time identifier>, 779
<compile-time if statement>. 783
<compile-time invoke statement>. 784
<compile-time let statement>. 784
<compile-time statement>, 780
<compile-time text>, 781
867
Index
Compile-time facility (cant.)
<compile-time thru statement>, 785
<compile-time variable>, 778
<compile-time variable declaration>, 777
<compile-time while statement>, 785
<ctlist option>, 787
<ctmon option>, 787
<cttrace option>, 788
<definition>. 786
<listskip option>, 788
<number identifier>, 777
<starting value>, 777
<vector length>, 777
Compiler control options, 603
ASCII option, b03
AUTOBIND option, 603
BCL option. 605
BEGINSEGMENT option, 605
BIND option, 607
BINDER option, 607
BREAKHOST option, 608
BREAKPOINT option, 609
B7700 option, 609
CHECK option, 610
CODE option, 610
DUMP INFO option, 611
END SEGMENT option. 611
ERRLIST option, 612
EXTERNAL option, 612
FORMAT option. 613
GO TO option, 613
HOST option. 614
INCLNEW option, 614
INCLSEQ option. 615
INCLUDE option, 615
INITIALIZE option, 617
INSTALLATION option, 618
INTRINSICS option, 619
LEVEL option, 619
LIBRARY option, 620
LIMIT option, 620
LINEINFO option. 621
LIST option. 621
LISTDELETED option, 622
LISTINCL option, 622
LISTOMITTED option. 623
LISTP option. 623
LOADINFO option, 623
MAKEHOST option. 625
MCP option, 628
MERGE option, 628
NEW option, 629
NEWSEQERR option, 630
868
ALGOL REFERENCE MANUAL
Compiler control options (cont.)
NOBCL option, 630
NOBINDINFO option, 631
NOSTACKARRAYS option, 631
NOXREFLIST option, 632
OLDRESIZE option, 632
OMIT option, 633
OPTIMIZE option. 633
PAGE option, 633
PURGE option, 634
SEGDESCABOVE option, 634
SEGS option, 635
SEPCOMP option, 635
SEQ option, 637
SEQERR option, 638
sequence base option, 638
sequence increment option, 639
SHARING option, 639
SINGLE option, 640
STACK option, 641
STATISTICS option. 641
STOP option. 642
TADS option, 643
TARGET option, 644
TIME option, 645
USE option, 646
user option, 646
VERSION option, 647
VOID option. 648
VOIDT option, 649
WARNSUPR option, 649
WRITEAFTER option, 649
XDECS option, 650
XREF option, 650
XREFFILES option. 652
XREFS option, 653
$ option, 653
<compiler control record>. 596
Compiler input files, 589
Compiler output files, 591
<compiletime function>, 538
<complex assignment>, 237
<complex case expres~ion>, 507
Complex data type
complex array declaration. 41
complex array reference declaration, 52
complex assignment, 237
COMPLEX declaration. 58
complex expression, 506
complex functions
CCOS function, 535
CEXP function, 536
CLN function. 537
869
Index
Complex data type (cant.)
COMPLEX function, 538
CONJUGATE function, 539
CSIN function. 539
CSQRT function, 540
complex operand internal structure, 826
complex procedure declaration, 165
complex relation, 500
complex value array declaration. 214
functions with complex parameters
CABS function, 535
IMAG function, 557
REAL function. 571
intrinsic functions returning values of type COMPLEX, 531
width of complex array elements, 45
<complex declaration>. 58
(complex equality operator>, 494
<complex expression>, 506
<complex function>, 538
<complex function designator>, 516
<complex identifier>, 58
<complex intrinsic name>, 516
alphabetical listing of. 531
<complex operand>. 507
Complex operand internal structure, 826
<complex operator>, 506
<complex primary>, 506
<complex relation>, 494
<complex updat~ assignment>, 237
<complex variable>, 237
<compound statement>, 9
<concatenation>, 485
<concatenation expression>, 484
<condition>, 381
<conditional arithmetic expression>. 476
<conditional Boolean expression>, 495
<conditional complex expression>, 507
<conditional designational expression>. 512
<conditional expression>, 510
<conditional pointer expression>, 520
<conjugate function>, 539
<constant>, 214
<constant arithmetic expression>, 476
<constant expression>, 214
<constant list>, 214
<constant string expression>, 525
Contents of printer listing
CODE option. 610
FORMAT option, 613
LIST option. 621
LISTDELETED option, 622
LISTINCL option, 622
LISTOMITTED option, 623
870
ALGOL REFERENCE
Contents of printer listing (cant.)
LISTP optio~, 623
PAGE option, 63:;
SEGS option. 635
SINGLE option, 640
STACK option. 641
TIME option, 64:WARNSUPR option. 64q
S option, 653
<continue statement>. 285
<control character>, 149
<control part>, 73
<copy number>. 298
<core-to-core blocking>, 360
<core-to-core blocking part>, 360
<core-to-core file part>, 360
<core-to-core part>. 360
<core-to-core record size>. 3bO
<cos function>, 539
<cosh function>, 539
<cotan function>, 539
<count>. 252
<count item name>, 697
<count part>, 381
<create statement>, 718
Critical block. 351
Cross reference, 650
NOXREFLIST option, 632
XDECS option, 650
XREF option, 650
XREFFILE file, 593
XREFFILES option, 652
XREFS option, 653
<csin function>, 539
<csqrt function>, 540
<cycle increment>, 647
<dabs function>. 540
<dand function>, 540
<darccos function>, 540
<darcsin function>, 541
<darctan function>, 541
<darctan2 function>, 541
<data>. 792
Data descriptors
internal structure, 827
<data error label>. 362
<data exponent part>, 102
Data number. 102
<data set>, 703
<data set name>, 681
<data set reference>. 681
MANUA~
87:
Index
<database attribute assignment statement>, 68Q
<database declaration>. 680
<database identifier>. 715
<database name>, 681
<database reference>. b80
<database title>, 681
Databases
binding of, 774
separate compilation of, 776
<datadictinfo option>. 772
(dcos function>. 541
<dcosh function>. 542
<deallocate statement>, 287
<decimal fraction>, 23
<decimal function>. 542
<decimal number>, 23
<decimal places>. 92
<declaration>. 3G
<declaration list>. Q
Default character type, 817
<define declaration>. 60
<define identifier>. 60
<define invocation>, 62
<definition>. 60
extension in the compile-time facility, 786
<delete statement>. 722
<delimiter>. 16
<delinklibrary function>. 543
<delta function>. 543
<deqv function>. 544
<derf function>. 544
<derfc function>, 544
<designational case expression>, 512
<designational expression>. 512
<destination>. 379
<destin~tion characters>, 203
<detach statement>, 288
<device>, 273
<dexp function>, 544
<dgamma function>, 54:)
Diagnostic tools
BREAKHOST option, 608
BREAKPOINT option. 609
BREAKPOINT statement, 250
DUMP declaration, 73
MONITOR declaration, 136
PROGRAMDUMPstatement, 355
STATISTICS option, 641
TADS option, 643
<digit>, 16
<digit convert part>, 380
Dimensionality of arrays, 47
<dimp function>. 545
872
ALGOL REFERENCE MANUAL
<dinteger function>, 545
<direct array declaration>. 68
<direct array identifier>, 68
<direct array name> , 69
<direct array reference identifier>, 52
<direct array row> , 68
<direct array row equivalence>, 68
<direct file identifier>, 85
Direct I/O, 316
<direct switch file identifier>, 189
<directory element>. 270
<disable statement>. 289
<disabling on statement>, 336
<disk size>, 437
<display statement>. 291
<disposition>, 273
DIV, 479
Division. 478
<dlgamrna function>, 545
<dln function>, 546
<dlog function>, 546
<dmax function>, 546
<dmin function>, 546
<dmterminate statement>, 724
<dmtest function>, 763
<dnabs function>, 547
<dnot function>, 547
<do statement>. 293
<dor function>, 547
Double data type
arithmetic assignment, 225
arithmetic expression, 475
arithmetic relation, 500
direct double array declaration, 68
double array declaration, 41
double array reference declaration. 52
DOUBLE declaration, 71
double functions
DABS function, 540
DAND function. 540
DARCCOS function, 540
DARCSIN function, 541
DARCTAN function, 541
DARCTAN2 function, 541
DCOS function. 541
DCOSH function, 542
DECIMAL function, 542
DEQV function, 544
DERF function. 544
DERFC function, 544
DEXP function. 544
DGAMMA function, 545
DIMP function, 545
873
Index
Double data type (cont.)
DINTEGER function, 545
DLGAMMA function, 545
DLN function, 546
DLOG function, 546
DMAX funct ion, 5l~6
DMIN function, 546
DNABS function, 547
DNOT function, 547
DOR function, 547
DOUBLE function, 548
DSCALELEFT function, 550
DSCALERIGHT function, 550
DSCALERIGHTT function, 551
DSIN function, 551
DSINH function. 551
DSQRT function. 551
DTAN function, 552
DTANH function, 552
<pot function>, 568
POTe function, 568
POTH function, 568
POTL function, 568
double procedure declaration, 165
double value array declaration, 214
double-precision operand internal structure, 824
functions for manipulating doUble-precision expressions
BOOLEAN function, 535
FIRSTWORD function, 554
INTEGER function, 557
INTEGERT function, 558
REAL function. 571
SECONDWORD function, 574
SINGLE function. 577
STRING function, 578
intrinsic functions returning values of type DOUBLE, 530
width of double array elements, 45
<double declaration>, 71
<double function>, 548
<double identifier>. 71
<double variable>, 447
Double-precision operand internal structure. 824
<drop function>, 54q
DS (Discontinue) ODT command, 661
<dscaleleft function>. 550
<dscaleright function>, 550
<dscalerightt function>. 551
<dsin function>, 551
<dsinh function>, 551
<dsqrt function>, 551
<dtan function>, 552
<dtanh function>. 552
<dump declaration>. 73
874
ALGOL REFERENCE MANUAL
<dump list>, 73
<dump parameters>, 73
<dumpinfo option>, 611
<dynamic procedure specification>, 169
<EBCDIC character>. 35
<EBCDIC code>, 35
<EBCDIC string>, 35
<EBCDIC string constant>, 524
<editing modifier>, 92
<editing phrase>, 91
Editing phrase
A editing phrase letter, 98
using pointers and string variables, 99
C editing phrase letter, 98
using pointers and string variables, 99
D editing phrase letter, 102
decimal places, 96
E editing phrase letter, 104
editing modifiers, 120
F editing phrase letter, 104
field width, 96
G editing phrase letter. 105
H editing phrase letter, 106
I editing phrase letter, 108
J editing phrase letter, 110
K editing phrase letter, 106
L editing phrase letter, 111
multiple editing phrases. 93
o editing phrase letter, 112
P editing modifier, 120
R editing phrase letter, 113
repetition of. 95
S editing phrase letter, 114
simple string literal, 94
T editing phrase letter, 116
U editing phrase letter, 116
V editing phrase letter, 117
variable editing phrases. 97
X editing phrase letter, 118
Z editing phrase letter, 119
$ editing modifier, 120
<editing specifications>. 90
EMPTY, 526
EMPTY6, 526
EMPTY7, 526
EMP'l'Y8, 526
<enable statement>. 295
<enabling on statement>, 334
<end remark>, 27
<end-of-record>. 373
<ending index>. 537
875
Index
<endsegment option>, 611
<endtransaction parameters>, 726
<endtransaction statement>, 726
<entier function>, 552
Entry pOint, See Library entry point
<entry specifier>, 792
<environment>, 625
<eof label), 362
<equality operator>, 495
<equation part>, 55
EQV, 49b
<erf function>, 553
<erfc function>, 553
<errlist option>, 612
Error handling for libraries, 660
<error limit>, 620
Error messages
for formatted input, 834
for formatted output. 832
for free-field input, 831
ERRORFILE file, 592
<escape remark>, 27
<escape text>, 27
<event array declaration>, 78
<event array designator>, 79
<event array identifier>, 78
<event declaration>, 78
<event designator>. 78
Event handling
ATTACH statement, 248
AVAILABLE function, 535
CAUSE statement. 266
CAUSEANDRESET statement, 268
DETACH statement, 288
EVENT ARRAY declaration, 78
EVENT declaration, 78
FIX statement, 303
FREE statement, 311
HAPPENED function, 555
LIBERATE statement, 324
PROCURE statement, 353
RESET statement. 414
SET statement, 435
up-level event
in ATTACH statement. 248
in direct I/O, 317
WAIT statement, 452
WAITANDRESET statement, 456
<event identifier>. 78
<event list>, 452
<event statement>, 297
Ev~nt-valued attributes, See also Event handling
interrogating
876
ALGOL REFERENCE MANUAL
Event-valued attributes (cont.)
<event designator>. 78
<event-valued task attribute>, 79
<event-valued task attribute name>, 79
<exception handling>, 768
<exception value>, 770
<exception variable>, 768
<exchange statement>. 298
<exp function>, 553
<explicit delimiter>, 373
<exponent part>, 24
Exponentiation, 479
<export declaration>, 81
<expression>, 473
<external option>, 612
<family designator>, 409
<fault action>, 336
<fault information part>, 335
<fault list>, 334
<fault name>, 335
<fault number>, 335
<fault stack history>, 335
<field>, 372
<field delimiter>, 372
<field item identifier>. 704
<field item name>, 697
Field notation, 807
<field width>, 91
<file declaration>, 85
<file designator>. 189
File handling, See I/O
<file identifier>, 85
File parameters, 178
<file part>, 359
semantics, 364
<file specification>, 611
<file-valued task attribute name>, 461
<fill statement>, 300
<find statement>, 729
<first function>, 554
<firstone function>, 554
<firstword function>, 554
<fix statement>, 303
<for list element>, 305
<for statement>, 305
<formal parameter>, 166
<formal parameter list>, 166
<formal parameter part>, 166
<formal parameter specifier>, 168
Formal parameters, 173
<formal symbol>. 60
877
Index
<formal symbol part>, 60
<format and list part>. 361
semantics for READ statement, 368
semantics for WRITE statement, 465
<format declaration>. 89
<format designator>, JL92
<format identifier)~ 89
<forma t opt ion>. 613
<format part>, 89
Format-error messages
formatted input, 834
formatted output, 832
free-field input, 831
Formatted input format-error messages. 834
Formatted output format-error messages, 832
Formatted read, 368
Formatted write, 465
<forward interrupt declaration>. 121
<forward procedure declaration>, 121
<forward reference declaration>, 121
<forward switch label declaration>, 121
<free statement>. 311
Free-field data format. 371
Free-field data record, 372
Free-field input format-error messages, 831
<free-field part>, 361
<freeze statement>, 312
Fully-specified formal procedure, 173
<function expression>, 514
FUNCTIONNAME library attribute. 665
Functions, 528
ABS function. 532
ACCEPT statement, 222
ARCCOS function, 532
ARCSIN function, 532
ARCTAN function, 533
ARCTAN2 function. 533
ARRAY SEARCH function. 534
ATANH function r 534
AVAILABLE function. 535
BOOLEAN function, 535
CABS function, 535
CCOS function, 535
CEXP function, 536
CHANGEFILE statement, 270
CHECKPOINT statement. 274
CHECKSUM function. 537
CLN function. 537
CLOSE statement, 281
COMPILETIME function, 538
COMPLEX function, 538
CONJUGATE function, 539
COS function. 539
878
ALGOL REFERENCE MANUAL
Functions (cont.)
COSH function, 539
COTAN function, 539
CSIN function. 539
CSQRT function, 540
DABS function, 540
DAND function. 540
DARCCOS function, 540
DARCSIN function. 541
DARCTAN function, 541
DARCTAN2 function, 541
DCOS function, 541
DCOSH function. 542
DECIMAL function. 542
DELINKLIBRARY function. 543
DELTA function, 543
DEQV function, 544
DERF function. 544
DERFC function. 544
DEXP function, 544
DGAMMA function, 545
DIMP function. 545
DINTEGER function. 545
DLGAMMA function. 545
DLN function, 546
DLOG function, 546
DMAX function. 546
DMIN function, 546
DNABS function. 547
DNOT function, 547
DOR function, 547
DOUBLE function, 548
DROP function, 549
DSCALELEFT function. 550
DSCALERIGHT function. 550
DSCALERIGHTT function. 551
DSIN function, 551
DSINH function. 551
DSQRT function, 551
DTAN function. 552
DTANH function. 552
ENTlER function. 552
ERF function, ~53
ERFC function. 553
EXP function, 553
FIRST function. 554
FIRSTONE function. 554
FIRSTWORD function. 554
FIX statement. 303
FREE statement. 311
GAMMA function. 555
HAPPENED function. 555
HEAD function, 55t.
879
Index
Functions (cont.)
IMAG function, 5~57
INTEGER function, 557
INTEGERT function, 558
intrinsic functic::ms returning values
intrinsic functions returning values
intrinsic functions returning values
intrinsic functions returning values
intrinsic functions returning values
intrinsic functi(:ms returning values
intrinsic functions teturning values
LENGTH fUnction, 5SQ
LINENUMBER function. 559
LINKLIBRARY function. 559
LISTLOOKUP function, 561
LN function. 562
LNGAMMA function, 562
LOG function. 562
MASKSEARCH function, 562
MAX function. 563
~ESSAOESEARCHER statement. 331
MIN function, Sb3
NABS function, 564
NORMALIZE function. 564
OFFSET function. 564
ONES function. 565
OPEN statement, 340
POINT£R function 565
<pot function>, 568
POTe function, 568
POTH function, 568
POTL function, 568
PROCESSID function. 5b8
RANDOM function, 569
READ statement. 363
READLOCK function, 56g
REAL function. 570
REMAININGCHARS function, 571
REMOVEFILE statement. 377
REPEAT function. 572
SCALELEFT function. 572
SCALERIGHT function, 513
SCALERIGHTF function, 573
SCALERIGHTT function. 574
SECONDWORDfunction. 574
SEEK statement. 433
SETACTUALNAME function. 575
SIGN function. 576
SIN functiOn, 577
SINGLE function, 577
SINH function. 577
SIZE function. 577
SPACE statement. 445
9
of
of
of
of
of
of
of
type
type
type
type
type
type
type
BOOLEAN. 531
COMPLEX. 531
DOUBLE, 530
INTEGER. 530
POINTER. 531
REAL, 530
STRING. 531
880
ALGOL REFERENCE
MANUA~
Functions (cont.)
SQRT function, 578
STRING function, 578
STRING4 function, 578
STRING7 function. 578
STRING8 function. 578
TAIL function, 580
TAKE function, 581
TAN function. 582
TANH function, 582
TIME function. 582
TRANSLATE function, 584
VALUE function. 585
WAIT statement, 453
WAITANDRESET statement, 456
WRITE statement, 462
<gamma function>, 555
<generate statement>, 734
<get statement>, 737
Global identifiers, 13
<global part>, 10
<go to option>, 613
<go to statement>. 313
<group item name>. 697
<happened function>, 555
<head function>, 550
<hex string>, 372
<hexadecimal character>, 34
<hexadecimal code>, 33
<hexadecimal string>, 33
<hexadecimal string constant>, 525
Hexadecimal strings in free-field data records, 374
HOST file, 590
<host option>, 614
I/O
ACCEPT statement. 221
DIRECT ARRAY declaration, 68
direct I/O. 316
DISPLAY statement, 291
file handling, See also Attribute handling
CHANGEFILE statement. 270
CLOSE statement, 280
EXCHANGE statement. 298
FILE declaration, 85
LOCK statement, 325
MERGE statement, 327
multiple attribute assignment statement. 332
881
Index
I/O (cont.)
OPEN statement. 340
REMOVEFILE statement. 377
REWIND statement, 423
SEEK statement, 433
SPACE statement. 445
SWITCH FILE declaration. 189
formatting
FORMAT declaration. 89
free-field data format, 371
LIST declaration. 132
run~time format-error messages. 831
SWITCH FORMAT declaration, 192
SWITCH LIST declaration. 197
I/O statement, 315
normal I/O, 31b
READ statement, 359
serial I/O operation, 433
WRITE statement, 461
WRITEAFTER option, 649
<I/O statement>, 315
<identifier>, 21
<if clause>, 319
<if statement>, 319
<imagfunction>, 557
<immediate option>, 597
IMP. 496
<in-out part>, 89
<inclnew option>, 614
<inclseq option>, 615
INCLUDE files, 590
<include option>, 615
<index>, 252
<index and count>, 252
<index or range>, 252
INFO file. 590, 593
<initial part>. 305
<initial value>, 300
<initialize option>, 617
Initialized pointer, 161
<input assignment>, 696
<input file>. b08
<input mapping>, 696
<input option>, 43b
<input procedure>. 436
<insert statement>. 739
<installation number>. 618
<installation number list>, 618
<installation option>, 618
<integer>. 24
Integer data type
arithmetic assignment~ 225
arithmetic expression, 475
882
ALGOL REFERENCE MANUAL
Integer data type (cont.)
arithmetic relation, 500
direct integer array declaration, 68
functions for manipulating integer expressions
BOOLEAN function, 535
DINTEGER funct~on. 545
DOUBLE function, 548
NORMALIZE function, 564
STRING function, 578
integer array declaration, 41
integer array reference declaration~ 52
INTEGER declaration, 123
integer functions
ARRAY SEARCH function, 534
CLOSE statement, 281
DELINKLIBRARY function, 543
DELTA function, 543
ENTlER function, 552
FIRSTONE function, 554
INTEGER function, 557
INTEGERT function. 558
LENGTH function. 559
LINENUMBER function. 559
LINKLIBRARY function, 559
LISTLOOKUP function, 561
MASKSEARCH function, 562
MESSAGESEARCHER statement, 331
OFFSET function, 564
ONES function~ 565
OPEN statement, 340
PROCESSID function. 568
REMAININGCHARS function, 571
SCALELEFT function, 572
SCALERIGHT function, 573
SCALERIGHTT function, 574
SETACTUALNAME function, 575
SIGN function, 576
SIZE function. 577
VALUE function, 585
WAIT statement, 453
WAITANDRESET statement, 456
integer operand internal structure, 821
integer procedure declaration, 165
integer value array declaration. 214
intrinsic functions returning values of type INTEGER. 530
width of integer array elements, 45
<integer declaration>, 123
<integer function>. 557
<integer identifier>, 123
Integer operand internal structure. 821
<integer variable>, 447
<integert function>. 558
<internal file name>, 611
883
. Index
<internal name>, 681
<iriterrupt declaration>, 126
Interrupt handling
ATTACH statement. 248
DETACH statement. 288
DISABLE statement, 289
ENABLE statement, 295
INTERRUPT declaration. 126
interrupt statement. 322
ON statement, 334
<interrupt identifier>, 126
<interrupt statement>, 322
INTNAME library attribute, 665
Intrinsic functions, See Functions
<intrinsic translate table>. 383
<intrinsics option>, 619
<introduction>, 148
<introduction code>. 148
<invocation statement>. 323
Invoking defines, 61
<iotime restriction>, 791
IS, 497
ISNT, 497
<item>, 757
<iteration clause>. 133
<iteration part>, 305
< job>. 71:12
Job and task contrOl, See also Attribute handling
CALL statement, 259
CHECKPOINT statement. 273
CONTINUE statement. 285
PROCEDURE declaration. 165
PROCESS statement, 350
PROCESSID function. 568
RUN statement. 425
TASK ARRAY declaration. 199
task aSSignment, 246
TASK declaration. 199
ZIP statement, 470
<job specifier>. 792
<job title>, 792
<key condition>. 704
<label
<label
<label
<label
<label
counter> • 74
counter modulus>. 73
declaration> 128
designator>, 512
identifier>, 128
!,
884
ALGOL REFERENCE MANUAL
<labeled statement>. 220
<language component>, 15
<language name>. 142
<language specification>, 329
<left bit>, 489
<left bit from>. 485
<left bit to>, 485
<length function>, 559
Length of string literals, 387
<letter>, 16
<letter string>, 17
<level option>. 619
<level 2 procedure>, 10
<lex level restriction part>, 160
LIBACCESS library attribute, 666
assigning values
LIBRARY declaration, 129
mnemonic attribute assignment, 239
<liberate statement>, 324
LIBPARAMETER library attribute, 666
<library attribute specifications>, 129
<library declaration>, 129
Library entry point
allowed parameters, 82
allowed types, 82
at initiation, 657
declaration of in calling program, 172
declaration of in library program. 81
matching types, 668
passing parameters. 669
<library entry point identifier>. 575
<library entry point specification>. 169
Library handling
ACTUALNAME. 173
assigning values to LIBACCESS library attribute. 129, 239
assigning values to string-valued library attributes, 129, 243
attributes, 665
calling programs, 656
CANCEL statement, 261, 660
creation of libraries, 662
delinking, 660
DELINKLIBRARY function, 543, 660
description of libraries. 655
direct linkage, 659
duration. 658
dynamic linkage, 659
entry points
allowed parameters, 82
allowed types. 82
at initiation, 657
declaration of in calling program, 172
declaration of in library program. 81
matching types, 668
885
Index
Library handling (cent.)
passing parameters, 669
error handling, 660
examples
calling programs, 674, 678
direct linkage, 675
dynamic linkage, 671, 676
indirect linkage. 676
EXPORT declaration, 81
FREEZE statement. 312
functional description of libraries, 656
indirect linkage, 659
initiation, 657
interrogating string-valued library attributes, 523
LIBRARY declarat:Lon. 129
library directories. 656
library programs, 656
library templates, 656
linkage provisions, 659
LINKLIBRARY function, 559. 664
parameter passing rules, 669
permanent specification. 658
PROCEDURE declaration, 165
referencing libraries. 664
restricting use, 662
SETACTUALNAME function, 575. 665
SHARING option, 639. 662
temporary specification, 658
<library identifier>, 129
<library option>, 620
Library SHARING option
DONTCARE, 639. 663
PRIVATE, 639, 662
SHAREDBYALL, 639, 662
SHAREDBYRUNUNIT, 639. 662
<limit option>, 620
LINE file, 591
<lineinfo option>, 621
<linenumber function>, 559
<linewidth>, 650
<link item>. 70:,
<linklibrary function>, 559. 664
<list>., 361
<list declaration>, 132
<list designator>, 197
<list element>, 133
<list identifier). 132
<list option>. 621
<listdb option>, 772
<listdeleted option>, 622
<listincl option>. 622
<listloOkup function>, 561
<listomitted option>. 623
886
ALGOL REFERENCE MANUAL
<listp option>, 623
<In function>. 562
<lngamma function>, 562
<loadinfo option>, 623
Local identifiers, 13
<lock option>, 325
<lock statement>, 325
<log function>, 562
<logical database name>, 681
<logical operator>, 18
Logical operators, 497
AND, 496
EQV. 496
IMP, 496
NOT, 496
OR, 496
precedence of, 499
results of, 497
Long (unpaged) arrays, 44
<lower bound>, 42
<lower bound list> ..168
<lower bounds>, 52
<lower limit>, 74
<makehost option>~ 625
<masksearch function>, 562
<max function>, 563
<MCP option>, 628
<membership expression>, 207
<membership primary>, 208
<memory size>, 437
<merge option>, 628
<merge statement>, 327
<merging option>, 327
<merging option list>, 327
<messagesearcher statement>, 329
<midtransaction parameters>. 744
<midtransaction statement>, 744
<min function>. 563
MLS, See MultiLingual System (MLS)
<mnemoniC attribute>. 239
<mnemonic attribute assignment>, 239
<mnemoniC attribute value>, 239
<mnemonic file attribute value>. 86
<mnemonic library attribute>, 239
<mnemonic library attribute specification>, 130
<mnemonic library attribute value>, 130
<mnemonic-valued library attribute name>. 130
MOD, 479
<modify statement>
as synonym for <BDMS lock statement>. 741
<monitor declaration>. 136
887
Index
<monitor element>, 136
<multidimensional array designator>. 415
MultiLingual System (MLS)
MESSAGESEARCHER statement, 329
OUTPUTMESSAGE ARRAY declaration. 141
<multiple attribute assignment statement> .. 332
Multiplication. 478
MUX, 479
<nabs function>, 564
<name and title>, 611
<new character>, 148
<new option>, 629
<new size>, 415
<new value>, 255
<newsegerr option>, 630
NEWTAPE file. 591
<noBCL option>, 630
<nobindinfo option>, 631
<nodmdefines option>, 773
Normal I/O. 316
<normalize function>, 564
Normalized form
double precision, 826
single precision, 821
<nostackarrays option>, 631
NOT, 496
<noxreflist option>. 632
Null statement, 219
<number>, 23
<number list>. 263
<number of bits>, 485
<number of columns>, 361
<number of tapes>. 437
<numbered statement group>, 263
<numbered statement list>, 263
Numbers
compiler conversion. 26
exponents. 26
in free-field data records, 374
ranges in ALGOL, 25
<numeric convert part>, 380
<numeric item>. 763
<numeric item identifier>, 704
<numeric item name>. 697
<numeric relation>. 704
NumeriC sign. 819
<numeric string literal>. 30
<octal character>, 33
<octal code>. 32
888
ALGOL REFERENCE MANUAL
<octal string>. 32
<offset function>, 564
<oldresize option>, 632
<omit option>, 633
<on statement>. 334
<one-dimensional array name>, 43
<one-dimensional direct array name>, 68
<ones function>. 565
<open option>, 340
<open statement>, 340
<operator>, 17
<optimize option>, 633
Optimizing code
BEGINSEGMENT option. 605
B7700 option. 609
ENDSEGMENT option. 611
OPTIMIZE option, 633
TARGET option, 644
<option expression>, 598
<option phrase>. 596
<option primary>. 598
OR, 496
<outer level>. 619
<output assignment>, 700
<output mapping> , 700
<output message> . 142
<output message array> • 141
<output message array declaration>, 141
<output message array identifier>. 141
<output message case expression>, 143
<output message case part>, 143
<output message number> • 142
<output message parameter>, 143
<output 'message parameter number> , 143
<output message parameter value>. 143
<output message part> , 141
<output message segment> . 142
<output option> . 436
<output procedure> , 436
Own
arrays, 44
pointers, 161
simple variables. 123
<pack size>. 437
<page option>, 633
Paged (segmented) arrays, 44
<parameter delimiter>, 17
<parameter element>, 329
Parameters
array parameters, 171. 174
array specification. 171
Index
Parameters (cont.)
call-by-name. 170
call-by-referenCE? 1 71
call-by-value, 170
complex call-by-name parameters, 170
event parameters. 17g
file parameters, 178
format parameters, 179
label parameters. 179
list parameters, 179
parameters that can be call-by-value, 173
passing parameters to CANDE-initiated procedures, 171
passing parameters to procedures, 348
passing parameters to WFL-initiated procedures, 171
picture parameters, 179
pointer parameters. 179
procedure parameters, 175
restrictions on call-by-name pointer parameters, 164
simple variable parameters, 176
string parameters, 178
task parameters, 179
<parity error label>, 362
<partial word expression>, 489
<partial word part>. 489
<patch number>, 647
<picture>, 147
<picture character>. 149
<picture declaration>, 147
<picture identifier>, 147
<picture skip>, 148
<picture symbol>, 147
Pictures
affects of hardware flip-flops on picture symbols, 150
character fields affected by picture symbols, 151
characters used by picture symbols, 151
control characters. 153
in REPLACE statement, 402
introduction codes, 152
picture characters, 154
picture skip characters, 153
single picture characters, 153
string literals in pictures. 152
<pointer assignment>, 241
<pointer attribute specification>. 86
<pointer case expression>, 519
<pointer declaration>, 160
<pointer expression>, 519
<pointer function>, 565
<pointer function designator>, 517
Pointer handling, See Character string manipulation
<pointer identifier>, 160
<pointer intrinsic name>, 517
alphabetical listing of, 531
890
ALGOL REFERENCE MANUAL
<pointer
<pointer
<pointer
<pointer
<pointer
<pointer
part>. 494
primary>, 519
relation>. 494
statement>. 342
table membership>, 495
update assignment>, 241
<pointe~ variable>, 241
<pointer-valued attribute>, 411
Pointer-valued attributes
assigning values
FILE declaration. 85
multiple attribute assignment statement, 332
replace family-change statement, 409
replace pointer-valued attribute statement, 411
interrogating
REPLACE statement source part <pointer-valued attribute>, 380,
407
VALUE function. 585
<pointer-valued file attribute>, 411
<pointer-valued file attribute name>. 86
<pointer-valued task attribute>, 411
<pointer-valued task attribute name>. 412
Pointers
functions with pointer parameters
DELTA function, 543
DOUBLE function. 548
INTEGER function. 558
OFFSET function, 564
READLOCK function, 570
REAL function, 571
REMAININGCHARS function, 571
SIZE function. 577
STRING function. 578
initialized. 161
internal structure, 827
intrinsic functions returning values of type POINTER, 531
lexical level restrictions. 16:
own, 161
pointer assignment. 241
POINTER declaration. 160
pointer expression, 519
pointer functions
POINTER function, 565
READLOCK function, 570
pointer relation. 501
string relation, 500
up-level pointer assignment, 161
<population item name>, 6q7
<pot function>, 568
POTC, 568
paTH, 568
POTL, 568
891
Index
Precedence
of arithmetic operators, 480
of Boolean operators, 499
Precision of arithmetic expressions, 481
Primary coroutine, 259
<procedure body>, 169
<procedure declaration>, 165
<procedure heading>, 165
(procedure identifier>. 165
<procedure invocation statement>~ 346
Procedure parameters, 175
<procedure specification>, 167
<procedure type>, 165
Procedures
allowed parameters, 173
array parameters. 171, 174
as functions, 169
by-calling, 172
CALL statement. 259
call-by-name parameters, 170
call-by-reference parameters, 171
call-by-value parameters, 170
CONTINUE statement, 285
external, 172
file parameters, 178
formal, 173
formal parameters, 170
forward procedure declaration, 121
initiated through CANDE, 171
initiated through Work Flow Language (WFL), 171
library entry points, 172
passing parameters to, 348
PROCEDURE declaration. 165
procedure invocation statement. 346
procedure parameters, 175
PROCESS statement, 350
RUN statement. 425
selection procedure, 172
simple variable parameters, 176
string parameters, 178
<process statement>. 350
<processid function/, 568
<processtime restriction>, 791
<procure statement>, 353
<program unit>, Y
<programdump option>, 355
<programdump statement>. 355
<purge option>, 634
<put statement>, 750
<qualification>, 693
<quaternary code>, 32
892
ALGOL REFERENCE MANUAL
<quaternary string>, 32
<quoted string>, 372
Quoted strings in free-field data records, 374
Railroad diagrams, explanation of, 837
<random function>, 569
Range of numbers, 25
<read statement>, 359
READ statement
array row read, 370
binary read, 369
formatted read, 368
free-field data format, 371
free-field data record
hexadecimal strings, 374
numbers, 374
quoted strings, 374
unquoted strings, 373
<readlock function>, 569
Ready queue, 26b
Real data type
arithmetic assignment, 225
arithmetic expression, 475
arithmetic relation, 500
direct real array declaration, 68
functions for manipulating real expressions
BOOLEAN function, 535
DINTEGER function, 545
DOUBLE function, 548
ENTIER function, 552
INTEGER function, 557
INTEGERT function. 558
NORMALIZE function, 564
STRING function, 578
intrinsiC functions returning values of type REAL, 530
real array declaration, 41
real array reference declaration, 52
REAL declaration, 182
real functions
ABS function. 532
ARCCOS function, 532
ARCSIN function. 532
ARCTAN function, 533
ARCTAN2 function, 533
ATANH function, 534
CABS function, 535
CHECKSUM function, 537
COMPILETIME function, 538
COS function, 539
COSH function, 539
COTAN function, 539
ERF function, 553
893
Index
Real data type (cont.)
ERFC function, 553
EXP function, 553
FIRST function, 554
FIRSTWORD function, 554
GAMMA function, 555
IMAG function, !557
LN function, 562
LNGAMMA function, 562
LOG function, 562
MAX function. 563
MIN function, 563
NABS function, 564
NORMALIZE function, 564
RANDOM function, 569
READLOCK function~ 569
REAL function, 570
SCALERIGHTF function. 573
SECONDWORD function, 574
SIN function, 577
SINGLE function, 577
SINH function, 577
SQRT function, 578
TAN function, 582
TANH function, 582
TIME function, 582
real operand internal structure, 820
real procedure declaration, 165
real value array declaration, 214
width of real array elements, 45
<real declaration>, 182
<real function>, 570
<real identifier>, 182
<real item>. 763
<real item identifier>, 704
<real item name>, 697
Real operand internal structure, 820
<real variable>, 447
<record length>, 43 7
<record number>. 433
<record number or carriage control>, 359
<record type item name>, 697
<recreate statement>. 752
<relational operator>, 493
<remainingchars function>, 571
<remark>, 27
<remove statement>. 754
<removefile statement>, 377
<repeat function>. 572
<repeat part>, 90
<repeat part value>, 149
<replace family-change statement>. 409
<replace pointer-valued attribute statement>, 411
894
ALGOL REFERENCE MANUAL
<replace statement>, 379
REPLACE statement
short and long string literals, 387
string literals interpreted as arithmetic expressions, 392
<replace version>, 647
<reserved word>, 799
Reserved words, 800
type 1, 8Q3
type 2, 803
type 3, 805
<reset statement>, 414
Resettable standard Boolean options, 601
<residual count>, 381
<resize statement>, 415
<restart data set>, 712
<restart specifications>, 437
<result>, 360
<result length>, 329
<result pointer>, 329
<rewind statement>, 423
<row number>, 298
<row selector>, 43
<row/copy numbers>, 298
<run statement>. 425
<saveinput procedure identifier>, 744
<saveoutput procedure identifier>, 726
<scale factor>, 92
<scaleleft function>, 572
<scaleright function>, 573
<scalerightf function>, 573
<scalerightt function>, 574
<scan part>, 381
<scan statement>, 427
Scope, 12
gLobal identifiers. 13
local identifiers, 13
Secondary coroutine, 259
<secondword function>, 574
<seek statement>, 433
<segdescabove option>, 634
<segs option>. 635
<selection expression>, 703
<selectlon procedure identifier>, 169
Separate compilation. See Sepcomp facility
<separate procedure>, 10
Sepcomp facility
MAKEHOST option, 625
SEPCOMP option, 635
sepcomping databases. 776
<sepcomp option>, 635
<seq option>, 637
895
Index
<seqerr option>, 638
<sequence base option>, 638
<sequence increment option>, 639
<sequence number>, 613
<set>, 703
<set name>, 682
<set part>. 681
<set reference>, 681
<set selection expression>. 703
<set statement>, 435
<setactualname function>, 575
<sharing option>, 639
Short and long string literals, 387
<sign>, 23
<sign function>, 576
Signs of numeric fields, 819
<simple arithmetic expression>, 475
<simple Boolean expression>, 491
<simple complex expression>. 50b
<simple pointer expression>, 519
<simple source>, 409
<simple string literal>, 30
<simple variable>, 225
Simple variable parameters, 176
<sin function>, 577
<single function>, 577
<single option>. 640
<single picture character>, 149
<single space>. 19
<sinh function>, 577
<size function>. 577
<size specifications>, 437
<skip>, 519
<skip count>, 253
<sort statement>, 436
<source>, 381
<source characters>, 202
<source part>, 380
<source part list>, 379
<space>. 19
<space statement>. 445
<special array resize parameters>. 415
<special destination character>, 203
<special new character>, 148
<specification>. 166
<specified lower bound>, 168
<specifier>. 167
<sqrt function>. 578
<stack option>. 641
<start specification>, 615
<starting index>. 537
<statement>, 21<1
<statement list>, 0
896
ALGOL REFERENCE MANUAL
<statistics option>, 641
<stop option>, 642
<stop specification>, 615
<store statement>, 761
<string array declaration>, 187
<string array designator>, 187
<string array identifier>, 187
<string assignment>, 243
<string character set>, 556
String code, 36
String concatenation, 526
<string concatenation operator>. 523
<string constant>, 523
String data type
functions with string parameters
DECIMAL function, 542
DROP function, 549
FIRST function. 554 •
HEAD function, 556
LENGTH function, 55g
REPEAT function, 572
TAIL function, 580
TAKE function, 581
TRANSLATE function, 584
intrinsic functions returning values of type STRING, 531
STRING ARRAY declaration, 187
string assignment, 243
string concatenation, 526
STRING declaration, 185
string expression, 523
string expression relation, 501
string functions
DROP function, 549
HEAD function, 556
REPEAT function, 572
STRING function, 578
STRING4 function, 578
STRING7" function. 578
STRING8 function,"578
TAIL function, 580
TAKE function, 581
TRANSLATE function, 584
string parameters in procedures, 178
STRING PROCEDURE declaration. 165
<string declaration>, 185
<string designator>, 243
<string expression>, 523
String expression
in REPLACE statement. 408
<string expression relation>. 495
<string function~. 578
<string function designator>, 518
<string identifier>. 185
897
Index
<string intrinsic name>. 518
alphabetical listing of. 531
<string library attribute specification>, 129
<string literal>, 30
String literal
as an arithmetic primary, 478
ASCII string. 38
BCL string. 37
binary string, 31
character size, 36
default character type, 817
dollar signs in strings, 38
EBCDIC string. 35
hexadecimal string, 33
in editing specifications. 93, 94
in pictures, 152
in REPLACE statement source parts, 387
interpreted as arithmetic expression in REPLACE statement. 392
maximum length of. 37
octal string, 32
pool array, 37
quaternary string. 32
quotation marks in strings, 38
string code, 36
string length. 387
String manipulation. See Character string manipulation
String parameters, 178
<string primary>, 523
<string procedure identifier>, 165
<string relation>, 494
<string relational operator>, 493
<string type>. 185
<string variable>, 525
String-valued attributes
assigning values
LIBRARY declaration. 129
string assignment target <string-valued library attribute>. 243
interrogating
string primary <string-valued library attribute>, 523
<string-valued database attribute>, 689
<string-valued library attribute>. 525
<string-valued library attribute name>. 129
STRING4, 578
STRING7, 578
STRING8, 578
<structurenumber function>, 7~6
<subarray selector)~ 44
<subfile index>. 280
<subfile specification>. 360
<subscript>. 43
<subscripted BDMS identifier>, 692
<subscripted string variable>. 525
<subscripted variable>. 225
898
ALGOL REFERENCE MANUAL
<subset>, 704
Subtraction, 478
<swap statement>. 447
<switch file delaration>, 189
<switch file identifier>, 189
<switch file list>, 189
<switch format declaration>, 192
<switch format identifier>, 192
<switch format list>, 192
<switch format segment>, 192
<switch label declaration>, 195
<switch label identifier>, 195
<switch label list>, 195
<switch list declaration>~ 197
<switch list identifier>, 197
<symbol construct>, 15
<TADS option>, 643
<tail function>, 580
<take function>, 581
<tan function>. 582
<tanh function>, 582
TAPE file, 589
<target option>, 644
<task array declaration>, 199
<task array designator>, 200
<task array identifier>, 199
<task assignment>, 246
<task declaration>, 199
<task designator>, 200
Task handling, See Job and task control
<task identifier>, 199
Task-valued attributes, See also Job and task control
assigning values
task assignment, 246
interrogating
<task designator>, 200
<task-valued task attribute name>. 200
<text>. 61
THAW (Thaw Frozen Library) ODT command. 661
<thru statement>, 450
Thunk. 171
<time>, 452
<time function>. 582
<time option>, 645
<time restrictions>, 791
TIMES, 476
<title>, 611
TITLE library attribute, 666
Touched array, 50
<tracedb option>. 773
<transaction record variable>, 712
899
lndex
<transfer part>, 381
<tr~nslate function>, 584
<translate part>, 382
<translate table>, 382
Translate table
in REPLACE statement, 401
<translate table declaration>. 202
<translate table element>, 202
<translate table identifier>, 202
<translate-table attribute specification>, 86
Translate-table-valued attributes
assigning values
FILE declaration, 85
multiple attribute assignment statement. 332
VALUE function, 585
<translate-table-valued file attribute name>, 8b
<translation specifier>, 202
<translator's help text>, 142
<truth set declaration>, 207
<truth set identifier>, 207
<truth set table>, 382
Truth set table
in Boolean expr-essions. 502
in REPLACE statement, 404, 406
in SCAN statement, 430, 431
<type>, 41
<type declaration>. 212
Type declarations
BOOLEAN, 55
COMPLEX. 58
DOUBLE, 71
INTEGER. 123
POINTER, 160
REAL, 182
STRING, 185
Type transfer functions
BOOLEAN function, 535
COMPLEX function, 538
DECIMAL function, 542
DINTEGER function, 545
DOUBLE function. 548
ENTlER function. '552
FIRST func:ion. 554
FIRSTWORD function. 554
lMAG function. 557
INTEGER function. 557
INTEGERT function, 558
REAL function. 570
SECONDWORD function, 574
SINGLE function, 577
STRING function, 578
Types resulting from arithmetiC operations. 482
900
ALGOL REFERENCE MANUAL
Uninitialized pointer, 161
<unit count>, 380
<unlabeled statement>, 220
Unpaged (long) arrays, 44
<unquoted string>, 372
Unquoted strings in free-field data records. 373
Unsegmented arrays, See Unpaged (long) arrays
<unsigned integer>, 23
<unsigned number>, 23
<up or down>, 409
Up-level event
in ATTACH sta~ement, 248
in direct I/O, 317
Up-level pointer assignment, 161
<update pointer>, 379
<update symbols>. 227
<upper bound>. 42
<upper limit>, 74
<use option>. 646
<user option>. 646
<value array declaration>, 214
<value array identifier>, 214
<value function>. 585
<value list>. 300
<value option>, 5~8
<value part>. 166
<variable>, 225
<version increment>, 647
<version option>, 647
<void option>, 648
<voidt option>, 649
<wait parameter list>, 452
<wait statement>. 452
<waitandreset statement>, 456
<warnsupr option>. 649
<when statement>. 458
<while statement>, 459
Width of array elements. 45
Word array, 45
<word array identifier>, 42
<write file part>, 461
semantics. 463
<write statement>. 461
WRITE statement
array row write. 467
binary write. 466
formatted write. 465
<writeafter option>, 649
901
Inde:x
<xdecs option>. 650
<xref option>, 650
XREFFILE file, 593
<xreffiles option>, 652
<xrefs option>, 653
ZIP
with array. 470
with file, 471
<zip statement>, 470
<$ option>, 653
** (exponentiation operator), 479
I (OR), 496
I I (string concatenation operator), 526
">
/
Descargar
Solo un recordatorio amistoso. Puedes ver el documento aquí mismo. Pero lo más importante es que nuestra IA ya lo ha leído. Puede explicar cosas complejas en términos sencillos, responder a tus preguntas en cualquier idioma y ayudarte a navegar rápidamente incluso por los documentos más largos o complicados.
Anuncio