|
|
DataMuseum.dkPresents historical artifacts from the history of: CP/M |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about CP/M Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 157952 (0x26900)
Types: TextFile
Names: »D54«
└─⟦1e8064b49⟧ Bits:30005867/disk07.imd Dokumenter (RCSL m.m.)
└─⟦this⟧ »D54«
F_4R_C_ _B_A_S_I_C_ _F_U_N_C_T_I_O_N_S_
4.1I_n_t_r_o_d_u_c_t_i_o_n_
RC BASIC provides a number of functions to perform various
calculations, thereby eliminating the need to write programs for
these calculations.
RC BASIC functions generally have a three-letter mnemonic name,
followed by a parenthesized expression as an argument, and may
be used as an expression or included as part of an expression.
Standard mathematical functions included in RC BASIC and the
values which they produce are as follows:
ABS(X) Absolute value of X.
ATN(X) Arctangent of X in radians.
COS(X) Cosine of X, where X is in radians.
EXP(X) eUUUXDDD (-1000 = X = 1000).
LOG(X) Natural logarithm of X (X ' 0).
SIN(X) Sine of X, where X is in radians.
SQR(X) Square root of X (X '= 0).
TAN(X) Tangent of X, where X is in radians.
In addition to these standard arithmetical and trigonometrical
functions, the RC BASIC system includes the following:
FNa(d) Functions defined by the user.
INT(X) Integer value of X.
RND(X) Random number between 0 and 1.
SGN(X) Algebraic sign of X.
SYS(X) System information functions.
Further RC BASIC functions, which are described in other
chapters, are these:
CHR(X) String function (see Ch. 5).
DET(X) Matrix function (see Ch. 6).
EOF(X) File function (see Ch. 8).
LEN(X<) String function (see Ch. 5).
ORD(X<) String function (see Ch. 5).
TAB(X) Printing function (see Ch. 3).
\f
T_ 4.2A_B_S_(_X_)_
F_o_r_m_a_t_
ABS(expr')
expr': a numeric expression.
U_s_e_
As a function to return the absolute (positive) value of expr'.
&_
T_E_x_a_m_p_l_e_
* LIST
0010 PRINT ABS(-10);ABS(10)
* RUN
10 10
END
AT 0010
&_*
T_ 4.3A_T_N_(_X_)_
F_o_r_m_a_t_
ATN(expr')
expr': a numeric expression (- /2 = ATN(expr') = /2).
&_
U_s_e_
As a function to calculate the angle, in radians, whose tangent
is expr'.
\f
T_E_x_a_m_p_l_e_
* LIST
0010 PRINT ATN(0);ATN(1)*180/SYS(14)
* RUN
0 45
END
AT 0010
&_*
T_ 4.4C_O_S_(_X_)_
F_o_r_m_a_t_
COS(expr')
expr': a numeric expression specified in radians.
&_
U_s_e_
As a function to calculate the cosine of an angle which is
expressed in radians.
T_E_x_a_m_p_l_e_
* LIST
0010 PRINT COS(0);COS(45*SYS(14)/180)
* RUN
1 .707107
END
AT 0010
&_*
T_ 4.5E_X_P_(_X_)_
F_o_r_m_a_t_
EXP(expr')
&_ expr': a numeric expression (-178 = expr' = 175).\f
U_s_e_
As a function to calculate the value of e (2.71828) to the power
of expr'.
T_E_x_a_m_p_l_e_
* LIST
0010 PRINT EXP(1);EXP(2);EXP(2.5)
* RUN
2.71828 7.38905 12.1825
END
AT 0010
&_*
T_ 4.6F_N_a_(_d_)_
For description, see the DEF statement, Chapter 3.
&_
T_ 4.7I_N_T_(_X_)_
F_o_r_m_a_t_
INT(expr')
expr': a numeric expression.
&_
U_s_e_
As a function to return the value of the nearest integer not
greater than expr'.\f
T_E_x_a_m_p_l_e_
* LIST
0010 PRINT INT(4.567);INT(-4.567)
* RUN
4 -5
END
AT 0010
*
&_
T_ 4.8L_O_G_(_X_)_
F_o_r_m_a_t_
LOG(expr')
expr': a numeric expression.
&_
U_s_e_
As a function to calculate the n_a_t_u_r_a_l_ logarithm of expr'.
T_E_x_a_m_p_l_e_
* LIST
0010 PRINT LOG(2);LOG(EXP(1))
* RUN
.693149 1
END
AT 0010
*
&_
T_4.9R_N_D_(_X_)_
F_o_r_m_a_t_
&_RND(expr')
expr': a numeric expression (required, but not used). \f
T_U_s_e_
As a function to produce a pseudo random number, n, such that
0 = n 1.
&_
T_R_e_m_a_r_k_s_
1. The RND(X) function requires an argument, although the
argument does not affect the resulting random number and the
function does not affect the argument.
&_
2. Each time the RND(X) function is called, it produces a pseudo
random number in the range 0 to 1. The sequence in which
these numbers are generated is fixed. The length of the
sequence is 2 23.
3. As the sequence of random numbers is fixed and the starting
point in the sequence is reset to the same point each time a
NEW or RUN command (see Ch. 9) is given, the sequence of
numbers generated by the RND(X) function is reproducible.
4. The RANDOMIZE statement (see Ch. 3) causes the random number
generator to start at a different point in the sequence of
random numbers generated by the RND(X) function.
5. Each occurrence of the RND(X) function yields the value of
the next random number in the list.\f
T_ E_x_a_m_p_l_e_ _1_
* LIST
0010 LET I=0
0020 REPEAT
0030 PRINT RND(I);
0040 LET I=I+1
0050 UNTIL I=4
0060 STOP
0070 GOTO 0010
* RUN C_o_m_m_e_n_t_ _(_1_)_
.834444 .360030 .652654 9.23512E02
STOP The RUN command resets the
AT 0060 sequence of random numbers;
* RUN the CON command does not.
.834444 .360030 .652654 9.23512E02
STOP
AT 0060
* CON
.939753 .442918 .157011 .913537
STOP
AT 0060
*
&_
T_E_x_a_m_p_l_e_ _2_
* LIST
0010 LET I=0
0020 WHILE I4 DO
0030 PRINT INT(25*RND(I));
0040 LET I=I+1
0050 ENDWHILE
* RUN C_o_m_m_e_n_t_ _(_2_)_
21 3 17 12
END The program produces random
AT 0050 integers in the range 0 to
&_*24.\f
T_ 4.10S_G_N_(_X_)_
F_o_r_m_a_t_
SGN(expr')
expr': a numeric expression.
&_
U_s_e_
As a function to return a +1 if expr' is greater than 0, a 0 if
expr' equals 0, and a -1 if expr' is less than 0.
T_E_x_a_m_p_l_e_ C_o_m_m_e_n_t_
* LIST Note that SGN(0) = 0.
0010 PRINT SGN(-5);SGN(0);SGN(5)
* RUN
-1 0 1
END
AT 0010
*
&_
T_ 4.11S_I_N_(_X_)_
F_o_r_m_a_t_
SIN(expr')
expr': a numeric expression specified in radians.
&_
U_s_e_
As a function to calculate the sine of an angle which is
expressed in radians.
\f
T_E_x_a_m_p_l_e_
* LIST
0010 PRINT SIN(0);SIN(45*SYS(14)/180)
* RUN
0 .707107
END
AT 0010
*
&_
T_ 4.12S_Q_R_(_X_)_
F_o_r_m_a_t_
SQR(expr')
expr': a positive numeric expression.
&_
U_s_e_
As a function to compute the square root of expr'.
T_ E_x_a_m_p_l_e_
* LIST
0010 PRINT SQR(25);SQR(25.734)
* RUN
5 5.07287
END
AT 0010
&_*
T_ 4.13S_Y_S_(_X_)_
F_o_r_m_a_t_
SYS(expr')
expr': a numeric expression.
&_ \f
U_s_e_
As a function to return system information based on the value of
expr', which is evaluated to an integer (0 to 15), as follows:
T_ F_u_n_c_t_i_o_n_ I_n_f_o_r_m_a_t_i_o_n_
SYS(0) Time of day (seconds past midnight).
SYS(1) Day of the month (1 to 31).
SYS(2) Month of the year (1 to 12). Current date.
SYS(3) Year as two digits (e.g. 77).
SYS(4)
SYS(5) Time used in seconds since the terminal was
logged on.
SYS(6) Number of file I/O statements executed (i.e.
every statement or command referring to a file,
e.g. PRINT FILE, LIST "<LPT").
SYS(7) Error code of the last run-time error.
SYS(8) File number of the file most recently
referenced in a file I/O statement.
SYS(9) Page size of current output
(length of the print line).
SYS(9,fileno) Page size of file.
SYS(10) Tab size of current output
(width of the print zone).
SYS(10,fileno)Tab size of file.
SYS(11) Hour of the day.
SYS(12) Minutes past the last hour. Current time
of day.
&_ SYS(13) Seconds past the last minute.
SYS(14) Constant (3.14159).
SYS(15) Constant e (2.71828).
SYS(16) Line number of last run time error \f
SYS(17) Current date as yymmdd.
SYS(18) Current time as hhmmss.
SYS(19) Current weekday (1=Monday).
SYS(19,yymmdd)Weekday corresponding to date
(illegal date=8)
SYS(20) Current weeknumber. Weeknumber 1 is first
week with a Thursday.
SYS(20,yymmdd)Weeknumber corresponding to date
(illegal date=1)
SYS(21) Digits on current output
T_ 4.14 SYS(21,fileno)Digits on file.
T_A_N_(_X_)_
F_o_r_m_a_t_
&_TAN(expr')
expr': a numeric expression specified in radians.
U_s_e_
T_As a function to calculate the tangent of an angle which is
expressed in radians.
E_x_a_m_p_l_e_
* LIST
0010 PRINT TAN(0);TAN(45*SYS(14)/180)
* RUN
0 .999999
&_
END
AT 0010
*\f
T_ 5S_T_R_I_N_G_ _I_N_F_O_R_M_A_T_I_O_N_
5.1S_t_r_i_n_g_ _c_o_n_c_e_p_t_
This chapter explains how strings are used in RC BASIC. The
&_string concept is described in the present section, while three
useful string functions, viz. CHR(X), LEN(X<), and ORD(X<) are
described in the remaining sections.
b_5.1.1 S_t_r_i_n_g_ _l_i_t_e_r_a_l_s_ e
A string is a sequence of characters, which may include letters,
digits, spaces, and special characters. A string literal (string
constant) is a string enclosed within quotation marks. String
literals are often used in PRINT and INPUT statements (see Ch.
3), for example:
100 PRINT "THIS IS A STRING LITERAL"
200 INPUT "X=",X
The enclosing quotation marks are not printed when the string
is output. N_o_n_-_p_r_i_n_t_i_n_g_ _a_n_d_ _s_p_e_c_i_a_l_ _c_h_a_r_a_c_t_e_r_s_ _m_a_y_ _b_e_ _i_n_c_l_u_d_e_d_
i_n_ _s_t_r_i_n_g_ _l_i_t_e_r_a_l_s_ _b_y_ _e_n_c_l_o_s_i_n_g_ _t_h_e_ _d_e_c_i_m_a_l_ _v_a_l_u_e_ _o_f_ _t_h_e_
c_h_a_r_a_c_t_e_r_ _w_i_t_h_i_n_ _a_n_g_l_e_ _b_r_a_c_k_e_t_s_ _(__'_)_, for example:
10 PRINT "USE DECIMAL 60 TO PRINT 60' IN STRINGS"
* RUN
USE DECIMAL 60 TO PRINT IN STRINGS
The decimal values of all ASCII characters are given in
Appendix D.
b_ 5.1.2S_t_r_i_n_g_ _v_a_r_i_a_b_l_e_s_ e
RC BASIC permits the use of string variables as well as string
literals. A string variable name consists of a letter, followed
by from 0 to 7 letters or digits, f_o_l_l_o_w_e_d_ _b_y_ _a_ _d_o_l_l_a_r_ _s_i_g_n_ _(_<_)_,
for example:
ANSWER<, TEXT<
String values are assigned to string variables, as described
below, by means of LET, READ, and INPUT statements, for example:
INPUT ANSWER<
LET TEXT<="THIS IS A TEXT"\f
b_5.1.3 D_i_m_e_n_s_i_o_n_i_n_g_ _s_t_r_i_n_g_ _v_a_r_i_a_b_l_e_s_e
All string variables m_u_s_t_ be dimensioned before they are used.
By dimensioning the variable, the user sets an upper bound for
the number of characters that can be stored in it. Dimensioning
T_ is accomplished by means of the DIM statement (see Ch. 3), for
example:
DIM ANSWER<(20)
DIM TEXT<(15),STRING<(5)
&_
If the user attempts to assign a string literal that is too long
T_ to a string variable, the string literal will be truncated, for
example:
10 DIM TEXT<(6)
20 LET TEXT<="LONG STRING"
30 PRINT TEXT<
* RUN
LONG S
&_
A string may be of any length, the sole limitation being
available memory.
b_5.1.4 S_u_b_s_t_r_i_n_g_s_e
One can also reference a portion of a string variable. The
T_ general form of such substrings is the following:
i'
svar'( j,k' )
svar': a string variable name.
&_
i': a numeric expression indicating
that the ith character in svar'
is to be referenced.
j,k': numeric expressions indicating
that the jth through the kth
characters in svar' are to be
referenced.
Example 1 shows how substrings can be referenced.\f
T_ E_x_a_m_p_l_e_ _1_
0010 DIM TEXT<(20)
0020 LET TEXT<="AAAAAAAAAAAAAAAAAAAA"
0030 PRINT TEXT<
0040 LET TEXT<(5)="B"
0050 PRINT TEXT<
0060 LET TEXT<(10,13)="BCDE"
0070 PRINT TEXT<
0080 LET TEXT<(15,17)="BCDEFG"
0090 PRINT TEXT<
0100 PRINT TEXT<(1),TEXT<(8,13),TEXT<(20)
AAAAAAAAAAAAAAAAAAAA
AAAABAAAAAAAAAAAAAAA
AAAABAAAABCDEAAAAAAA
AAAABAAAABCDEABCDAAA
A AABCDE A
&_
N_o_t_e_: When a value is to be assigned to a substring (i,j), a
value must first be assigned to the substring (l,i-l). This can
be done by initializing the entire string with blanks.
b_ 5.1.5 A_s_s_i_g_n_i_n_g_ _v_a_l_u_e_s_ _t_o_ _s_t_r_i_n_g_ _v_a_r_i_a_b_l_e_s_e
Values can be assigned to string variables by means of LET,
READ and DATA, and INPUT statements (see Ch. 3) and READ FILE
and INPUT FILE statements (see Ch. 8). Example 2 shows various
uses of LET, READ and DATA, and INPUT.
T_b_5.1.6 C_o_n_c_a_t_e_n_a_t_i_o_n_ _o_f_ _s_t_r_i_n_g_s_e
Any number of strings (variables or literals) can be concate-
nated by means of a LET statement having the following syntax:
svar' svar'
LET svar' = slit' , slit' ...
svar': a string variable.
slit': a string literal.
&_ See Example 2, lines 50, 80, and 90.
\f
T_ E_x_a_m_p_l_e_ _2_C_o_m_m_e_n_t_ _(_2_)_T_
* LIST
0010 DATA "THIS"," A"
0020 DIM TEXT<(23),TEMP<(5)
0040 READ TEXT<(1,4)
0050 LET TEXT<=TEXT<," IS"
0060 READ TEXT<(LEN(TEXT<)+1,20) For LEN(X<), see
0070 INPUT TEMP< Sect. 5.3.
0080 LET TEXT<=TEXT<," ",TEMP<
0090 LET TEXT<=TEXT<," TEXT"
0100 PRINT TEXT<
* RUN
? S_H_O_R_T_ _ _ The underlined
THIS IS A SHORT TEXT texts are those
entered by the user.
END
AT 0100
* RUN
? L_O_N_G___
THIS IS A LONG TEXT
END
AT 0100
&_ *
N_o_t_e_: When a value is assigned to a substring, the number of
characters in the source string must not be less than the number
of characters in the substring referenced; otherwise, the rest
of the characters in the substring and any remaining characters
in the string will be truncated. Example 3 provides an
illustration of this.
\f
T_ E_x_a_m_p_l_e_ _3_C_o_m_m_e_n_t_ _(_3_)_
* LIST
0010DIM TEXT<(10)
0020 LET TEXT<="AAAAAAAAAA" The underlined
0030 PRINT TEXT< texts are those
0040 INPUT TEXT<(3,7) entered by the user.
0050 PRINT TEXT<
* RUN
AAAAAAAAAA
? 1_2_3___ Source string.
AA123TEXT<(6,10) has
been truncated.
* LIST
0010 DIM TEXT<(10),TEMP<(10) The desired result
0020 LET TEXT<="AAAAAAAAAA"can be achieved in
0030 PRINT TEXT<this way.
0040 INPUT TEMP<
0050 LET TEMP<=TEMP<," "
0060 LET TEXT<(3,7)=TEMP<
0070 PRINT TEXT<
* RUN
AAAAAAAAAA
? 1_2_3___
&_ AA123 AAA
b_ 5.1.7 R_e_l_a_t_i_o_n_a_l_ _s_t_r_i_n_g_ _e_x_p_r_e_s_s_i_o_n_s_e
Strings (literals and variables) may be compared. The result of
a comparison is either true or false. The strings are compared
character by character, on the basis of their decimal values
(see App. D), until a difference is found or the end of one or
both strings is met.
If a character in a given position in one string has a higher
decimal value than the character in the corresponding position
in the other string, the first string is the greater of the two.
If the characters in corresponding positions are identical, but
one string contains more characters than the other, the shorter
string is the lesser of the two. Thus, for example, the
expression "ABC" "ABCD" is true.\f
T_ E_x_a_m_p_l_e_ _1_
IF NAME<(1)="J" THEN
.
.
.
&_
T_ E_x_a_m_p_l_e_ _2_ C_o_m_m_e_n_t_ _(_2_)_
CASE ANSWER<="YES" OF
.
.
.
WHEN 1 1 corresponds to true.
.
.
.
WHEN 0 0 corresponds to false.
.
.
.
&_ ENDCASE
5.1.8 S_t_r_i_n_g_ _a_r_r_a_y_s_
The array-concept can be used in connection with strings.
Dimensioning of a string array is accomplished by means of the
DIM statement, (see Chapter 3), for example:
DIM TEXT<(20,40)
The string array TEXT< consists of 20 string-elements each 40
characters long. The i>th element can be referenced as TEXT<(i).
TEXT<(i,j) is a reference to the j>th character in the i>th
element, and TEXT(i,j,k) points out character number j through k
in the i>th element of the string array.
The lower bound of a string array (i.e. the number of the first
element) is usually 1. By means of the LOWBOUND-statement (see
Chapter 3.20) the lower bound may however be changed. The first
character in a string element will always be number 1.
\f
T_ E_x_a_m_p_l_e_C_o_m_m_e_n_t_
0010 TAB=4
0020 DIM NAME<(5,8)
0030 LET I=1 The 5 names are stored
0040 REPEAT in the string array
0050 READ NAME<(I) NAME<
0060 LET I=I+1
0070 UNTIL I'5
0080 FOR I=1 TO 5
0090 PRINT NAME<(I),
0100 NEXT I
0110 DATA "PETER","JOHN","ROBERT","ROBERTA","DIANA"
PETER JOHN ROBERT ROBERTA DIANA
&_
E_x_a_m_p_l_e_C_o_m_m_e_n_t_
0010 DIM TEXT<(6,5)
0020 FOR I=1 TO 6
0030 LET TEXT(I)="TEXT",CHR(48+I)
0040 NEXT I
0050 FOR I=6 TO 2 STEP -1
0060 PRINT TEXT<(I) print string element 6 to 2
0070 NEXT I
0080 FOR I=1 TO 5
0090 PRINT TEXT<(1,I); print string element 1, character
0100 NEXT 1 by character
0110 PRINT
0120 PRINT TEXT<(2,3,LEN(TEXT<(2))) print string ele-
ment 2, from character no. 3.
TEXT6
TEXT5
TEXT4
TEXT3
TEXT2
TEXT1
XT2
T_ 5.2C_H_R_(_X_)_ _f_u_n_c_t_i_o_n_
F_o_r_m_a_t_
CHR(expr')
expr': a numeric expression.
&_ \f
U_s_e_
As a function to return the character corresponding to the
number specified in the argument.
R_e_m_a_r_k_s_
1. The correspondence between numbers (decimal values) and
characters is shown in Appendix D.
2. The number is found as expr' modulo 128.
3. The CHR(X) function may be used in any string expression.
T_ E_x_a_m_p_l_e_ C_o_m_m_e_n_t_
0010 TAB=4
0020 PAGE=32
0030 FOR I=65 TO 74
0040 PRINT I,CHR(I),
0050 NEXT I
65 A 66 B 67 C 68 D The characters corresponding
69 E 70 F 71 G 72 H to the numbers 65-74 are A-J.
&_ 73 I 74 J
T_ 5.3L_E_N_(_X_<_)_ _f_u_n_c_t_i_o_n_
F_o_r_m_a_t_
svar'
LEN( slit' )
svar': a string variable.
slit': a string literal.
&_
U_s_e_
As a function to return the current length (number of
characters) of the string specified in the argument.
R_e_m_a_r_k_s_
1. The LEN(X<) function may be used in any numeric expression.
2. If the string argument is empty, the value returned is 0.
\f
T_E_x_a_m_p_l_e_ C_o_m_m_e_n_t_
0010 DIM TEXT<(10)
0020 TAB=12
0030 PRINT TEXT<,LEN(TEXT<)
0040 FOR I=1 TO 10
0050 LET TEXT<=TEXT<,CHR(I+64) For CHR(X), see Sect. 5.2.
0060 PRINT TEXT<,LEN(TEXT<)
0070 NEXT I
&_
T_ 0
A 1
AB 2
ABC 3
ABCD 4
ABCDE 5
ABCDEF 6
ABCDEFG 7
ABCDEFGH 8
ABCDEFGHI 9
&_ABCDEFGHIJ 10
T_ 5.4O_R_D_(_X_<_)_ _f_u_n_c_t_i_o_n_
F_o_r_m_a_t_
svar'
ORD( slit' )
svar': a string variable.
slit': a string literal.
&_
U_s_e_
As a function to return the number of the first character of the
string specified in the argument.
R_e_m_a_r_k_s_
1. The number returned is the character>s decimal value, which
is equivalent to its internal representation. (This number is
also the ordinal number of the character; thus the character
A, for example, which has the decimal value 65, is the 65th
character in the ASCII character set). The correspondence
between numbers and characters is shown in Appendix D. \f
2. The ORD(X<) function may be used in any numeric expression.
T_ E_x_a_m_p_l_e_ C_o_m_m_e_n_t_
0010 TAB=4
0020 PAGE=32
0030 DIM A<(10)
0040 LET A<="0123456789"
0050 FOR I=1 TO 10
0060 PRINT ORD(A<(I));A<(I),
0070 NEXT I
48 0 49 1 50 2 51 3 The c_h_a_r_a_c_t_e_r_s_ 0-9 have the
52 4 53 5 54 6 55 7internal decimal values
&_56 8 57 948-57.\f
6M_A_T_R_I_X_ _M_A_N_I_P_U_L_A_T_I_O_N_
6.1M_a_t_r_i_x_ _o_p_e_r_a_t_i_o_n_s_
RC BASIC includes a special set of statements which allows the
user to manipulate two-dimensional arrays (see Ch. 2) as
matrices. Among the available matrix operations are the
following:
Addition, subtraction, and multiplication.
Scalar multiplication.
Formation of a zero matrix (all elements set to 0).
Formation of a constant matrix (all elements set to 1).
Formation of an identity matrix (major diagonal elements set
to 1, remaining elements set to 0).
Calculation of the inverse of a matrix.
Calculation of the determinant of a matrix.
Transposition of a matrix.
Input/output of a matrix via the user>s terminal.
All of the above operations are described in the present
chapter, while matrix file input/output statements are described
in Chapter 8.
A_l_l_ _s_t_a_t_e_m_e_n_t_s_ _i_n_v_o_l_v_i_n_g_ _m_a_t_r_i_x_ _o_p_e_r_a_t_i_o_n_s_ _a_r_e_ _i_n_t_r_o_d_u_c_e_d_ _b_y_ _t_h_e_
r_e_s_e_r_v_e_d_ _w_o_r_d_ _M_A_T_._
6.2D_i_m_e_n_s_i_o_n_i_n_g_ _m_a_t_r_i_c_e_s_
A matrix is dimensioned as a two-dimensional array by means of
the DIM statement (see Ch. 3). Thus the statement
10 DIM MATRIXA(10,20)
defines a matrix variable named MATRIXA, which has 10 rows and
20 columns (or a total of 10 x 20 = 200 elements).\f
F_ If the lower bound of arrays has been set to zero (by means of
the LOWBOUND-statement, see Chapter 3), then MATRIXA will have
11 rows (no. 0 through 10) and 21 columns (0 through 20).
A previously dimensioned matrix may be redimensioned by means of
new DIM statement, provided that the total number of elements
does not exceed e previously declared total number of elements.
Matrix elements are stored by rows in ascending memory
locations.
As a one-dimensional array containing i elements is considered
a 1 x i matrix, t_h_e_ _m_a_t_r_i_x_ _o_p_e_r_a_t_i_o_n_s_ _d_e_s_c_r_i_b_e_d_ _i_n_ _t_h_e_ _f_o_l_l_o_w_i_n_g_
s_e_c_t_i_o_n_s_ _a_l_s_o_ _a_p_p_l_y_ _t_o_ _o_n_e_-_d_i_m_e_n_s_i_o_n_a_l_ _a_r_r_a_y_s_._
6.3M_a_t_r_i_x_ _a_s_s_i_g_n_m_e_n_t_ _s_t_a_t_e_m_e_n_t_
F_o_r_m_a_t_
MAT mvar1' = mvar2'
mvar1, mvar2': matrix variables.
U_s_e_
As a statement or command to copy the elements of one matrix to
another matrix.
R_e_m_a_r_k_s_
1. The matrices must have been dimensioned before the statement
is executed.
2. The number of elements in mvar2' must not exceed the number
of elements in mvar1'.
3. After the assignment, mvar1' will have the same dimensions
and values as mvar2'.
\f
F_ E_x_a_m_p_l_e_ C_o_m_m_e_n_t_
0010 DIM MATA(3,2),MATB(2,3)
0020 FOR I=1 TO 3
0030 FOR J=1 TO 2
0040 LET MATA(I,J)=I*10+J
0050 NEXT J
0060 NEXT I
0070 PRINT "MATA : "
0080 MAT PRINT MATA
0090 PRINT "13'10'MATB : "
0100 MAT PRINT MATB
0110 MAT MATB=MATA
0120 PRINT "13'10'NEW MATB : "
0130 MAT PRINT MATB
MATA :
11 12
21 22
31 32
MATB :
0 0 0
0 0 0
T_NEW MATB : Note that the dimensions of
11 12 MATB have been changed.
21 22
31 32
&_
T_ 6.4M_a_t_r_i_x_ _a_d_d_i_t_i_o_n_/_s_u_b_t_r_a_c_t_i_o_n_ _s_t_a_t_e_m_e_n_t_
F_o_r_m_a_t_
+
MAT mvar1' = mvar2' - mvar3'
mvar1, mvar2, mvar3' : matrix variables.
&_
T_U_s_e_
As a statement or command to perform the scalar addition or
subtraction of two matrices.
&_ \f
R_e_m_a_r_k_s_
1. The matrices must have been dimensioned before the statement
is executed.
2. mvar2' and mvar3' must have the same dimensions.
3. The number of elements in mvar2' (and mvar3') must not
exceed the number of elements in mvar1'.
4. The arithmetic is performed element by element with the
resultant value assigned to the element in mvar1'.
5. mvar1' may appear on both sides of the equal sign.
6. After the addition or subtraction, mvar1' will have the same
dimensions as mvar2' (and mvar3').
T_E_x_a_m_p_l_e_ C_o_m_m_e_n_t_
0010 DIM MATA(3,2),MATB(3,2)
0020 FOR I=1 TO 3
0030 FOR J=1 TO 2
0040 LET MATA(I,J)=I*10+J
0050 LET MATB(I,J)=2*(I*10+J)
0060 NEXT J
0070 NEXT I
0080 PRINT "MATA : "
0090 MAT PRINT MATA
0100 PRINT "13'10'MATB : "
0110 MAT PRINT MATB
0120 MAT MATB=MATA+MATB MATB appears on both sides
0130 PRINT "13'10'MATA + MATB :" of the equal sign.
0140 MAT PRINT MATB
&_ \f
T_MATA :
11 12
21 22
31 32
MATB :
22 24
42 44
62 64
MATA + MATB :
33 36 The addition of MATA and
63 66 MATB is performed element
93 96 by element.
&_
T_ 6.5M_a_t_r_i_x_ _m_u_l_t_i_p_l_i_c_a_t_i_o_n_ _s_t_a_t_e_m_e_n_t_
F_o_r_m_a_t_
mvar2'
MAT mvar1' = (expr') * mvar3'
mvar1, mvar2, mvar3': matrix variables.
expr': a numeric expression
(parenthesized).
&_
T_U_s_e_
As a statement or command to perform the multiplication of one
matrix either by another matrix or by a scalar (the value of a
numeric expression).
&_
R_e_m_a_r_k_s_
1. The matrices must have been dimensioned before the statement
is executed.
2. The number of columns in mvar2' must match the number of
rows in mvar3'.
3. If mvar2' is an n x p matrix (i.e. with n rows and p
columns) and mvar3' is a p x m matrix, then mvar1' will be
an n x m matrix.
\f
4. mvar1' may not appear on the right-hand side of the equal
sign, unless it is a scalar multiplication.
5. mvar2' and mvar3' may represent the same matrix (i.e. a
square matrix, in which the number of rows matches the
number of columns).
6. The product of mvar2' and mvar3' is calculated as follows:
Each row of mvar2' is multiplied by each column of mvar3'
such that the corresponding elements are multiplied and their
products added together to provide the resultant value
assigned to the element in mvar1' (see Example).
Row number i of mvar2' * column number j of mvar3' will,
accordingly, result in element number (i,j) of mvar1'.
7. If a matrix is multiplied by a scalar, each element in mvar3'
is multiplied by expr' to give the corresponding element
value in mvar1'. In this case, the number of elements in
mvar3' must not exceed the number of elements in mvar1'.
After the multiplication, mvar1' will have the same dimen-
sions as mvar3'.
T_E_x_a_m_p_l_e_
0010 DIM MATA(3,2),MATB(2,3),MATC(3,3)
0020 FOR I=1 TO 3
0030 FOR J=1 TO 2
0040 LET MATA(I,J)=I*10+J
0050 LET MATB(J,I)=I*20+J
0060 NEXT J
0070 NEXT I
0080 PRINT "MATA : "
0090 MAT PRINT MATA
0100 PRINT "13'10'MATB : "
0110 MAT PRINT MATB
0120 MAT MATC=MATA*MATB
0130 PRINT "13'10'MATA * MATB :"
0140 MAT PRINT MATC
&_ \f
T_MATA :C_o_m_m_e_n_t_
11 12
21 22
31 32
MATB :
21 41 61
22 42 62
MATA * MATB : DDD21UUU
495 955 1415 495 = (11 12) x DDD22UUU
925 1785 2645
1355 2615 3875 = (11 x 21) + (12 x 22)
&_
T_6.6D_E_T_(_X_)_ _f_u_n_c_t_i_o_n_
F_o_r_m_a_t_
var' = DET(expr')
var': a numeric variable.
expr': a numeric expression (required, but not used).
&_
U_s_e_
As a function to return the determinant of the last matrix
inverted by a MAT INV statement (see Sect. 6.10) or the last
matrix decomposed by a MAT SOLVE statement (see sect. 6.13).
R_e_m_a_r_k_s_
1. The DET(X) function requires an argument, although the
argument does not affect the resulting determinant and the
function does not affect the argument.
2. For calculation of the determinant of a matrix, see Section
6.10.
T_E_x_a_m_p_l_e_
See the MAT INV statement (Sect. 6.10).
&_ \f
T_6.7M_A_T_ _C_O_N_ _s_t_a_t_e_m_e_n_t_
F_o_r_m_a_t_
MAT mvar' = CON
mvar': a matrix variable.
&_
U_s_e_
As a statement or command to initialize a matrix such that all
elements are set to one.
R_e_m_a_r_k_s_
1. The matrix must have been dimensioned before the statement is
executed.
2. All elements of mvar' are set to one regardless of any
previously assigned values.
3. The resulting matrix is often called a constant matrix.
\f
T_E_x_a_m_p_l_e_
0010 DIM MATA(3,2)
0020 FOR I=1 TO 3
0030 FOR J=1 TO 2
0040 LET MATA(I,J)=I*10+J
0050 NEXT J
0060 NEXT I
0070 PRINT "MATA : "
0080 MAT PRINT MATA
0090 MAT MATA=CON
0100 PRINT "13'10'NEW MATA :"
0110 MAT PRINT MATA
MATA :
11 12
21 22
31 32
NEW MATA :
1 1
1 1
1 1
&_
T_6.8M_A_T_ _I_D_N_ _s_t_a_t_e_m_e_n_t_
F_o_r_m_a_t_
MAT mvar' = IDN
mvar': a matrix variable.
&_
U_s_e_
As a statement or command to initialize a matrix such that all
elements (i,i) are set to one and the remaining elements are set
to zero.
R_e_m_a_r_k_s_
1. The matrix must have been dimensioned before the statement
is executed.
2. If mvar' is an n x p matrix (i.e. with n rows and p\f
columns), then all elements (i,i), 1 = i = minimum (n,p),
are set to one and the remaining elements are set to zero
(see Example).
3. If mvar' is a square matrix (i.e. where n = p), then the
resulting matrix will be the identity matrix, in which all
elements of the major diagonal are set to one and the
remaining elements are set to zero (see Example).
T_E_x_a_m_p_l_e_
0010 DIM MATA(3,2),MATB(6,6)
0020 FOR I=1 TO 3
0030 FOR J=1 TO 2
0040 LET MATA(I,J)=I*10+J
0050 NEXT J
0060 NEXT I
0070 PRINT "MATA : "
0080 MAT PRINT MATA
0090 MAT MATA=IDN
0100 PRINT "13'10'NEW MATA :"
0110 MAT PRINT MATA
0120 MAT MATB=IDN
0130 PRINT "13'10'MATB :"
0140 MAT PRINT MATB;
&_
T_MATA :
11 12
21 22
31 32
NEW MATA :
1 0
0 1
0 0
MATB :
1 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0
0 0 0 1 0 0
0 0 0 0 1 0
0 0 0 0 0 1
&_ \f
T_ 6.9M_A_T_ _I_N_P_U_T_ _s_t_a_t_e_m_e_n_t_
F_o_r_m_a_t_
MAT INPUT mvar1' ,mvar2', ... ,mvar-n'
mvar1, mvar2, mvar-n': matrix variables.
&_
U_s_e_
As a statement or command to assign numeric values entered from
the user>s terminal during program execution to the elements of
one or more matrices.
R_e_m_a_r_k_s_
1. The matrices must have been dimensioned before the statement
is executed.
2. When a MAT INPUT statement is executed, the system outputs a
question mark (?) as an initial prompt.
3. The user responds by typing a list of numeric data items,
each of which is separated from the next by a comma. The last
item is followed by a carriage return.
4. If the data list is terminated (by pressing the RETURN key)
before values have been assigned to all of the matrix
elements, the system will output / ? as a prompt, indicating
that further items are expected.
T_6.10M_A_T_ _I_N_V_ _s_t_a_t_e_m_e_n_t_
F_o_r_m_a_t_
MAT mvar1' = INV(mvar2')
mvar1, mvar2': matrix variables.
&_
U_s_e_
As a statement or command to invert a matrix and assign the
resultant element values to another matrix.
\f
R_e_m_a_r_k_s_
1. The matrices must have been dimensioned before the statement
is executed.
2. The inverse, B, of a matrix, A, is defined such that the
products of A x B and B x A are both equal to the identity
matrix.
3. mvar2' must be a square matrix.
4. The determinant (see Remark 6) of mvar2' must not equal
zero.
5. After the inversion of a matrix, the determinant of that
matrix can be obtained by means of the DET(X) function (see
Sect. 6.6).
6. M_a_t_r_i_x_ _d_e_t_e_r_m_i_n_a_n_t_s_
In order to calculate the inverse of a matrix, one must first
calculate the determinant of that matrix.
The calculation of the determinant of a 2 x 2 matrix is
described in the following. For larger matrices, consult a
mathematics text.
The determinant of a 2 x 2 matrix
a b a b
c d is written as c d .
The determinant is the scalar
(a x d) - (b x c)
i.e. multiplication along the diagonals and subtraction of
the product of the second diagonal from the product of the
major diagonal.
7. The execution time will be reduced, if mvar1'=mvar2'.\f
T_ 6.11M_A_T_ _P_R_I_N_T_ _s_t_a_t_e_m_e_n_t_
F_o_r_m_a_t_
;
MAT PRINT mvar' , mvar' ... ;
mvar': a matrix variable.
&_
U_s_e_
As a statement or command to output the values of the elements
of one or more matrices on the user>s terminal.
R_e_m_a_r_k_s_
1. The matrices must have been dimensioned before the statement
is executed.
2. If a semicolon is used after a matrix variable in the
argument list, the elements of that matrix will be output
with c_o_m_p_a_c_t_ _s_p_a_c_i_n_g_, i.e. each element will be output
starting from the next character position. (N_o_t_e_: A blank
space is always printed after an element and a blank space is
reserved for the plus sign, even though this sign is not
printed).
3. If a comma or carriage return is used after a matrix variable
in the argument list, the elements of that matrix will be
output with z_o_n_e_ _s_p_a_c_i_n_g_, i.e. each element will be output
starting from the leftmost position of a print zone. The
width of the print zones can be set by means of the TAB
command (see Ch. 3).
4. The values of the elements are output by rows in ascending
order. If a row cannot be contained on a single print line, a
carriage return and line feed are output and the row is
continued on the next print line.
\f
T_E_x_a_m_p_l_e_ C_o_m_m_e_n_t_s_
0010 TAB=10
0020 PAGE=72
0030 DIM MATA(3,2),MATB(2,3),ARRAY(10)
0040 FOR I=1 TO 3
0050 FOR J=1 TO 2
0060 LET MATA(I,J)=I*10+J
0070 LET MATB(J,I)=J*10+I
0080 NEXT J
0090 NEXT I
0100 PRINT "13'10'"
0110 MAT PRINT MATA,MATB
0120 PRINT "13'10'"
0130 MAT PRINT MATA;MATB;
0140 PRINT "13'10'"
0150 MAT PRINT MATA,MATB;
0155 TAB=5
0160 PRINT "13'10'"
0170 MAT PRINT ARRAY
0180 MAT ARRAY=CON
0190 PRINT "13'10'"
0200 MAT PRINT ARRAY;
&_
T_ 11 12 Statement 110.
21 22 Zone spacing
31 32 is used (comma
or carriage
11 12 13return as sepa-
21 22 23rator).
11 12 Statement 130.
21 22 Compact spacing
31 32 is used (semi-
colon as sepa-
11 12 13rator).
21 22 23
&_
T_ 11 12 Statement 150.
21 22
31 32
11 12 13
21 22 23
&_
0 0 0 0 0 0 0 0 0 0 Statement 170.
1 1 1 1 1 1 1 1 1 1 Statement 200.\f
T_ 6.12M_A_T_ _R_E_A_D_ _s_t_a_t_e_m_e_n_t_
F_o_r_m_a_t_
MAT READ mvar' ,mvar' ...
mvar': a matrix variable.
&_
U_s_e_
As a statement or command to read in numeric values from the
list defined by one or more DATA statements (see Ch. 3) and to
assign the values to the elements of one or more matrices.
R_e_m_a_r_k_s_
1. The matrices must have been dimensioned before the statement
is executed.
2. Values are assigned to matrix elements by rows in ascending
order.
T_E_x_a_m_p_l_e_
0010 DIM MATA(3,2),MATB(2,3)
0020 DATA 1,2,3,4,5,6,7,8,9
0030 MAT READ MATA
0040 PRINT "MATA :"
0050 MAT PRINT MATA
0060 RESTORE
0070 MAT READ MATB
0080 PRINT "13'10'MATB :"
0090 MAT PRINT MATB
&_
T_MATA :
1 2
3 4
5 6
MATB :
1 2 3
&_ 4 5 6
\f
T_6.13 MAT SOLVE statement
F_o_r_m_a_t_
&_ MAT SOLVE mvar1' * mvar2' = mvar3'
T_ U_S_E_
As a statement or command to decompose the matrix mvar1' and
solve it with the right-hand sides mvar3'. The solutions are
assigned to mvar2'
R_e_m_a_r_k_s_
&_ 1. The matrices mvar1' and mvar3' must have been
dimensioned before the statement is executed.
2. The matrix mvar1' is decomposed and the solution(s)
are assigned to mvar2'
3. After the execution mvar2' will have the same
dimension as mvar3'
4. mvar2' and mvar3' may be the same matrix.
5. The determinant of mvar1' (see INV) must not be
equal to zero.
6. After the execution, the determinant of the matrix
can be obtained by means of the DET function.
T_ E_x_a_m_p_l_e_
0010 DIM A(4,4),X(4),B(4),MATA(5,5)MATB(2,5)
0020 MAT READ A,B
0030 MAT SOLVE A*X=B
0040 MAT PRINT X
0050 MAT SOLVE MATA*MATB=MATB
0060 MAT PRINT MATB
&_
T_6.14M_A_T_ _T_R_N_ _s_t_a_t_e_m_e_n_t_
F_o_r_m_a_t_
MAT mvar1' = TRN(mvar2')
mvar1, mvar2': matrix variables.
&_
U_s_e_
As a statement or command to transpose a matrix and assign the
resultant element values to another matrix.
\f
R_e_m_a_r_k_s_
1. The matrices must have been dimensioned before the statement
is executed.
2. A matrix is transposed by reversing the row and column
assignments of the matrix elements, i.e. row number 1 in
mvar2' becomes column number 1 in mvar1' and column number
1 in mvar2' becomes row number 1 in mvar1'.
3. If mvar2' is an n x m matrix, mvar1' will be an m x n
matrix.
4. mvar1' and mvar2' must be two distinct matrices.
T_6.15M_A_T_ _Z_E_R_ _s_t_a_t_e_m_e_n_t_
F_o_r_m_a_t_
MAT mvar' = ZER
mvar': a matrix variable.
&_
U_s_e_
As a statement or command to initialize a matrix such that all
elements are set to zero.
R_e_m_a_r_k_s_
1. The matrix must have been dimensioned before the statement is
executed.
2. All elements of mvar' are set to zero regardless of any
previously assigned values.
3. The resulting matrix is often called a zero matrix.
\f
T_E_x_a_m_p_l_e_
0010 DIM MATA(3,2)
0020 FOR I=1 TO 3
0030 FOR J=1 TO 2
0040 LET MATA(I,J)=I*10+J
0050 NEXT J
0060 NEXT I
0070 PRINT "MATA : "
0080 MAT PRINT MATA
0090 MAT MATA=ZER
0100 PRINT "13'10'NEW MATA :"
0110 MAT PRINT MATA
&_
T_MATA :
11 12
21 22
31 32
NEW MATA :
0 0
0 0
0 0
&_ \f
F_7FILENAMES, DISC RESOURCES AND RELATED COMMANDS
7.1Introduction
Each filename is described by a catalog entry in the disc
catalog. Each user is allotted an amount of slices and entries.
This is called the user>s claim. The user may have claims on
several disc kits.
A slice is a number of consecutive segments. The slicelength is
defined by the monitor. A slice cannot be divided among two
entries.
Each project contains a user, the MATER, who embraces all other
users. The MATER has a pool of claims and is able to, by means
of procedure NEWCLAIM, to move claims to or from a user. The
MATER is also able to, by means of procedure SCOPE, to move
files to or from a user.
The procedure SCANCLAIM will list the current distribution of
claims
7.2 CLAIM
F_o_r_m_a_t_
CLAIM "LPT"
U_s_e_
As a statement or command to return a listing of used and free
disc resources, similar to the terminating lines in SEARCH.
E_x_a_m_p_l_e_
* CLAIM
USED:
disc 2 slices * 21 = 42 segments 2 entries
FREE:
disc 8 slices * 21 = 168 segments 4 entries\f
T_7.3 LOOKUP
F_o_r_m_a_t_
&_LOOKUP filename'
filename' : the name of a disc expressed as a string
literal or by means of a variable.
U_s_e_
As a command or statement to return a listing (name and
attributes) of the specified disc file.
R_e_m_a_r_k_s_
1) the first column contains the name of the file
2) the second column contains the size in number of segments
3) the third column contains the name of the disc kit
4) the fourth column contains the date of creation or latest
output
5) the fifth column contains the number of the last block
written in the file (sequential access) or the number of
records in the file (random access)
6) the sixth column contains 0
7) the seventh column contains:
T_ 0 empty sequential file
1 ASCII sequential file
2 binary sequential file
3 binary random access file
&_ 4 saved file
8) the eighth column contains:
sequential: last halfword in last T_
block
random: record length in &_
halfwords
9) The columns are listed in the same order as for the command
search, the BOSS command lookup and the utility command lookup
T_E_x_a_m_p_l_e_
*LOOKUP "DATA"
data 13 disc d.781006.1332 13 0 1 20
&_ \f
T_ 7.4 NEWCLAIM
F_o_r_m_a_t_
NEWCLAIM username' ,disc name', slices' ,entries'
username' : name of the user
discname' : name of a disc kit
slices' : a numeric expression
entries' : a numeric expression
&_
U_s_e_
As a statement or command to increase/reduce the claims of a
user.
(The claims of the MATER is reduced/increased by the same slices
and entries).
R_e_m_a_r_k_s_
The statement/command can only be used by the MATER
T_ E_x_a_m_p_l_e_ C_o_m_m_e_n_t_
NEWCLAIM "KNUD", 2,1 Knuds claims on the standard disc kit
are increased by 2 slices and 1 entry.
(And the claim of the MATER is reduced
by 2 slices and 1 entry)
&_
7.5 SCANCLAIM
F_o_r_m_a_t_
SCANCLAIM "LPT"
U_s_e_
As a statement or command to return a listing of the current
claims in the usercat \f
T_ E_x_a_m_p_l_e_
*SCANCLAIM
PROJECT No. 4 1000 1010
BASICMATER 1000 1010
DISC1 40 10 42
KC 1000 1000
DISC1 10 5 42
PSS 1001 1001
DISC1 10 5 42
TA 1002 1002
DISC1 10 5 42
&_
T_ C_o_m_m_e_n_t_
The first three columns contain slices, entries and slicelength.
The two last columns contains the catalog bases.
&_
T_ 7.6 SCOPE
F_o_r_m_a_t_
USER
SCOPE username', filename'
MATER
username': name of the user
filename': name of the file to be scoped
&_
T_ U_s_e_
As a statement or command to move a file to/from a user from/to
the MATER. The required claims must be present. The claims of as
well the user as the MATER will be updated.
&_
T_ R_e_m_a_r_k_s_
The statement/command can only be used by the MATER.
&_
T_ E_x_a_m_p_l_e_ C_o_m_m_e_n_t_
SCOPE USER "TOVE", "TESTS" The file TESTS is moved to
TOVE \f
T_ 7.7 SEARCH
F_o_r_m_a_t_
SEARCH "LPT"
&_
T_ U_s_e_
As a command or statement to return a listing of a user>s files
(names and attributes).
&_
T_ R_e_m_a_r_k_s_
See LOOKUP
&_
T_ E_x_a_m_p_l_e_
* SEARCH
data 12 disc d.781002.1420 12 0 1 100
prog 10 disc d.701005.0931 10 0 1 40
&_
T_
USED
disc 2 slices*21 = 42 segments 2 entries
FREE
disc 8 slices*21 = 168 segments4 entries
&_ \f
8F_I_L_E_S_ _A_N_D_ _R_E_L_A_T_E_D_ _S_T_A_T_E_M_E_N_T_S_
8.1 Introduction
The present section describes the file concept itself, while
statements related to the use of files are described in the
remaining sections of this chapter.
8.1.1 D_i_s_c_ _f_i_l_e_s_ _a_n_d_ _d_e_v_i_c_e_s_
Several of the statements described in the following sections
have filename' as an argument. A filename may be the name of a
disc file or the name of a device. In many respects, a disc file
and a device are one and the same, and most of the explanations
in this chapter apply to both. A device is used either for input
or for output, whereas a disc file can be used for both. When a
device is specified, a work area with the device name is
created, and the filerouter is required to demand input/output.
8.1.2 S_t_a_n_d_a_r_d_ _d_e_v_i_c_e_s_ _a_n_d_ _r_e_s_e_r_v_e_d_ _n_a_m_e_s_
The system devices which can be used in RC BASIC are listed
below. The names in parentheses should be used when the device
is referenced as a file.
Line printer (LPT)
Paper tape punch (PTP)
Paper tape reader (PTR)
Card reader (CDR or MCDR)
Terminal (TERM)
The card reader has two names, as it can be used in two
different ways.
\f
T_ 8.1.3 B_l_o_c_k_ _s_i_z_e_s_e
An RC BASIC disc file comprises a number of blocks. Each disc
file is described separately by an entry in the catalog. One
halfword (12 bits) corresponds to one character, so that a
string containing 10 characters will occupy 10 halfwords,
whereas numeric data will occupy 4 halfwords per item.
b_8.1.4 F_i_l_e_n_a_m_e_s_ _a_n_d_ _f_i_l_e_ _s_i_z_e_s_e
A disc file can be CREATEd with a name and a size. A filename
may contain from 1 to 8 characters. The name consists of a
letter followed by 0 to 7 digits or letter (similar to variable
names). The size of a file is the number of blocks allocated to
the file, expressed as a number greater than or equal to zero.
A disc file can also be DELETEd, RENAMEd or CHANGESIZEd.
b_8.1.5 H_o_w_ _f_i_l_e_s_ _a_r_e_ _u_s_e_d_e
Files can be used for many purposes. The user can SAVE/LOAD/
CHAIN/RUN or LIST/ENTER a program to or from a file (see Chs. 3
and 9).
A file can also be used for data. In order to read data from or
write data to a file, the user must first OPEN the file. The
data can be in binary or ASCII (character) format. When the file
is OPENed, the user must specify one of the following modes:
Mode 0 for binary input from or binary output to a random
access file (READ FILE or WRITE FILE statement).
Mode 1 for binary input from a sequential access file
(READ FILE statement).
Mode 2 for binary output to a sequential access file,
when data is to be appended to previously written
data (WRITE FILE statement).
Mode 3 for binary output to a sequential access file
(WRITE FILE statement).
Mode 4 for binary input (only) from a random access file
(READ FILE statement).
Mode 9 for ASCII input from a sequential access file (INPUT
FILE statement).
\f
Mode 11 for ASCII output to a sequential access file
(PRINT FILE statement).
When the user no longer needs to access a file, he should CLOSE
it.
b_8.1.6 R_a_n_d_o_m_ _a_c_c_e_s_s_ _f_i_l_e_s_e
The data in a random access file is organized in individual
records, which can be accessed directly. If a random access file
is to be used for both reading and writing, it must be OPENed in
mode 0. If a random access file is to be used for reading only,
it can be OPENed in mode 4.
b_8.1.7 S_e_q_u_e_n_t_i_a_l_ _a_c_c_e_s_s_ _f_i_l_e_s_e
The data in a sequential access file can only be accessed in a
sequential manner. When a sequential access file is OPENed, the
system positions to the beginning of the file and the data is
read or written starting from there. If, however, a sequential
access file is OPENed in mode 2, the system will position after
the last item written to the file, so that data can be appended
to previously written data. Sequential access files can be
OPENed in mode 1, 2, 3, 9, or 11.
If a file is OPENed for reading (writing), it must be CLOSEd and
OPENed again before it can be used for writing (reading).
The remaining sections of this chapter contain separate
descriptions of the CREATE, DELETE, and RENAME statements,
statements related to file input/output, and the EOF(X)
function.
For the use of these statements as keyboard commands, see
Appendix C.
8.2 CHANGESIZE
F_o_r_m_a_t_
CHANGESIZE filename',size'
filename': the name (1 to 8 characters) of the disc
file to be changed, expressed as a literal
or by means of a variable.
size' : a numeric expression specifying either the
length of the file in blocks (sequential
access file) or the number of records in
the file (random access file).\f
U_s_e_
As a statement or command to change the size of a file.
R_e_m_a_r_k_s_
1) Typically used to secure claims for output before run.
2) Also used to upspeed the run, as there will be no need for
extension during output.
8.3 C_L_O_S_E_ _F_I_L_E_
F_o_r_m_a_t_
CLOSE FILE(file')
file': a numeric expression which evaluates to a user
file number that was previously associated with a
filename in an OPEN FILE statement (see Sect.
8.11).
&_
U_s_e_
As a statement or command to dissociate a filename and a user
file number so that the file no longer can be referenced.
R_e_m_a_r_k_s_
1. The CLOSE FILE statement may be used to close a file so that
it can be re-opened by an OPEN FILE statement with a new mode
argument.
2. The CLOSE form of the statement closes all open files.
T_3. When an output file is closed, the size is cut to the used
size.
&_
T_ E_x_a_m_p_l_e_s_
100 CLOSE FILE(1)
200 CLOSE FILE(X+3)
300 CLOSE
&_ \f
T_8.4 COPY
&_ F_o_r_m_a_t_
T_
COPY filename1', filename2'
filename1' : the name of the disc file or device
to be copied, expressed as a string literal
or by means of a variable.
filename2' : The name of the disc file or device to which
filename1' is copied, expressed as a string
literal or by means of a variable.
&_
T_ U_s_e_
As a statement or command to copy a file.
&_
R_e_m_a_r_k_s_
If filename2' is not a user file, a file will be created with the
name filename2'
&_
T_ E_x_a_m_p_l_e_
*COPY "NEWDATA", "DATA"
*COPY "PTR", "LPT"
&_
T_8.5 C_R_E_A_T_E_
F_o_r_m_a_t_
&_CREATE filename',discname',size',recl'
filename': the name (1 to 8 characters) of the disc file
to be created, expressed as a string literal
or by means of a variable.
discname': name of disc in case the file is not to be
created on the standard disc.
size': a numeric expression specifying either the
length of the file in blocks (sequential
access file) or the number of records in the
file (random access file).
\f
recl': a numeric expression specifying the record
length in halfwords. recl' should be
specified if, and only if, the file is to be
used as a random access file.
U_s_e_
As a statement or command to create a file.
R_e_m_a_r_k_s_
1. The block size is 512 halfwords.
2. If recl' is specified, the file can (only) be used as a
random access file. (See also the OPEN FILE, READ FILE, and
WRITE FILE statements.) recl' must be positive and less than
or equal to 512.
3. A random access file will be organized such that each
physical block in the device will contain an integral number
of records.
T_E_x_a_m_p_l_e_ _1_ C_o_m_m_e_n_t_ _(_1_)_
120 LET NAME<="PROC1"
130 CREATE NAME<,17
140 CREATE "PROC2", 10 CREATE used as a statement.
&_
T_E_x_a_m_p_l_e_ _2_ C_o_m_m_e_n_t_ _(_2_)_
* CREATE "DATAFILE",15,52 CREATE used as a command.
&_
T_8.6 D_E_L_E_T_E_
F_o_r_m_a_t_
DELETE filename'
filename': the name of the disc file to be deleted,
expressed as a string literal or by means of
a variable.
&_
U_s_e_
As a statement or command to delete a file. \f
8.7 DIGITS FILE
F_o_r_m_a_t_
DIGITS FILE (file')=expr'
file': a numeric expression which evaluates to
the number of a user file.
expr': a numeric expression in the range
1=expr'=11.
U_s_e_
As a command or statement to specify the number of digits output
T_ by a PRINT FILE statement.
R_e_m_a_r_k_s_
The default value is 6.
E_x_a_m_p_l_e_
DIGITS FILE (0)=7
T_8.8 E_O_F_(_X_)_ _f_u_n_c_t_i_o_n_
F_o_r_m_a_t_
EOF(file')
file': a numeric expression which evaluates to the number
of a user file opened for reading (i.e. in mode
1 or 9).
&_
U_s_e_
As a function to detect the end of data when transferring data
from a file.
R_e_m_a_r_k_s_
1. The EOF(X) function returns an integer indicating whether or
not the last READ FILE or INPUT FILE statement included an
end of file delimiter.
2. If an end of file condition was detected, the function
returns a value of +1; otherwise, a value of 0 is returned. \f
E_x_a_m_p_l_e_
See the examples under READ FILE (Sect. 8.19).
T_8.9 I_N_P_U_T_ _F_I_L_E_
F_o_r_m_a_t_
var'var'
INPUT FILE(file') , svar' ,svar' ...
&_
file': a numeric expression which evaluates to the
&_ number of a user file opened in mode 9.
var, svar': a list of one or more numeric or string
variables which are assigned values read from
a sequential access file.
U_s_e_
As a statement or command to read data in ASCII format from a
s_e_q_u_e_n_t_i_a_l_ _a_c_c_e_s_s_ _f_i_l_e_ for the variables in the argument list.
R_e_m_a_r_k_s_
1. Each variable in the argument list must be of the same type
(numeric or string) as the corresponding data item in the
data file.
2. The data file must be formatted such that commas or carriage
returns are used to separate numeric data items and quotation
marks or carriage returns are used to separate string data
items.
3. If the length of a string in the data file is greater than
the length of the corresponding string variable in the
argument list, the last part of the string will be skipped.
T_E_x_a_m_p_l_e_
40 OPEN FILE(1,9)"INFILE"
.
.
&_70 INPUT FILE(1)Z,Y,X,A<,B< \f
T_8.10 M_A_T_ _I_N_P_U_T_ _F_I_L_E_
F_o_r_m_a_t_
&_MAT INPUT FILE(file') , mvar' ,mvar' ...
file': a numeric expression which evaluates to the number
of a user file opened in mode 9.
mvar': a matrix variable.
U_s_e_
As a statement or command to read data in ASCII format from a
s_e_q_u_e_n_t_i_a_l_ _a_c_c_e_s_s_ _f_i_l_e_ for the matrix variables in the argument
list.
R_e_m_a_r_k_s_
1. The matrices must have been dimensioned before the statement
is executed (see Ch. 6).
2. Values are assigned to the matrix elements by rows in
ascendingorder.
3. The data file must be formatted such that commas or carriage
returns are used to separate the data items.
T_8.11 M_A_T_ _P_R_I_N_T_ _F_I_L_E_
F_o_r_m_a_t_
&_MAT PRINT FILE(file') , mvar' ,mvar' ...
file': a numeric expression which evaluates to the number
of a user file opened in mode 11.
mvar': a matrix variable.
U_s_e_
As a statement or command to write matrix data in ASCII format
to a s_e_q_u_e_n_t_i_a_l_ _a_c_c_e_s_s_ _f_i_l_e_._
\f
R_e_m_a_r_k_s_
See the MAT PRINT statement (Ch. 6).
T_8.12 M_A_T_ _R_E_A_D_ _F_I_L_E_
F_o_r_m_a_t_
MAT READ FILE(file',recno') , mvar' ,mvar' ...
&_
file': a numeric expression which evaluates to the
number of a user file opened in mode 0, 1, or 4.
recno': a numeric expression which evaluates to the
number (' 0) of a record to be read from a
random access file.
mvar': a matrix variable.
U_s_e_
As a statement or command to read data in binary format from a
sequential access file or record of a random access file for the
matrix variables in the argument list.
R_e_m_a_r_k_s_
1. The matrices must have been dimensioned before the statement
is executed (see Ch. 6).
2. Values are assigned to the matrix elements by rows in
ascending order.
3. If the attempt is made to read a record (from a random access
file) which is longer than the record length specified for
the file, the error message 0132: RECORD TOO LONG will
appear.
T_ 8.13 M_A_T_ _W_R_I_T_E_ _F_I_L_E_
F_o_r_m_a_t_
&_MAT WRITE FILE(file',recno') , mvar' ,mvar' ...
file': a numeric expression which evaluates to the
number of a user file opened in mode 0 or 3. \f
recno': a numeric expression which evaluates to the
number (' 0) of a record to be written to a
random access file.
mvar': a matrix variable.
U_s_e_
As a statement or command to write matrix data in binary format
to a sequential access file or record of a random access file.
R_e_m_a_r_k_s_
1. The matrices must have been dimensioned before the statement
is executed (see Ch. 6).
2. The values of the matrix elements are output by rows in
ascending order.
3. If the attempt is made to write a record (to a random access
file) which is longer than the record length specified for
the file, the error message 0132: RECORD TOO LONG will
appear.
T_8.14 O_P_E_N_ _F_I_L_E_
F_o_r_m_a_t_
&_OPEN FILE(file',mode') , filename'
file': a numeric expression which evaluates the
number of a user file. This number is
associated with filename' and used whenever
the file is referenced in other file
input/output statements.
-1 =' open and close are blind.
input/output to current input/output.
mode': a numeric expression which evaluates to a
number and specifies how the file is to be
used (see Remarks).
filename': a disc file or a device expressed as a string
literal or by means of a variable.
\f
U_s_e_
As a statement or command to associate a disc file or a device
with a user file number and to specify how the file is to be
used.
R_e_m_a_r_k_s_
1. One of the following modes must be specified:
Mode 0 for binary input from or binary output to a random
access file (READ FILE or WRITE FILE statement).
Mode 1 for binary input from a sequential access file
(READ FILE statement).
Mode 2 for binary output to a sequential access file,
when data is to be appended to previously written
data (WRITE FILE statement)
Mode 3 for binary output to a sequential access file
(WRITE FILE statement).
Mode 4 for binary input (only) from a random access file
(READ FILE statement).
Mode 9 for ASCII input from a sequential access file
(INPUT FILE statement).
Mode 11 for ASCII output to a sequential access file
(PRINT FILE or PRINT FILE USING statement).
2. A disc file must have been CREATEd (see Sect. 8.3) before it
can be opened, yet open will attempt to create a file if
mode = 3 or 11.
3. Random access files can only be opened in mode 0 or 4.
4. When a sequential access file is opened in mode 1, 3, 9, or
11, the system will position to the beginning of the file.
When a sequential access file is opened in mode 2, the system
will position after the last item written to the file, so
that data can be appended to previously written data.
5. When a sequential file is opened in mode 2, 3 or 11, the size\f
is extended to an integral number of slices. Any extension
during output will also be slice by slice.
T_ E_x_a_m_p_l_e_ _1_ C_o_m_m_e_n_t_ _(_1_)_
10 NAME<="DATA1"
20 OPEN FILE(0,0)NAME<
30 OPEN FILE(1,11)"DATA2" OPEN FILE used as a statement.
&_
T_E_x_a_m_p_l_e_ _2_ C_o_m_m_e_n_t_ _(_2_)_
* OPEN FILE(6,9)"PTR" OPEN FILE used as a command.
&_
8.15 PAGE FILE
F_o_r_m_a_t_
PAGE FILE (file')=expr'
file': a numeric expression which evaluates to
the number of a user file.
expr': a numeric expression in the range
0=expr'=132.
U_s_e_
As a statement or command to set the right-hand margin of an
output file.
R_e_m_a_r_k_s_
1. The default page width (length of a print line) is 72
columns.
2. If the page width is set to zero, the system will regard the
length of the print line as infinite and consequently not
output an automatic carriage return and line feed in PRINT
statements (see Ch. 3). The user may find this advantagous
when using the x-y addressing facilities of a video terminal.
E_x_a_m_p_l_e_
PAGE FILE (1)=80
\f
T_8.16 P_R_I_N_T_ _F_I_L_E_
F_o_r_m_a_t_
expr' , expr' ,
PRINT FILE(file') , slit' ; slit' ... ;
&_svar' svar'
file': a numeric expression which evaluates
to the number of a user file opened
in mode 11.
expr, slit, svar':a list of one or more numeric or rela
tional expressions, string literals,
or string variables the values of
which are written to a sequential
access file.
U_s_e_
As a statement or command to write data in ASCII format to a
s_e_q_u_e_n_t_i_a_l_ _a_c_c_e_s_s_ _f_i_l_e_.
R_e_m_a_r_k_s_
1. The PRINT FILE statement is used to output data to an ASCII
device, such as a line printer, or to a disc file for
subsequent off-line printing.
2. Each item in the argument list must be separated from the
next item by a comma or a semicolon. The argument list itself
must be terminated by a carriage return.
3. Output formatting is the same as that described under the
PRINT statement (see Ch. 3).
T_E_x_a_m_p_l_e_
10 OPEN FILE(2,11)"DATAFILE"
20 PRINT FILE(2)"RESULTS:"
30 PRINT FILE(2)X 2,X 3,X 4
&_ \f
T_8.17 P_R_I_N_T_ _F_I_L_E_ _U_S_I_N_G_
F_o_r_m_a_t_
expr' expr'
PRINT FILE(file') , USING format', slit' , slit' ...,
svar' ; svar' ;
&_
file': a numeric expression which evaluates to the
number of a user file opened in mode 11.
format': a string literal or string variable that
specifies the format (see Remarks) forout-
putting the items in the argument list.
expr': a numeric or relational expression.
slit': a string literal.
svar': a string variable.
U_s_e_
As a statement to output the values of items in the argument
list using a specified format.
R_e_m_a_r_k_s_
See the PRINT FILE statement (Sect. 8.16) and the PRINT USING
statement (Ch. 3).
8.18 PRINTDATE FILE
F_o_r_m_a_t_
,
PRINTDATE FILE (file') expr1',expr2',expr3'
;
file' a numeric expression which evaluates to the
number of a user file opened in mode 11.
expr1'
expr2' a numeric expression
expr3'
\f
U_s_e_
As a statement or command to write a variable with a date layout
in ASCII format to a sequential access file. The value of expr1'
is considered a date in the format yymmdd.
The value of expr2' is considered a time in the format hhmmss.
The value of expr3' is used as the format, determining the type
of output. The value is considered as a bit pattern.
Value of bit Print result
1 hours and minutes
2 seconds
4 19 in front of year
8 d. in front of date
(and no points between yy, mm and dd)
16 date is printed as ddmmyy
32 output is followed by extra space
64 space in front of output
E_x_a_m_p_l_e_ _1_
0010 PRINTDATE FILE (0) SYS(17), SYS(18), 2+4
0020 PRINTDATE FILE (0) SYS(17), SYS(18), 1+8
0030 STOP
1978.09.26 10.31.05
d.780926.1031
E_x_a_m_p_l_e_ _2_
0010 PRINTDATE FILE (0) VAR, 0,4+16
0020 STOP
25.07.1978
8.19 PRINTEPS FILE
F_o_r_m_a_t_
PRINTEPS FILE (file')= expr'
file' : a numeric expression which evaluates to
the number of a user file.
expr' : a numeric expression in the range E-100
to 1
U_s_e_
As a statement or command to specify the smallest number which
will not be printed as zero by a PRINT FILE statement.
\f
R_e_m_a_r_k_s_
The default value is 1E-10.
E_x_a_m_p_l_e_
PRINTEPS FILE (0)=E-8
T_8.20 R_E_A_D_ _F_I_L_E_
F_o_r_m_a_t_
var'var'
READ FILE(file',recno'), svar' , svar' ...
&_
file': a numeric expression which evaluates to the
number of a user file opened in mode 0, 1, or 4.
recno': a numeric expression which evaluates to the
number (' 0) of a record to be read from a
random access file.
var, svar':a list of one or more numeric or string
variables which are assigned values read
sequentially from a randomly accessed record
or sequentially from a file.
U_s_e_
As a statement or command to read data in binary format from a
sequential access file or record of a random access file for the
variables in the argument list.
R_e_m_a_r_k_s_
1. Each variable in the argument list must be of the same type
(numeric or string) as the corresponding data item in the
data file.
2. One can, however, read string data items into numeric
variables. (For each numeric variable, four bytes will be
read.) This facility can be used to copy a file (see Ex. 2).
N_o_t_e_: If the total number of bytes in the file is not
divisible by 4, the error message 0139: END OF FILE may
appear.
3. The EOF(X) function (see Sect. 8.5) can be used to detect an
end of file condition in the file (see Examples). \f
4. If the attempt is made to read a record (from a random access
file) which is longer than the record length specified for
the file, the error message 0132: RECORD TOO LONG will
appear.
E_x_a_m_p_l_e_ _1_ C_o_m_m_e_n_t_ _(_1_)_
0010 OPEN FILE(0,1)"DATA" This program uses the file
0020 DIM TEXT<(25) DATA, which is created in
0030 READ FILE(0)TEXT< the program shown as an
0040 PRINT TEXT< example of the WRITE FILE
0050 READ FILE(0)A statement (see Sect. 8.16).
0060 WHILE NOT EOF(0) DO
0070 PRINT A;
0080 READ FILE(0)A
0090 ENDWHILE
0100 CLOSE
THIS IS A DATA FILE
1 2 3 4 5 6 7 8 9 10
&_
T_E_x_a_m_p_l_e_ _2_ C_o_m_m_e_n_t_ _(_2_)_
0010 CREATE "DATA1",5 This program copies the file
0020 OPEN FILE(0,1)"DATA" DATA to a new file, DATA1.
0030 OPEN FILE(1,3)"DATA1"
0035 READ FILE(0)A
0040 WHILE NOT EOF(0) DO
0050 WRITE FILE(1)A
0060 READ FILE(0)A
0070 ENDWHILE
0080 CLOSE
&_
T_8.21 R_E_N_A_M_E_
F_o_r_m_a_t_
&_RENAME filename1',filename2'
&_
filename1': the name of the disc file to be renamed.
filename2': the new name of filename1'.
Both arguments are expressed as string literals or
by means of variables.\f
U_s_e_
As a statement or command to rename a file.
E_x_a_m_p_l_e_ _1_ C_o_m_m_e_n_t_ _(_1_)_
20 RENAME NAMES,"PROC3" RENAME used as a statement.
E_x_a_m_p_l_e_ _2_ C_o_m_m_e_n_t_ _(_2_)_
* RENAME "DATAFILE","FILE 3" RENAME used as a command.
8.22 TAB FILE
F_o_r_m_a_t_
TAB FILE (file')=expr'
file': a numeric expression which evaluates to
the number of a user file
expr': a numeric expression in the range 1expr'=
page width of this file.
U_s_e_
As a command or statement to set the zone spacing between the
print elements output by PRINT FILE statement.
R_e_m_a_r_k_s_
1. The default zone spacing (width of a print zone) is 14
columns. This spacing allows five print zones per 72
character print line.
2. Since the maximum range of zone spacing depends on the PAGE
FILE command, it is wise to specify the page width (length of
the print line) first and then specify the setting of the
tabulation zones.
E_x_a_m_p_l_e_
TAB FILE (2)=12\f
T_8.23 W_R_I_T_E_ _F_I_L_E_
F_o_r_m_a_t_
expr' expr'
WRITE FILE(file',recno') , slit' , slit' ...
svar' svar'
&_
file': a numeric expression which evaluates
to the number of a user file opened in
mode 0 or 3.
recno': a numeric expression which evaluates
to the number (' 0) of a record to be
written to a random access file.
expr, slit, svar': a list of one or more numeric or
relational expressions, string
literals, or string variables the
values of which are written
sequentially to a randomly accessed
record or sequentially to a file.
U_s_e_
As a statement or command to write data in binary format to a
sequential access file or record of a random access file.
R_e_m_a_r_k_s_
1. A_ _n_u_m_e_r_i_c_ _d_a_t_a_ _i_t_e_m_ _i_s_ _w_r_i_t_t_e_n_ _a_s_ _f_o_u_r_ _b_y_t_e_s_._ _A_ _s_t_r_i_n_g_ _d_a_t_a_
i_t_e_m_ _i_s_ _w_r_i_t_t_e_n_ _a_s_ _a_ _n_u_m_b_e_r_ _o_f_ _b_y_t_e_s_ _c_o_r_r_e_s_p_o_n_d_i_n_g_ _t_o_ _t_h_e_
l_e_n_g_t_h_ _o_f_ _t_h_e_ _s_t_r_i_n_g_._ _T_h_e_ _s_t_r_i_n_g_ _i_s_ _t_e_r_m_i_n_a_t_e_d_ _b_y_ _a_ _N_U_L_
c_h_a_r_a_c_t_e_r_ _(_s_e_e_ _A_p_p_._ _D_)_._
2. The result of a relational expression is written as one
numeric item, the value of which is 1, if the expression is
true (e.g. 3 ' 0), or 0, if the expression is false
(e.g. 0 ' 3).
3. If the attempt is made to write a record (to a random access
file) which is longer than the record length specified for
the file, the error message 0132: RECORD TOO LONG will
appear.
\f
T_E_x_a_m_p_l_e_
0010 CREATE "DATA",5
0020 OPEN FILE(1,3)"DATA"
0030 WRITE FILE(1)"THIS IS A DATA FILE"
0040 FOR I=1 TO 10
0050 WRITE FILE(1)I
0060 NEXT I
&_0070 CLOSE FILE(1) \f
F_ 9S_Y_S_T_E_M_ _C_O_M_M_A_N_D_S_
9.1I_n_t_r_o_d_u_c_t_i_o_n_
The statements and functions that are used for writing programs
in RC BASIC are described in preceding chapters. RC BASIC, how-
ever, may also be used interactively to perform such functions
as:
Maintenance of RC BASIC source programs
Desk calculator functions
Dynamic program debugging
File input/output
The present chapter describes commands for program development
and execution.
Commands derived from RC BASIC statements, for desk calculator
functions, program debugging, and file input/output, are
described in Appendix C.
Commands used in conjunction with batch mode are described in
Appendix B.
9.2C_o_m_m_a_n_d_ _t_o_ _d_e_l_e_t_e_ _p_r_o_g_r_a_m_ _s_t_a_t_e_m_e_n_t_s_
F_o_r_m_a_t_
line n1',line n2'
line n1'
line n1',
,line n2'
line n1': the first statement to be deleted.
line n2': the last statement to be deleted.
U_s_e_
As a command to delete one or more statements in a program.
\f
T_R_e_m_a_r_k_s_
The variations of the command have the following effects:
line n1',line n2' Deletes all lines with
line n1' = line number =
line n2'.
line n1' Deletes only the single line
with line number = line n1'.
line n1', Deletes all lines with
line n1' = line number.
,line n2' Deletes all lines with
line number = line n2'.
&_
T_E_x_a_m_p_l_e_ C_o_m_m_e_n_t_
* LIST
0010 PRINT
0020 PRINT
0030 PRINT
0040 PRINT
0050 PRINT
0060 PRINT
0070 PRINT
0080 PRINT
0090 PRINT
0100 PRINT
* 20,40 Lines 20-40 (= 20, 30, 40)
* LIST are deleted.
0010 PRINT
0050 PRINT
0060 PRINT
0070 PRINT
0080 PRINT
0090 PRINT
0100 PRINT
&_ \f
T_* 60 Line 60 is deleted.
* LIST
0010 PRINT
0050 PRINT
0070 PRINT
0080 PRINT
0090 PRINT
0100 PRINT
&_
T_ * 90, Lines 90-9999 (= 90, 100)
* LIST are deleted.
0010 PRINT
0050 PRINT
0070 PRINT
0080 PRINT
* ,70 Lines 1-70 (= 10, 50, 70)
* LIST are deleted.
0080 PRINT
*
&_
T_ 9.3A_U_T_O_
F_o_r_m_a_t_
line n1'
STEP
AUTO , line n2'
STEP
line n1' , line n2'
line n1': the initial line number in a program.
line n2': the increment between line numbers in a program.
&_
T_U_s_e_
As a command to provide automatic line numbers in a program,
thereby making it easier to enter programs from a terminal.
&_ \f
T_R_e_m_a_r_k_s_
1. The terminal is released from AUTO mode by pressing the
ESCape key.
&_
T_2. AUTO can be used as a command for a file that contains
statements; the statements can then be read into the current
program storage area by means of the ENTER command (see Sect.
9.7).
&_
T_3. The variations of the command have the following effects:
AUTO Assigns numbers to a program
starting with the default line
number 0010 and with a default
increment of 10 between line
numbers.
&_
T_ AUTO line n1' Assigns numbers to a program
starting with line number line
n1' and incrementing by line n1'
between line numbers.
&_
T_ STEP
AUTO , line n2' Assigns numbers to a program
starting with the default line
number 0010 and incrementing by
line n2' between line numbers.
&_
STEP
AUTO line n1' , line n2'Assigns numbers to a program
starting with line number line
n1' and incrementing by line n2'
&_ between line numbers. \f
T_E_x_a_m_p_l_e_ C_o_m_m_e_n_t_
* AUTO
0010 LET I=1
0020 An empty line is ignored.
0020 LET TOOLONGNAME=5
ERR : 0011
NAME TOO LONG
0020 LET Y=X If an error occurs, the line is
0030 repeated.
*
&_
T_9.4B_A_T_C_H_/_B_A_T_C_H_ _"_L_P_T_"_
F_o_r_m_a_t_
BATCH "LPT"
&_
T_U_s_e_
As a command to place the terminal in batch mode and cause the
system to start reading cards from the mark-sense card reader.
&_
T_R_e_m_a_r_k_s_
1. Output from the jobs executed, i.e. listings, output from
PRINT statements (see Ch. 3), and error messages, will appear
on the terminal or, if the BATCH "LPT" form of the command
is used, on the line printer.
&_
T_2. For a complete description of the batch mode of operation,
see Appendix B.
&_
T_9.5BYE
F_o_r_m_a_t_
BYE
&_
T_U_s_e_
&_As a command or statement to log the terminal off the system. \f
T_R_e_m_a_r_k_s_
Accounting information is output prior to the log-off.
&_
T_E_x_a_m_p_l_e_ C_o_m_m_e_n_t_
* BYE
TA 4 LOGGED OUT AT D.781113.0938
TIME USED, CPU: 00.00.11 REAL: 00.00.18 LOGIN: 00.01.13
TERMINAL 1 IDLE The now idle terminal can
be re-activated by pres-
sing the ESCape key.
&_
T_9.6C_O_N_/_C_O_N_L_
F_o_r_m_a_t_
CON
CONL
&_
T_U_s_e_
As a command to continue execution of the current program after
the execution of a STOP statement (see Ch. 3) in the program,
after the ESCape key has been pressed, or after an error has
occurred.
&_
T_R_e_m_a_r_k_s_
1. Output from PRINT statements (see Ch. 3) will appear on the
terminal or, if the CONL form of the command is used, on the
line printer.
&_
T_2. The CON/CONL command is equivalent to a RUN/RUNL line no.'
command (see Sect. 9.15) where line no.' is equivalent to
the statement immediately following the statement at which
the program stopped.
&_
T_3. If a run-time error is encountered in the program, the user
may correct the error and then give a CON/CONL command to
begin execution from the statement where the error occurred.
&_ \f
T_E_x_a_m_p_l_e_C_o_m_m_e_n_t_
* LIST
0010 DEF FNF(X)=2 X+2*X+2
0020 DATA 5,6,0
0030 PRINT " X ";"FNF(X)"
0040 READ X
0050 WHILE X'0 DO
0060 PRINT X;FNF(X)
0070 READ X
0080 ENDWHILE
0090 PRINT "13'10'SUPPLY NEW DATA (LINE 20)"
0100 STOP
0110 RESTORE 0020
0120 GOTO 0030
&_
T_* RUN
X FNF(X)
5 44
6 78
SUPPLY NEW DATA (LINE 20)
STOP
AT 0100
* 20 DATA 1,2,3,4,5,6,7,8,9,0 New data is
* CON supplied to the
X FNF(X) program before
1 6execution con-
2 10 tinues.
3 16
4 26
5 44
6 78
7 144
8 274
9 532
SUPPLY NEW DATA (LINE 20)
STOP
AT 0100
*
&_ \f
T_ 9.7 DISPLAY
F_o_r_m_a_t_
DISPLAY
&_
T_ U_s_e_
As a command to return a listing of the users logged in, together
with time of login and time of latest command or statement.
&_
T_ E_x_a_m_p_l_e_
*DISPLAY
logged in last
1 KNUD 4 14.30.05 15.01.17
2 TOVE 4 14.31.07 14.50.36
&_
T_ R_e_m_a_r_k_s_
The project number will only be output, if the command is given
by operator.
9.8E_N_T_E_R_
F_o_r_m_a_t_
&_
T_ENTER filename'
filename': a disc file or a device expressed as a string
literal or by means of a variable.
&_U_s_e_
T_
As a command or statement to merge the statement lines from the
disc file or the device specified by filename' into the current
program storage area.
&_R_e_m_a_r_k_s_
T_
1. If an error is detected during the reading of a statement,
the statement will be echoed on the terminal and an error
message output (see App. A).
2. Only those statements in the current program that have line
&_ numbers equivalent to the line numbers of the ENTERed state-
ments will be deleted. If, therefore, the current program (or
a part of it) is not to be used, a NEW command (see Sect.
9.11) should be given prior to the ENTER command. \f
T_E_x_a_m_p_l_e_ _1_ C_o_m_m_e_n_t_ _(_1_)_
* NEW The user>s program storage area is
* ENTER "PTR" cleared. The program on paper tape
* ENTER "PROGSR" and the program in file PROGSR
* LIST "PTP" are merged. The resulting program
is listed on paper tape.
&_
T_E_x_a_m_p_l_e_ _2_ C_o_m_m_e_n_t_ _(_2_)_
* LIST The current program and the
0010 PRINT program on paper tape are merged.
0020 PRINT
0030 PRINT
0040 PRINT
* ENTER "PTR"
* LIST
0010 PRINT I
0015 PRINT I
0020 PRINT
0025 PRINT I
0030 PRINT
0040 PRINT I
0050 PRINT I
*
&_
T_9.9E_O_J_
Used only in batch mode. For description, see Appendix B.
&_ \f
T_9.10L_I_S_T_
F_o_r_m_a_t_
line n1'
TO
LIST , line n2' filename'
TO
line n1' , line n2'
line n1': the first statement to be listed.
line n2': the last statement to be listed.
filename': a disc file or a device expressed as a string
literal.
&_
T_U_s_e_
As a command to output part or all of the currently loaded
program in ASCII to the disc file or the device specified by
filename' or, if filename' is not specified, to the terminal.
&_
T_R_e_m_a_r_k_s_
1. The variations of the command have the following effects:
LIST Lists the entire program
starting from the lowest
numbered statement.
&_
T_ LIST line n1' Lists only the single
statement at line
number line n1'.
&_
T_ TO
LIST , line n2' Lists from the lowest
numbered statement
through line number line n2'.
&_
T_ TO
LIST line n1' , line n2' Lists from line number line
n1' through line number
line n2'.
&_ \f
T_2. When the filename' argument is included, the LIST command
causes the specified lines to be written to the disc file or
the device named filename'.
&_
T_3. A file of statements created by the LIST command can be read
back into the current program storage area by means of the
ENTER command (see Sect. 9.8).
&_
T_ 4. I6 the statements are listed to a disc file, a new file named
filename' is created in the logical disc to which the termi-
nal is connected (see Ch. 8). If filename' already exists,
the statements are written to this file.
&_
T_5. If no program is currently loaded, the LIST command will not
cause an error message, but the output of a prompt (*) on the
terminal.
&_
T_E_x_a_m_p_l_e_s_ C_o_m_m_e_n_t_s_
* LIST The entire program will be listed
on the terminal.
* LIST "LPT" The entire program will be listed
on the line printer.
* LIST 100,500 "PROG1SR" Lines 100 through 500 will be
listed to the file PROG1SR.
* LIST 50 Line 50 will be listed on the
terminal.
&_
T_9.11L_O_A_D_
F_o_r_m_a_t_
LOAD filename'
filename': a disc file or a device expressed as a string
literal.
&_ \f
T_U_s_e_
As a command to load a previously SAVEd program in binary format
from the disc file or the device specified by filename' into
the user>s program storage area.
&_
T_R_e_m_a_r_k_s_
1. The LOAD command executes an implicit NEW command (see Sect.
9.13), thereby clearing any currently loaded program from
core memory.
&_
T_ 2. When a previously SAVEd program (see Sect. 9.16) has been
LOADed, it can be LISTed (see Sect. 9.9), modified, or RUN
(see Sect. 9.16).
&_
T_E_x_a_m_p_l_e_s_ C_o_m_m_e_n_t_s_
* LOAD "PTR" filename' is a device
(paper tape reader).
* LOAD "PROG1SV" filename' is a disc file.
&_
T_ 9.12 MESSAGE
F_o_r_m_a_t_
MESSAGE username',project', mess'
username' : name of the user
project' : project number
mess' : the message to be output
expressed as a string literal or
by means of a variable.
&_
T_ U_s_e_
To send a message to another terminal. If the message is not
addressed it will appear on the main console.
&_
T_ R_e_m_a_r_k_s_
If the operator sends an unaddressed message, it will appear on
all consoles logged in.
&_ \f
T_ E_x_a_m_p_l_e_
message "KC",4,"printer output ready"
message "please log out"
&_
T_ 9.13 NEW
F_o_r_m_a_t_
NEW
&_
T_U_s_e_
As a command or statement to clear all currently stored program
statements and variables from core memory and to close any open
files (see Ch. 8).
&_
T_R_e_m_a_r_k_s_
1. The user should clear his program storage area by means of a
NEW command(or statement) before entering a new program so
that statement lines from previous programs will not be
executed along with the new program.
&_
T_2. A NEW statement may appear as the last executable statement
in a program, thereby clearing the program from core memory
after program execution.
&_
T_3. When used with an ON-ERR or ON-ESC statement (see Ch. 3), the
NEW statement can be used to prevent unauthorized access to a
program.
&_ \f
T_E_x_a_m_p_l_e_ C_o_m_m_e_n_t_
* LIST
0010 LET NUMBER=5; I=0
0020 WHILE I=NUMBER DO
0030 PRINT NUMBER;
0040 LET NUMBER=NUMBER+1; I=I+2
0050 ENDWHILE
0060 NEW NEW used as a statement.
* RUN
5 6 7 8 9 10
END
AT 0060
* LIST This LIST command shows that
the program has been cleared.
*
&_
T_ 9.14P_U_N_C_H_
F_o_r_m_a_t_
line n1'
TO
PUNCH , line n2'
TO
line n1' , line n2'
line n1': the first statement to be punched.
line n2': the last statement to be punched.
&_
T_U_s_e_
As a command to output part or all of the currently loaded
program in ASCII to the terminal punch (when present).
&_
T_R_e_m_a_r_k_s_
1. A PUNCHed listing is preceded by a leader and followed by a
trailer, each containing 120 STX characters (see App. D).
&_
T_2. As the PUNCH command does not turn the terminal punch on and
off, the following procedure is required:
&_ \f
T_ a. Type the desired PUNCH command, press the RETURN key, and
immediately press the ON button on the punch.
&_
T_ b. A STX leader will be punched, followed by a listing of the
desired lines of the current program, followed by a STX
trailer.
&_
T_ c. When punching is completed, press the OFF button on the
punch.
&_
T_3. When part or all of a program is PUNCHed, a listing is output
on theterminal simultaneously.
&_
T_4. The variations of the command have the following effects:
PUNCH Punches the entire program
starting from the lowest
numbered statement.
&_
T_ PUNCH line n1' Punches only the single
statement at line number
line n1'.
&_
T_ TO
PUNCH , line n2' Punches from the lowest
numbered statement through
line numberline n2'.
&_
T_ TO
PUNCH line n1' , line n2' Punches from line number
line n1' through line
number line n2'.
&_
T_ E_x_a_m_p_l_e_ C_o_m_m_e_n_t_
* PUNCH 200 TO 500 Lines 200 through 500 will
be punched.
&_ \f
T_ 9.15R_E_N_U_M_B_E_R_
F_o_r_m_a_t_
line n1'
STEP
RENUMBER , line n2'
STEP
line n1' , line n2'
line n1': the initial line number in the current program.
line n2': the increment between line numbers in the
current program.
&_
T_U_s_e_
As a command to renumber the statements in the current program.
&_
T_R_e_m_a_r_k_s_
1. The variations of the command have the following effects:
RENUMBER Renumbers the current
program starting with the
default line number 0010
and with a default incre-
ment of 10 between line
numbers.
&_
T_ RENUMBER line n1' Renumbers the current
program starting with line
number line n1' and
incrementing by line n1'
between line numbers.
&_
T_ STEP
RENUMBER , line n2' Renumbers the current
program starting with the
default line number 0010and
incrementing by line n2'
between line numbers.
&_ \f
T_ STEP
RENUMBER line n1' , line n2'Renumbers the current pro-
gram starting with line
number line n1' and in-
crementing by line n2'
between line numbers.
T_2. Line numbers are limited to four digits. If a RENUMBER
command causes a line number to be greater than 9999, the
command will be re-executed as:
RENUMBER 1 STEP 1
&_
T_3. The RENUMBER command will also modify the line numbers in
GOSUB, GOTO, ON-GOTO/GOSUB, and RESTORE statements (see Ch.
3) to agree with the new line numbers assigned to the current
program.
4. References to non-existent lines are changed to 0000.
&_ \f
T_E_x_a_m_p_l_e_ C_o_m_m_e_n_t_
* LIST
0001 LET NUMBER=5; I=0
0002 REPEAT
0004 PRINT NUMBER*I;
0007 LET I=I+1
0010 UNTIL I=NUMBER
* RENUMBER The default values ofline
n1',line n2' are 10,10.
* LIST
0010 LET NUMBER=5; I=0
0020 REPEAT
0030 PRINT NUMBER*I;
0040 LET I=I+1
0050 UNTIL I=NUMBER
* RENUMBER ,5
*LIST
0010 LET NUMBER=5; I=0
0015 REPEAT
0020 PRINT NUMBER*I;
0025 LET I=I+1
0030 UNTIL I=NUMBER
*
&_
T_ 9.16R_U_N_/_R_U_N_L_
F_o_r_m_a_t_
RUN line no.'
RUNL filename'
line no.': the line number in the current program from
which execution is to begin.
filename': a disc file or a device expressed as a string
literal.
&_ \f
T_U_s_e_
As a command to execute the current program, either from the
lowest numbered statement or from the line number specified by
line no.', or to load and execute a previously SAVEd program as
the current program.
&_
T_R_e_m_a_r_k_s_
1. Output from PRINT statements (see Ch. 3) will appear on the
terminal or, if the RUNL form of the command is used, on the
line printer.
&_
T_2. The variations of the command have the following effects:
RUN/RUNL Clears all variables; undimensions
all arrays and string variables;
executes an implicit RESTORE
command (see Ch. 3); resets the
random number generator; runsthe
c_u_r_r_e_n_t_ _p_r_o_g_r_a_m_ from the lowest
numbered statement.
&_
T_ RUN/RUNL line no.' Retains all existing information,
e.g. the values of variables and
dimensioning, resulting from a
previous execution of the current
program; runs the c_u_r_r_e_n_t_ _p_r_o_g_r_a_m_
from the line number specified by
line no.'.
&_
T_ This variation of the command
allows program execution to be
resumed retaining the current
values of all variables and para-
meters. It may be used after the
execution of a STOP statement
(see Ch. 3) in the program, after
the ESCape key has been pressed,
or after an error has occurred,
and will incorporate any changes
made in the program after the
program was stopped.
&_ \f
T_ RUN/RUNL filename' LOADs a previously SAVEd program
from the disc file or the device
specified by filename' (see Sect.
9.10), thereby clearing any cur-
rently loaded program from core
memory; runs the previously S_A_V_E_d_
p_r_o_g_r_a_m_ from the lowest numbered
statement.
&_
T_ E_x_a_m_p_l_e_s_ C_o_m_m_e_n_t_s_
* RUN Runs the current program from the
lowest numbered statement.
* RUNL 50 Runs the current program starting
at line 50; output will appear on
the line printer.
* RUN "PTR" Loads a program from paper tape
and runs it from the lowest
numbered statement.
* RUNL "PROG SV" Loads a program from the file
PROG.SV and runs it from the
lowest numbered statement; output
will appear on the line printer.
&_
T_ 9.17S_A_V_E_
F_o_r_m_a_t_
SAVE filename'
filename': a disc file or a device expressed as a string
literal or by means of a variable.
&_
T_U_s_e_
As a command or statement to write the currently loaded program,
including the current values of all variables and parameters, in
binary format to the disc file or the device specified by
filename'.
&_ \f
T_R_e_m_a_r_k_s_
1. If the program is written to a disc file, a new file named
filename' is created in the logical disc to which the
terminal is connected (see Ch. 8). If filename' already
exists, the program is written to this file.
&_
T_2. In the interests of conserving space on a SAVE device, one
should add the statement
1 STOP
to the program and RUN it before it is SAVEd. This will cause
the core memory area which is used for variables during
program execution to be truncated. The 1 STOP statement may
then be deleted, before the program is SAVEd (see Ex. 2).
&_
T_3. A SAVEd program can be LOADed, CHAINed, or RUN (see,
respectively, Sect. 9.10, Ch. 3, and Sect. 9.15).
&_
T_4. SAVEing, rather than LISTing (see Sect. 9.9), is a more
efficient way to store large programs. The size of a program
in binary format can be determined by means of the SIZE
command (see Sect. 9.18). If the indicated size is less than
the number of ASCII characters in the program, which may be
ascertained by looking at the program, then SAVE should be
used rather than LIST.
&_
T_E_x_a_m_p_l_e_ _1_ C_o_m_m_e_n_t_ _(_1_)_
* SAVE "PTP" SAVE commands.
* SAVE "PROG1SV"
200 SAVE "PTP" SAVE statements.
200 SAVE "PROG1SV"
&_ \f
T_E_x_a_m_p_l_e_ _2_ Co_m_m_e_n_t_ _(_2_)_
* LIST Shows how one can save space
0010 DIM A(100) when SAVEing a program.
0020 FOR I=1 TO 100
0030 LET A(I)=I
0040 NEXT I
* SIZE
00422 HALFWORDS USED Size before execution.
04578 HALFWORDS LEFT
* RUN
END
AT 0040
* SIZE
00836 HALFWORDS USED Size after execution.
04164 HALFWORDS LEFT
* 1 STOP 1 STOP statement inserted.
* RUN
STOP
AT 0001
* SIZE
00428 HALFWORDS USED Size after second
04572 HALFWORDS LEFT execution.
* 1 1 STOP statement deleted.
* SIZE
00422 HALFWORDS USED
04578 HALFWORDS LEFT
* SAVE "PTP" Program SAVEd on paper
* tape.
&_
T_ 9.18S_C_R_A_T_C_H_
Used only in batch mode. For description, see Appendix B.
&_ \f
T_ 9.19S_I_Z_E_
F_o_r_m_a_t_
SIZE
&_
T_U_s_e_
As a command to return the number of bytes used by the current
program and the numbers of bytes left.
&_
T_R_e_m_a_r_k_s_
Even though no program is present, the SIZE command will
indicate that approximately 350 bytes have been used, as these
are always required to administer the execution of running
programs.
&_
T_E_x_a_m_p_l_e_
* SIZE
00836 HALFWORDS USED
04164 HALFWORDS LEFT
&_
T_ 9.20T_I_M_E_
Used only in batch mode. For description, see Appendix B.
&_ \f
\f
RC Computer Equipment
Installation Planning
2. edition
RC COMPUTER February 1981
Installation Department RCSL 42-i1621
\f
TECHNICAL ADVISER: Jørgen Rosendahl
TEXT EDITOR: Henning Christensen
KEYWORDS: RC Computer Equipment, hardware, installation
planning.
ABSTRACT: It is the concern of this publication to pro-
vide information on the installation planning
of RC computer equipment. Only hardware in-
stallation is covered. General information is
given with respect to computer room, environ-
ment, power supply, precautional arrangements,
and the connection patterns of the equipment.
\f
i
F_O_R_E_W_O_R_D_
First edition: RCSL No 42-i1438
Second edition: RCSL No 42-i1621
In general the second edition is a reprint of the first edition.
However, the tolerance of the voltage unfortunately was omitted
in the first edition - this has now been corrected. Further the
Appendix A: REFERENCES has been up-dated.
The changes are indicated by correction lines in the left margin.
Jørgen Rosendahl and Henning Christensen
A/S REGNECENTRALEN af 1979, February 1981
\f
ii
\f
iii
T_A_B_L_E_ _O_F_ _C_O_N_T_E_N_T_S_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _P_A_G_E_
1. INTRODUCTION .......................................... 1
2. INSTALLATION PLANNING ................................. 2
3. COMPUTER ROOM ......................................... 3
3.1 Size ............................................. 3
3.2 Location ......................................... 3
3.3 Walls, Ceiling, and Doors ........................ 4
3.4 Flooring ......................................... 4
3.4.1 Floor Covering ............................ 4
3.4.2 Raised Floor .............................. 5
4. ENVIRONMENTAL ......................................... 6
4.1 Temperature and Air Humidity ..................... 6
4.2 Sunlight and Lighting ............................ 7
4.3 Air Purity ....................................... 7
4.4 Vibration ........................................ 8
4.5 Static Electricity ............................... 8
4.6 Cleaning ......................................... 9
5. POWER SUPPLY PLANNING ................................. 11
5.1 Power Supply ..................................... 11
5.2 Equipment Ground ................................. 12
6. PRECAUTIONAL PLANNINGS ................................ 13
7. CONNECTION OF EQUIPMENT ............................... 15
7.1 Connection of Peripherals ........................ 15
7.2 Connection of Terminals .......................... 15
7.2.1 Terminals Directly Connected .............. 16
7.2.1.1 Data Connection .................. 16
7.2.1.2 Power Connection ................. 16
7.2.2 Terminals Connected by Modems ............. 17
7.2.2.1 Data Connection .................. 17
7.2.2.2 Power Connection ................. 17 \f
iv
T_A_B_L_E_ _O_F_ _C_O_N_T_E_N_T_S_ _(_c_o_n_t_i_n_u_e_d_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _P_A_G_E_
7.2.3 Terminals Connected by Current-Loop
Couplers .................................. 17
7.2.3.1 Data Connection .................. 18
7.2.3.2 Power Connection ................. 18
7.2.4 Terminals Connected by Terminal Concentra-
tors ...................................... 18
7.2.4.1 Data Connection .................. 18
7.2.4.2 Power Connection ................. 19
A_P_P_E_N_D_I_X_:
A. REFERENCE LIST ........................................ 21
\f
F_ 1_._ _ _ _ _ _ _ _ _I_N_T_R_O_D_U_C_T_I_O_N_ 1.
The installation of computer systems requires proper planning and
execution of many tasks. In addition to the general organisation
planning, the programming, and the education involved, also the
job of preparing the computer site and environment is of utmost
importance. A well planned installation saves money and is of
long term benefit because of the improved efficiency in oper-
ation.
It may often be felt that a smaller system should require fewer
preperations in arranging the installation - and rightly so, be-
cause of the overall impact on the environment being comparati-
vely smaller. Yet, it should not be forgotten that - say - a disc
storage device, whether applied in smaller or larger systems,
will forward exactly the same requirements.
This publication contains the general information on planning an
installation of RC computer equipment. It is augmented with a
further publication which contains the installation specifica-
tions. The two publications are intended as a guide in planning a
successful and efficient installation of RC computer equipment.
Throughout all phases of planning and installation of the equip-
ment, the RC Installation Department will be available to advise
you, based on a considerable experience in this specialized
field.
\f
F_ 2_._ _ _ _ _ _ _ _ _I_N_S_T_A_L_L_A_T_I_O_N_ _P_L_A_N_N_I_N_G_ 2.
Well in advance before delivery of the computer system, the cus-
tomer assisted by an RC installation engineer should find the
most appropriate solution to the subjects discussed in this pub-
lication.
It is the customer>s responsibility:
- to provide environmental conditions as specified in sec-
tion 4.
- to provide power supply, wall outlets, and regulation
equipment (if necessary) in accordance with the tolerances
of voltage and frequency as specified in section 5.
- to provide a safe and satisfactory access route for the
equipment, from the area where the truck is to be unloaded
to the computer room.
- to provide sufficient space and facilities for the instal-
lation and the subsequent maintenance of the computer sys-
tem by RC engineers.
The computer site and all facilities must be completed in due
course for approval by an RC installation engineer so that pos-
sible mistakes can be corrected before delivery of the equip-
ment.
The customer is asked to supply RC personnel with keys and ident-
ity cards if needed.
\f
F_ 3_._ _ _ _ _ _ _ _ _C_O_M_P_U_T_E_R_ _R_O_O_M_ 3.
When choosing an area to locate the computer system, attention
should be paid to the aspects mentioned below.
3_._1_ _ _ _ _ _ _ _S_i_z_e_ 3.1
The size of the room should be as large as to allow for a ra-
tional arrangement of the equipment. Generally a minimum of 1
meter in front and 0.6 meter at the rear of the units will be
required. In addition some units require 0.6 meter at both sides.
The clearance is required in order that the operator as well as
the service engineer can do their work, yet it is also essential
in order to keep an ample air flow around the equipment. These
areas therefore have to be kept clear at all times. The operator
and service areas specifically required are listed in the aug-
menting publication 1.
Furthermore there should be enough space for proper storage of
data media and accessories in the same environment as the com-
puter.
In case the system is supposed to expand according to schedule or
depending on increased need, these facts should be taken into
consideration when planning room facilities.
3_._2_ _ _ _ _ _ _ _L_o_c_a_t_i_o_n_ 3.2
The room should be located in a building of solid structure (due
to fire risk and damage by water). The building further should be
fairly well insulated (to lower the environmental influence by
sun heat or cold weather).
All doors, from the place of unloading to the computer room, have
to be wide enough for the units to pass through. In case of
stairs these have to be of a construction which allow heavy units
to be handled.
\f
3_._3_ _ _ _ _ _ _ _W_a_l_l_s_,_ _C_e_i_l_i_n_g_,_ _a_n_d_ _D_o_o_r_s_ 3.3
The walls and the ceiling of the computer room should be covered
with noise absorbing dustless material in order to reduce the
noise level in the computer room as well as to avoid the noise
from being transmitted to adjoining rooms.
Panels of glass should be provided in the partitions so that the
system can be viewed without entering the computer room.
The doors of the computer room have to be wide enough for the
different units of the computer system to pass through. It is
recommended that doors be fitted with self-closing devices and
clear glass panels at eye level.
3_._4_ _ _ _ _ _ _ _F_l_o_o_r_i_n_g_ 3.4
3_._4_._1_ _ _ _ _ _F_l_o_o_r_ _C_o_v_e_r_i_n_g_ 3.4.1
When selecting a suitable floor covering the following character-
istics need to be considered.
Wood, Linoleum - easy to keep clean, and harmful
electrostatic discharges unlike-
ly to occur.
Vinyl - easy to keep clean, and with
antistatic treatment electro-
static discharges can be kept
below harmful levels.
Antistatic carpets - difficult to keep reasonable
free from dust, but, if correct-
ly laid the electrostatic dis-
charges can be kept below harm-
ful levels (between the carpet
surface and the building floor
a maximum resistance of 2 x
M_M_m_ 10
P_P_p_ 10 ohms is allowed).
\f
Synthetic and wool - should be avoided due to heavy
carpets generation of static electric-
ity.
3_._4_._2_ _ _ _ _ _R_a_i_s_e_d_ _F_l_o_o_r_ 3.4.2
The installation of a raised floor has several advantages.
- Protects the interconnecting cables.
- Future layout changes are easily accomplished.
- Improves the personnel safety factor.
- Permits the space between the two floors to be used for
air supply to the equipment.
Raised floors can be obtained from specialist firms.
If it is expedient to install a raised floor, the following
points have to be taken into consideration:
- Height to the ceiling.
- The height under the raised floor should be 15 cm minimum.
- Level difference in proportion to adjoining rooms.
- If the floor of the room is made of plain concrete or an-
other dust producing material, the surface must be paint-
ed.
- Slots in the raised floor for cable exits and possibly for
ventilation must be arranged according to the drawings in
the augmenting publication 1.
\f
F_ 4_._ _ _ _ _ _ _ _ _E_N_V_I_R_O_N_M_E_N_T_A_L_ 4.
4_._1_ _ _ _ _ _ _ _T_e_m_p_e_r_a_t_u_r_e_ _a_n_d_ _A_i_r_ _H_u_m_i_d_i_t_y_ 4.1
A computer system will generate heat and at the same time it will
require that the ambient temperature and the air humidity are
kept within certain limits. In order to obtain the required con-
ditions it will often be necessary to install an air conditioning
system.
The RC computer systems are designed to operate at 21C and 50%
relative humidity. This design point provides for optimum system
performances.
The input air to the system under all conditions of operation has
to meet the specifications of the individual devices. The spec-
ifications given for each device constitute the maximum range of
operating conditions and should not be considered as the design
conditions. The specifications for the system environment as a
whole, of course, is determined by the unit having the most
restrictive limits. The temperature gradient should at no time
exceed 6C per hour. All specifications are contained in the
augmenting publication 1.
Condensation is not permitted on system components, i.e. other
parts than the system components have to be the coldest points in
the environment.
The specified environment has to be established in the system
area before system power is switched on.
Monitoring of the operating conditions with temperature and hu-
midity recording instruments (a Termohygrograph) is recommended.
\f
4_._2_ _ _ _ _ _ _ _S_u_n_l_i_g_h_t_ _a_n_d_ _L_i_g_h_t_i_n_g_ 4.2
System parts should not be exposed directly to sunlight. If the
room cannot meet this requirement, then windows have to be sup-
plied with reflective glass, film, or other sun screening facil-
ities.
Lighting fixtures should preferably be of the dual fluorescent
tube type. The fixtures should be evenly distributed over the
whole of the computer area. It is important that sufficient light
penetrates the area behind the devices so as to allow the en-
gineers to perform maintenance. On an average the light intensity
at desk top level should not be less than 400 lux.
Visual display terminals, however, may require places of less
light intensity.
4_._3_ _ _ _ _ _ _ _A_i_r_ _P_u_r_i_t_y_ 4.3
In order to achieve a high reliability of a computer installation
comprising disc drives, it is mandatory to keep the atmosphere in
the computer room free from dust. Incoming and recirculated air
must be filtered in accordance with Federal Standard 209a class
100 000. The standard states, that one liter of air in the room
is allowed to contain up to 3500 dust particles of a size 0.5
micron and larger, or 25 particles of a size 5.0 microns and
larger.
Dust sources, such as line printers, must be placed either close
to the air intake of the ventilation system, or even better in a
separate adjacent room.
Some industrial environments where the atmosphere is contaminated
with particles, liquids, or gases can cause corrosion of copper
and other metals used in computer systems. Extended corrosive
growth in any computer system can produce electrical short cir-
cuits or contact failures which will result in system malfunc-
tion. A satisfactory environment is obtained when complying to
the requirements of U.S. Occupational Safety & Health Standards
Administration (OSHA), Subpart G.
\f
4_._4_ _ _ _ _ _ _ _V_i_b_r_a_t_i_o_n_ 4.4
Computer systems can be affected by vibration, especially
installations comprising disc drives.
In case vibration is suspected to be a potential problem, one
should place a shallow disc of water on the floor. If ripples are
evident, then corrective actions are mandatory.
As a guide the following limits can be considered tolerable for
computer systems:
- For frequencies between 5 Hz and 10 Hz a maximum amplitude
of 0.1 mm.
- For frequencies between 10 Hz and 50 Hz a maximum ampli-
tude of 0.04 mm.
- For frequencies of 50 Hz and above a maximum acceleration
of 0.2 g.
4_._5_ _ _ _ _ _ _ _S_t_a_t_i_c_ _E_l_e_c_t_r_i_c_i_t_y_ 4.5
Static electricity is an accumulation of electric charges on
either insulating or conducting bodies. Static charges arise from
friction, in computer areas mostly from friction between the
floor and the shoes of the personnel, or plastic wheels of a
chair.
The amount of static electricity generated primarily depends on
the material of the shoes, the type of flooring, and the humidity
conditions. The average static voltage generated is typically
5000 to 12000 volts.
Due to the unavoidable contact between personnel and machines, it
is practically impossible to keep away all static discharges from
the computer equipment.
\f
The remedies to reduce this annoying phenomenon are:
- Selection of a suitable flooring (see section 3.4).
- Maintaining a relative humidity higher than 40%.
- Treatment of the floor with an antistatic spray (which is
available in most grocery stores). When applying the spray
the equipment must be switched off.
- Placing an antistatic mat at the entrance.
4_._6_ _ _ _ _ _ _ _C_l_e_a_n_i_n_g_ 4.6
The computer area should be cleaned on a daily basis to remove
dust and dirt and to help to prevent premature blockage of air
conditioning and equipment filters.
Cleaning should be performed with a slightly moist cloth.
In case a vacuum-cleaner is applied, one should observe that an
ordinary vacuum-cleaner may severly polute the air, when
referring to the computer environment. In fact the filter of an
ordinary vacuum-cleaner is far less effective than that for
instance of disc equipment. Especially if the vacuum-cleaner is
used outside the computer room, an extra amount of dust particles
is easily introduced, when subsequently using the vacuum-cleaner
in the computer room. As a result the equipment filters will be
more heavily loaded than would otherwise be the case. Therefore,
if using a vacuum-cleaner:
- use it in the computer room only,
- have it equipped with a special filter, equal in quality
to the equipment filters.
\f
In order to keep the computer room clean and tidy and to minimize
equipment malfunction the following rules should apply:
1) No smoking in the computer area.
2) No food or beverage to be allowed in the computer area.
3) All manuals, books, papers, discs, tapes, etc. not in use
should be returned to their correct locations and not
left lying in the work areas of the computer room.
In particular no objects should be placed on top of the
computer cabinets as they may easily obstruct the cabinet
ventilation.
\f
F_5_._ _ _ _ _ _ _ _ _P_O_W_E_R_ _S_U_P_P_L_Y_ _P_L_A_N_N_I_N_G_ 5.
By observing the below requirements, electrical noise is usually
reduced to a level that allows operation without problems due to
power supply. However, the electrical power can be of such bad
quality (transient or interrupted) that insertion of a ferroreso-
nant transformer, or a no-break system, may be needed. The RC
Installation Department should be consulted in such cases as well
as in general when problems arise due to power supply.
5_._1_ _ _ _ _ _ _ _P_o_w_e_r_ _S_u_p_p_l_y_ 5.1
The power supply of the computer system must be 220/380 volts
+_5%, three phases, neutral, and ground with a frequency of 50 Hz
+0.5/-1 Hz.
It is essential that the power is supplied directly from the main
switchboard of the building to a computer switchboard, which has
to be installed in or near the computer room. T_h_e_ _p_o_w_e_r_ _s_u_p_p_l_y_
h_a_s_ _t_o_ _b_e_ _a_ _d_e_d_i_c_a_t_e_d_ _l_i_n_e_ _o_n_l_y_ _u_s_e_d_ _b_y_ _t_h_e_ _c_o_m_p_u_t_e_r_ _e_q_u_i_p_m_e_n_t_,
and has to be kept away of exposure by any powerful electrical
induction. Therefore separate supply lines have to be planned for
general-purpose outlets, air conditioning, and other equipment.
The computer system is supplied from one 3-phase power-outlet in-
stalled within 6 meters of the central processing unit of the
computer. All peripherals, excepting detached disc drives and
Charaband printers, are supplied via the system power supply. The
detached disc drives are connected in groups of three to separate
3-phase power-outlets. Also the Charaband printers need separate
power-outlets, but one phase only.
Further, modems and directly connected terminals m_u_s_t_ _b_e_ _s_u_p_p_l_i_e_d_
from separate power-outlets, which have their supply from the
computer switchboard.
\f
The computer switchboard must contain fuses for each power-out-
let. Due to heavy startup current the fuses must at least be 16
amp. slow blow. In particular the Charaband printers need 25 amp.
fuses.
The use of ground fault interrupter relays (GFI, FI, or HFI) is
not possible.
In addition and separate to the computer power supply, a reason-
able number of wall-outlets should be available for servicing and
for other electrical appliances (220 V, 10 amp).
The power consumption of each unit is given in the augmenting
publication 1.
5_._2_ _ _ _ _ _ _ _E_q_u_i_p_m_e_n_t_ _G_r_o_u_n_d_ 5.2
The ground wire for the computer must be run from the neutral
point of the main switchboard of the building to the power-out-
lets in the computer area, or preferably to the frame of the
computer itself. The ground wire must be insulated and is not
allowed to make electrical contact with any conductive part of
the building on its way to the computer. The cross-sectional area
of the ground wire must be equal to or larger than that of the
active conductors. I_t_ _i_s_ _n_o_t_ _a_l_l_o_w_e_d_ _t_o_ _u_s_e_ _t_h_e_ _e_q_u_i_p_m_e_n_t_ _g_r_o_u_n_d_
f_o_r_ _a_n_y_ _o_t_h_e_r_ _p_u_r_p_o_s_e_.
If connection of the ground wire to the neutral point of the main
switchboard is not possible because of regulations by the local
electricity supply authority or otherwise, then a ground rod has
to be established. The resistance of the ground rod to true
ground must be less than 2 ohms.
\f
F_ 6_._ _ _ _ _ _ _ _ _P_R_E_C_A_U_T_I_O_N_A_L_ _P_L_A_N_N_I_N_G_S_ 6.
During the planning of the computer installation, attention
should be paid to the handling of emergencies.
In case of fire the computer equipment and the data carrying me-
dia can be permanently damaged both by the fire itself, but also
by smoke or water.
Temperatures over 65C can damage data on magnetic tapes or
discs, while temperatures above 120C will destroy these media
completely.
The following points should be considered, if convenient in co-
operation with an insurance representative:
- All furnishing in the computer area should be made of non-
combustible material.
- Emergency circuit breakers for the computer system and the
air conditioning system should be installed near the exit
of the computer area.
- At least two hand-operated fire extinguishers should be
M_M_m_m_ placed in the area. Both the CO and in particular the
P_P_p_p_ 2
Halon type are suitable.
M_M_m_m_ - CO and Halon flooding systems can be installed in the
P_P_p_p_ 2
computer area and the adjacent areas, providing sufficient
precautions are taken to safeguard the personnel.
- It is recommended to install a fire and smoke detection
system. The detectors should be located in the computer
area and in adjoining areas such as raised floors, false
ceilings, media storage areas, etc. The system installed
should indicate the location of the fire and sound an
alarm.
\f
- For security reasons additional copies of data files
should be kept on entirely separate premisses, if possible
in a fire-proof place.
\f
F_ 7_._ _ _ _ _ _ _ _ _C_O_N_N_E_C_T_I_O_N_ _O_F_ _E_Q_U_I_P_M_E_N_T_ 7.
Two principles in connecting equipment are applied. They will af-
fect the installation planning in different ways. Connections of
peripherals will mainly be a question of providing the adequate
quality of the computer room, whereas connection of terminals
will mainly be concerned with the line cabling involved.
7_._1_ _ _ _ _ _ _ _C_o_n_n_e_c_t_i_o_n_ _o_f_ _P_e_r_i_p_h_e_r_a_l_s_ 7.1
Peripherals are connected to the processing unit by means of in-
terfacing circuit-boards. The circuit-boards are accommodated in
chassis which again are accommodated in cabinets.
Due to the flexibility in product structuring, the actual way in
doing so differs somewhat from one device to another. The general
issue of interest in installation planning, however, is covered
by calculating the effects from the products which are mounted in
chassis, and the products which are selfcontained.
The augmenting publication 1 which contains the planning spec-
ifications provides further information in calculating the over-
all requirements of a computer installation.
7_._2_ _ _ _ _ _ _ _C_o_n_n_e_c_t_i_o_n_ _o_f_ _T_e_r_m_i_n_a_l_s_ 7.2
Terminal equipment can be connected in different ways as will be
seen in the following. Besides of these connections there is also
the console connection, which is a direct connection by means of
a controller board and which is equal to the connections of peri-
pheral devices. Terminal connections in general are accomplished
by means of multiplexer equipment (where the multiplexer equip-
ment with respect to the computer equals a peripheral device).
\f
7_._2_._1_ _ _ _ _ _T_e_r_m_i_n_a_l_s_ _D_i_r_e_c_t_l_y_ _C_o_n_n_e_c_t_e_d_ 7.2.1
Terminals can be connected directly to the computer system if
they are situated within reach of a 25 m standard cable furnished
by RC.
7_._2_._1_._1_ _ _ _D_a_t_a_ _C_o_n_n_e_c_t_i_o_n_ 7.2.1.1
The cables can be run through walls or horizontal divisions pro-
viding that the customer prepares the necessary holes prior to
the installation by RC. The minimum size of the holes must be 15
x 55 mm because of the cable connectors.
It may be preferred to establish the cable connection as a fixed
installation. In this case the cable is terminated by receptac-
les on the wall within 2 meters from the computer and the termi-
nal respectively. The maximum length of the cable in this kind of
installation still is not allowed to exceed 25 meters.
The fixed installation must comprise 3 pairs of twisted wires ap-
proximately # 22 AWG (3 x 2 x 0.6 mm) terminated at each end with
an empty wall switchbox type LK-NES 102 H 1030 (if locally not
available, please contact RC). The customer is responsible for
the installation and labelling of the fixed installation. Recep-
tacles and interconnection cables to the computer and the termi-
nals are supplied and installed by RC. If a number of receptacles
have to be installed at the computer location, a wallbox with 8
receptacles can be delivered by RC.
7_._2_._1_._2_ _ _ _P_o_w_e_r_ _C_o_n_n_e_c_t_i_o_n_ 7.2.1.2
A power-outlet (phase, neutral, and ground) for the terminal has
to be available within reach of the 1.5 meter power cable of the
terminal. The power-outlets MUST be supplied from the computer
switchboard.
\f
7_._2_._2_ _ _ _ _ _T_e_r_m_i_n_a_l_s_ _C_o_n_n_e_c_t_e_d_ _b_y_ _M_o_d_e_m_s_ 7.2.2
Distances between terminal and computer beyond 25 meters can be
supported by modem connections using a telephone line as line
cable.
7_._2_._2_._1_ _ _ _D_a_t_a_ _C_o_n_n_e_c_t_i_o_n_ 7.2.2.1
The interconnection cables are supplied by RC; from modem to com-
puter a 12 m standard cable is supplied and from modem to ter-
minal a 5 m, 12 m, or 25 m cable is supplied according to re-
quest.
7_._2_._2_._2_ _ _ _P_o_w_e_r_ _C_o_n_n_e_c_t_i_o_n_ 7.2.2.2
For power supply to the modems the Danish Post and Telegraph
Service requires a power-outlet comprising pilot-lamp, phase,
neutral, and ground. At computer site the power-outlet, which
services the modem, MUST be supplied from the computer switch-
board. At terminal site the terminal and the modem can be sup-
plied from any switchboard available. A power-outlet (phase,
neutral, and ground) has to be available within reach of the 1.5
meter power cables of the equipment.
7_._2_._3_ _ _ _ _ _T_e_r_m_i_n_a_l_s_ _C_o_n_n_e_c_t_e_d_ _b_y_ _C_u_r_r_e_n_t_-_L_o_o_p_ _C_o_u_p_l_e_r_s_ 7.2.3
Distances between terminal and computer in the range 25 m to 10
km can be supported by current-loop couplers. The current-loop
couplers facilitates similar connections as the modems do, only
they operate on private lines, opposite the modems which operate
on telephone lines.
\f
7_._2_._3_._1_ _ _ _D_a_t_a_ _C_o_n_n_e_c_t_i_o_n_ 7.2.3.1
The line cable must comprise 2 pairs of twisted wires approxima-
tely # 22 AWG (2 x 2 x 0.6 mm) terminated at each end with an
empty wall-switchbox type LK-NES 102 H 1030 (if locally not
available, please contact RC). The customer is responsible for
the installation and labelling of the line cable and the wall
switchboxes. Receptacles and interconnection cables between com-
puter and current-loop coupler, and terminal and current-loop
coupler respectively, are supplied and installed by RC. If a num-
ber of receptacles have to be installed at the computer location,
a wallbox with 8 receptacles can be delivered by RC.
7_._2_._3_._2_ _ _ _P_o_w_e_r_ _C_o_n_n_e_c_t_i_o_n_ 7.2.3.2
A power-outlet (phase, neutral, and ground) for the terminal and
the current-loop coupler has to be available within reach of the
1.5 meter power cables of the equipment. The power-outlets can be
supplied from any switchboard available. The current-loop coupler
at the computer site is supplied with power via the computer sys-
tem.
7_._2_._4_ _ _ _ _ _T_e_r_m_i_n_a_l_s_ _C_o_n_n_e_c_t_e_d_ _b_y_ _T_e_r_m_i_n_a_l_ _C_o_n_c_e_n_t_r_a_t_o_r_s_ 7.2.4
A number of terminals can utilize one line cable by means of a
terminal concentrator. The terminal concentrator functions as a
terminal seen from the computer and it functions as a computer
seen from the terminals.
7_._2_._4_._1_ _ _ _D_a_t_a_ _C_o_n_n_e_c_t_i_o_n_ 7.2.4.1
The data connections available with a terminal concentrator are
equal to those available with terminals in general (i.e. those
mentioned earlier in this section).
\f
7_._2_._4_._2_ _ _ _P_o_w_e_r_ _C_o_n_n_e_c_t_i_o_n_ 7.2.4.2
A power-outlet (phase, neutral, and ground) has to be available
within the reach of the 1.5 m power cable of the terminal concen-
trator. The concentrator can be supplied from any switchboard
available. If current-loop couplers are applied, these cannot be
supplied from the concentrator. Hence, a number of additional
power-outlets are required equal to the one of the concentrator.
These outlets as well as possible outlets for directly connected
terminals have to be supplied from the same switchboard as the
concentrator.
\f
F_
\f
F_ A_._ _ _ _ _ _ _ _ _R_E_F_E_R_E_N_C_E_ _L_I_S_T_ A.
1 RCSL No 42-i 1442, January 1981 (2. edition)
J. Michelsen/H. Christensen
R_C_ _C_o_m_p_u_t_e_r_ _E_q_u_i_p_m_e_n_t_,_ _I_n_s_t_a_l_l_a_t_i_o_n_ _S_p_e_c_i_f_i_c_a_t_i_o_n_s_
It is the concern of this publication to provide information
on the installation planning of RC computer equipment. Only
hardware is considered. Installation specifications are given
with respect to mounting, cabling distance, dimensions,
environmental and electrical aspects. Further a number of
area diagrams for layout planning.
\f
\f
«eof»