DATAPOINT CORPORATION DB11SYS, DB11ASYS, DB11BSYS Business Language Compiler User's Guide
PDF
مستند
إعلان
إعلان
DATABUS 1100
FOR DOS. SERIES
DB11SYS/DB11ASYS/DB11BSYS |
User's Guide |
Version 1
May, 1975
Model Code 50138
DATAPOINT CORPORATION
D
The Leader in
Dispersed Data Processing
DATABUS 1100 -
LB11SYS/DB11ASYS/DB11BSYS
USER “S GUIDE
Version 1
May, 1979
Model Code No, 50138
PREFACE
DATABUS 11, DB11SYS, is a high level business language
compiler designed tor use with the Datapoint Diskette Uperating
System, DOS.C. This User”s Guide describes the characteristics ana
use of the DATABUS 1100 Compiler, The same system is provided by
DB11ASYS for the Cartridge Disk Uperating System, DUS, Aj and by
DB116SYS for the Mass Storage Disk Operating System, DIS.B. A
references in this manual to DOS. Ú apply equally to LIS,A and a
1.
5,
4.
5
5e 1 MOVE
» ® + a + »
TABLE UF CONTENTS
INTRODUCTION
ATEMENT STRUCTURES
Comments |
Compiler Directives
Program execution
Literals
the forcing character
A sample program
“DUNE WN >
FILE DECLARATION AND DATA DEFINITION
3.1 File declaration
3.2 Data definition
3.2.1 Numeric string variables
3.2.2 Character string variables
3. 2.3 Common data areas
OGRAM CONTROL INSTRUCTIONS
LUTO =
BRANCH
- CALL
RETURN
: STOP
TRAP —
TRAPCLR
ROLLOUT
ELeSVSUELNTÉ
11 TABPAGE
CHARACTER STRING HANDLING INSTRUCTIONS
.2 APPEND
e 3 MATCH
«4 CMUVE
a» CHATCH
e BUMP
7 RESET
à ENDSE
9 LEvsET
10 CLEAK
11 EXTEND
В
File declarations and data definitions
Го PV O TU NG
1
UT iZ Las PU PU => == a
page
rad
$
y
1 1 1 1
3
слили
’
оо 00 5 = OH OU I BAN >
0.
Г,
5.12 LUAD
5.15 STORE
15 TYPE
5.16 SEARCH
2.17 REPLACE
ARITHMETIC INSTRUCTIONS
ol ADD
e à SUB or SUBTRACT
bed MULT or MULTIPLY
6.4 DIV ог DIVIDE
6.5 MVE |
6.6 COMPARE
6.7 LOAD
6,8 STORE
6.9 CHECK!
6,10 CHECKIO
INPUT /QUTPUI INSTRUCT IUNS
7,1 KEYIN |
Tele! Displaying with KEYIN
Tele? List Controls
Г. 1, 5 KEYIN Continuous
7.1.4 BACKSPACE and CANCEL
7.145 Operator Interrupt Procedure
7.1.6 New Line |
Tele? KEYIN Timeout and Pause
7.1.8 Echo Control
7.1.9 KEYIN Format Controls
7,1,10 Text Input
Tee DISPLAY
7.3 BEEP
7,4 PRINT
7,5 Disk 1/0
7.5.1 File structures
7.5.2 Positioning and accessing —
149.201 Physically Random Access
{.95+.242 Physically Sequential Access
7.5,020,3 Indexed Access
7.5.2.4 Physical Access to Indexea Files
$ PREP or PREPARE
4 UPEN
5 CLUSE
6 READ
Ilebeboel lest tor tnd Of File
7
7.5.
7,5.
Гао,
Т.о,
745,7 READKS
Г, >. 8 WRITE
dd
5-8
5=9
5-9
5-11
5-11
5-12
> o
2 4
‚ MN) oe.
6-2
o >
3 à
In TU
ee
"3
AN us
6=4
о ес
"ada 1 41
Sr |
Vi y loo wm] wy
1 3 13
> BW Am NTN TY ee mn
-
’
=
md
11
> u
5.9 WRITAB
5.10 UPDATE
5.11 INSERT
5.12 DELETE
7.5.13 WEOF
8. PROGRAM GENERATION
8.1 Preparing Source Files
8,2 Compiling Source Files
8,3 Compilation directives
8,4 Compilation diagnostics
8.5 Disk space requirements
9. SYSTEM OPERATION
9.1 System Loading
9.1.1 Loading From Cassette
9.1.2 Loading from Diskette
9.2 Program Execution
Appendix A, INSTRUCTION SUMMARY
Appendix B. INPUT/OUTPUT LIST CONTROLS
Appendix C. COMPILER ERROR CODES
Appendix D., ERROR CODES
Appendix E. INTERPRETER 1/0 TRAP CODES
iv
T=32
7.33
7=34
7 34
735
Bei
8» 1
8=1
8=5
8-6
8=7
O=1
mi
9-1
ee
que
CHAPTER 1, INTRODUCTION
DATABUS 1100 is similar to the Datapoint DATASHARE 3 Multiple
Terminal computer system, The primary difference 1s that
DATASHARE 3 supports multiple remote terminals whereas DATARUS
1100 supports only the processor console as an operator |
input/output device, DATARUS 1100 also handles a high=speed line
printer or servo printer and provides indexed=seguential as well
as random and sequential file accessing, thus providing a powerful
data entry and processing facility. |
In addition, DOS.,C with its variety of utility ana higher
level language systems may be used in conjunction with DATABUS a
1100, enabling processing of tasks not appropriate to the DATABUS
language, |
Using virtual memory techniques, DATAHUS 1100 allows programs
with a 16K byte area for executable statements. This, in
combination with the ability of the compiler to accommogate over
3400 labels, enables the user to create and use programs of over
one hundred pages (a very large high level language program), To ..
provide rapid program execution, the data area of the executing
program 15 maintained in main memory and not swapped,
Any of the Datapoint system printers may be connected to the —
DATABUS 1100 configuration, Printer output is buffered to allow
maximum program execution speed,
ATI program execution in DATABUS 1106 occurs in the DATABUS
language, Console command interpretation is handled in a special —
DATABUS program, the MASTER program which enables the user to
completely define his own console command and security systeme
Program generation is performed under the Flexible Disk.
Operating System, 00S,C, using. the general purpose DIS editor and
DATARUS 1100 compiler,
CHAPTER 1, INTRUDUCTIUN 1-1
CHAPTER 2, STATEMENT STRUCTURES
“There are five basic types of statements in DATABUS 11003
comment, compiler directive, file declaration, data definition,
and program execution, | |
2.1 Comments
Comment lines have a period, asterisk, or plus sign in the
first column, and may appear anywhere in the program. Comments
are most useful in explaining program logic and subroutine
function and parameterization to enable someone reading through
the program to more easily understand its logic. The comment _
which pegins with an asterisk will be printed at the top of the
next page it fewer than 12 lines are available at the bottom of
the current page, This allows comments to be presented on the
. same page as the program statements without having to know where
the listing currently stands on the page, The comment which
begins with a plus sign will always be printed at the top of the
next page, This allows major sections of the program to be oo
started at the top of a page. Use of the asterisk at the с
beginning of each section or subroutine description is. ‘encouraged
‘since this greatly enhances program readability, Use of the plus
sign should be cautious since it can easily waste great quantities
of paper, a
2,2 Compiler Directives
Compiler directives enable inclusion of other files in the
current compilation and definition of the absolute value of a
sympolic name for use in tab positioning in file 1/0 statements |
and column positioning in 1/0 statements. The inclusion directive
allows a large program to be broken into several files for ease in
editing, Another useful aspect is that a common set of |
subroutines or data definition blocks can be included into a
number of different programs, lherefore, when a change is made in
one of the routines or in the definition af a data items, only one
file nee: be modified, reaucina both the amount of manual labor
involved and the chance for error. See Section 8 (Frogran |
Generation) for more complete information on tne use of compiler
directives. |
CHAPTER 2, STATL=ENT STRUCTURES 2-1
ced File declarations and data definitions
File declaration and data definition statements must occur
before any program execution statements and are used for setting
up all of the logical files and data vartaoles in the program,
All tile declaration and data definition statements must have
labels, All compiler directive, file declaration, and data
definition statement labels must be unique among themselves,
Program execution statements must appear after any file
declaration or data definition statements and may or may not have
labels, The labels on program execution statements may be the
same as labels on the compiler directive, file declaration, and.
data definition statements. Program execution always begins with
the first executable statement.
2.4 Program execution
Labels for variables and executable statements can consist of
any combination of up to eight letters ana digits beginning with a
letter. The following are examples of valio labels:
A
ABC
A1BC
B1254
ABCDEF
BIGLABEL
Ine following are examples of invalid labels:
МЕ, УК (contains an invalid character)
40068 (does not begin with a letter)
Statements other than comments consist of a label field, an
operation field, an operand field, and a comment field, The label
“field is considered empty if a space appears in the first column
ot the line, The operation field denotes the operation to be
performed on the operands which tollow it, In many operations,
two operands are required in the operand tield. These operands
may be connected either by an appropriate preposition (BY, ТО, UF,
FROM, INg wlTH, USING, or INIU) or & comma, Une or more spaces
should follow each element in a statement except where a comma 15
used, in which case the comma must be the terminating character of.
the previous element and may be followed by any number (including
zero) af spaces. The tollowing are all examples of valid
me DATARBUS 1100
statements:
LABEL1 ADD PCS TO TOTAL
LABEL@ ADO PCS OF TOTAL — THIS IS A COMMENT
LABEL3 ADD PCS, TOTAL
LABEL4 ADD PCS, TOTAL
Note that any preposition may be used even 1f it does not
make sense in English, The following are examples of invalid
statements? |
LABEL] ADD PCS TOTAL (missing connective)
LABELS ADD PCS ‚TOTAL (space before comma)
Certain DATABUS 1100 statements allow a list of items to —
follow the operation field, In many cases, this list can be
longer than a single line, in which case the line must be
continued. This is accomplished by replacing the comma that would —
normally appear in the list with a colon and continuing the list
on the following line, For example, the two Statements:
DISPLAY А, В, Ср:
E,sF,G
DISPLAY ArBrCr Derek G
will perform the “same function,
Cad Literals
In an effort to reduce the amount of data area needed by a
program, ‘literals are allowed in certain statements which would
otherwise need constant data in the user*s data area, The .
instructions which can contain literals are: STORE, KUOLLOUT, |
CHAIN, MOVE, APPEND, MATCH, ADD, SUB, MULT, DIV, COMPARE, OPEN,
PREPARE, REPLACE, CHECK11, ano CHECKlu., In all except 1/0
statements and the CHECK verbs, the literal must be the first
operand, Tne literal is always enclosed within a pair of double
quotes (see the following section on the forcing character) and
may be from 1 through 40 characters in length (excluding the
quotes), when a literal is used as a string variable, its
tormpointer is always equal to one and its ¡ogica) length always
points to the last character that is quoted. Examples of the
statements which can contain literals follow?
STORE "APPLES" InTd X MF S1,50,583
ROLLOUT "CHAIN FIX22"
CHAT "NEXTRROG!
CHAPTER 2, STATEsE:=1 STruUCurREsS (o
OPEN
PREPARE
MUVE
MOVE
APPEND
MATCH
ADD
SUR
MULT
DIV
-CUMPARE
2.0 The forcing character
The pound sign (#)
"YES
FILEL,"DATAFILE"
FILE1;"USERDATA"
"MESSAGE" TO M3442
"100,55" TO VALUE
"." TO STRI
TU ANSWER
"253.46" TO TOTAL
"1" FROM COUNT |
"1" ВУ TAX Е
"33,3333" [МТО FACTOR
"10" TU LINENUMB
is interpreted by the compiler ‘as a
forcing character in any quoted item which can contain multiple
characters,
The character immediately following the pound sign 1s
used in the quoted item simply as a character value regardless of
its significance to the compiler,
the quote (") may be used in DATABUS 1100 statements.
example,
Thus:
For
DISPLAY "CUSTOMER#® SHOULD BE #"2222#""
would display exactly:
CUSTUMER# SHOULD BE
on the screen,
"2222"
Note carefully the wording used apove that
excludes the cases of RESET,
CMATCH, and CMOVE since those.
operations cannot have quoted items which contain multiple
characters,
CMOVE
would be used to move a double quote sign
the use of a literal
STRING. However»
For example,
(LN
TO STRING
into the variable |
in a MUVE instruction would
require the use ot the forcing characters even in a single
character mover
quote, For example:
MOVE
would be used to move a double quote sign
CMUVE,
SIRING, The RESET,
since the quoted
item can be a mutiple character
"ae TO STRING
into the variable
and CMATCH instructions are the only
exceptions to the forcing character convention within auoted
dei DVATABUS 1100
the pound sign itself and |
items,
Examples:
RESET STRING TO "a"
CMOVE "4" TO STRING
CMATCH """ TO STRING
c.7 A sample program
*
» PROGRAM TO DISPLAY A MULTIPLICATION TABLE
COUNT1 FORM "O"
CUUNTZ FORM "О"
PROD FORM 2
x
. HERE IS THE START OF THE EXECUTABLE CUDE
START DISPLAY *ES, "MULTIPLICATION TABLES", Kk
LUOP MOVE ~~ COUNTY TO PROD
MULT COUNT2 BY PROD
DISPLAY COUNT1,"X",COUNT2, "=", PROD," ",*N
ADD "1" TO COUNTE | 1
GOTO LOOP IF NOT OVER
ADO "1" TO COUNT!
GOTO LOOP IF NOT OVER
STOP IE
CHAPTER 2, SIATEMENT SIRUCTURES
CHAPTER 3, FILE DECLARATION AND DATA DEFINITION
There are two types of statements in DATABUS 1100 which cause
space within the user”s data area to be assigned, The first is
logical file declaration where the space is used to store the DOS
system information about the file being used and the second 15
data definition where the space is used to keep the variable
information within the DATABUS 1100 program,
5.1 File declaration
Two types of tiles can be declared in DATABUS 1100, The
first is a type that will be used for ranagom or physically
sequential accessing, This type is declarec using the FILE
statement:
INFILE FILE
The label INFILE will be used in all disk 1/0 statements that are
to use this particular logical file, This statement causes 17 A
bytes of data area to be consumed, This area stores the 15 bytes
used in the DOS logical file table, a space compression counter,
and a flag inaicating that this is a physically random or
sequential access only file, Note that since logical file
information is stored in the user®s data area, the user may have
any number of logical files active at any one time providing his
data area can contain all of the necessary declaration
information, |
Ihe second type ot file declaration is used for |
indexed=sequential file accessing, This type 18 declared using :
the IFILE statement: |
ISAMFILE ‚IFILE
The label ISAMFILE will be used in all disk 170 statements which |
are to use this particular logical file, This statement causes cb
bytes of data area to be consumea, This area stores the
information that a FILE declaration stores plus three three=byte
pointers for use in the access method, These pointers point to
the beginning of the last record accessed (for updating
operations), to the next sequential key (for sequential by key |
accessing), ana to information in the D11S R.l.B. of the index file
(used in all accessing operations).
CHAPTER 3, FILE DECLARATION AND DATA DEFINITION 5=1
3,2 Data definition
There are two types of data used within the DATABUS 1100
language, They are numeric strings and character strings, The
‘arithmetic operations are performed on numeric strings and string
operations are performed on character strings, There are also
operations allowing movement of numeric strings into character
atrings und vice versa, Numeric strings have the following memory
format: | |
0200 1 e . 5 0205
The leading character (0200) is used as an indicator that the
string is numeric, The trailing character (0203)(ETX) is used to
indicate the location of the end of the string CETX), Note that
the format of a numeric string is set at definition time and does
not change throughout the execution of the program, A numeric
string can be defined to contain at most 21 characters,
when a move into a number occurs from a string or differently
tormatted number, reformatting will occur to cause the information
to assume the format of the destination number (decimal point
position and the number of digits before and after the decimal —
point) with truncation occurring if necessary (rounding occurs if
truncation is to the right of the decimal point),
Character strings have the following memory format:
9 5 THE QUICK BROAN 0203
The first byte is called the logical length and points to the last
character currently being used in the string (K in the above
example). The second byte is called the formpointer and points to
a character currently being used in the string (0 in the above
example), The use ot the logical length and formpointer in
character strings will be explained in more detail an the
explanations of each character string handling instruction.
~~ basically, however, these pointers are the mecharism via which the
programmer deals with individual characters within tne string,
5-2 DATABLIS 1100
The term physical length will be used to mean the number of
possible data characters in a string (15 in the above example),
The logical and physical lengths of string variables are limited
to 127.
Whenever a data variable is to be used in a program, it must
be detined at the beginning by using either the FORM, INIT, or DIM
instructions. These instructions reserve the memory space |
described above for the data variable whose name is given in the
label field, Note that all variables must be defined before the
first executable statement is given in the program and that once
an executable statement is given, no more variables may be
defined, MNumeric strings are created with the FORM instruction
while character strings are created with the [NIT or DIM
instruction,
5.2.1 Numeric string variables
Numeric variables are definea in one of two ways with the
FORM instruction as shown in the following illustration:
EMRATE FORM 4,2
XAMT FORM " 382. 40°
| In this example, EMRATE has been defined as a string of
decimal digits which can cover the range trom 9999,99 to =999, 99.
The FURM instruction illustrated reserves spaces in memory for a
number with four places to the left of a decimal point and two
places to the right of a decimal point and initializes the value
“to zero, when the number is negative, one of the places to the -
left of tne decimal point is used by the minus sign, XAMT, in the
example, is defined with four places to the left of the decimal
point and three to the right but with an initial decimal value of
382,400, The physical length of a numeric variable is limited to
21 characters (decimal point and sign included).
3.20.2 Character string vartables
Character strings are defined with either a DIM or INIT
instruction. DIM reserves a space in memory for the given number
ot characters but sets the logical lenath and formpointer to zero
and initializes all the characters to spaces. for example:
STRING DIM 25
A character string can also be detined with some initial value by
using the INIT instruction. For example;
CHAPTER $. FILE DECLARATIULN AnD DATA DEFINITION 3-5
TITLE INIT "PAYROLL PROGRAM"
initializes the string TITLE to the characters shown and gives it
a logical length of 15, The formpointer is set to one, Note that
in the case of strings, the actual amount of memory space reserved
19 three bytes greater than the number specified in the DIM or
quoted in the [INIT instruction (TITLE occupies LH bytes in memory,
15 af which hold characters),
Uctal control characters (0U0 to 037) may be included when
initializing a string. The control character is separated by
commas, without quotes, and is preceded by a zero, for example,
TITLE INIT "PAYROLL PROGRAM", (015,"TEST1"
would initialize a string with a logical and physical length of 21
characters, The octal control character, 015, would appear after
the M in PROGRAM and before the first T in TEST1. It is the
responsibility of the programmer to remember that some of these
characters (000, 003, 011, and 015) are used for control purposes
in disk files. More importantly, these characters are used as |
control characters in DISPLAY and KEYIN statements, and improper
use of these characters in such statements can result in invalid
program execution, |
3.2.3 Common data areas
Since DATABUS 1100 has the provision to chain programs so
that one program can cause another to be loaded and run, it 15
desirable to be able to carry common data variables from one
program to the next, The procedure for doing this is as follows:
a, Identity those variables to be used in successive
programs and in each program define them in exactly the
same order and way, preferably at the beginning of each
program, The point in this is to cause each common
variable to occupy the same locations in each program.
Strange results in program execution usually occur if a
common variable is misaligned with respect to the
variable in the previous program,
be Define the variables in the normal way in the tirst
program, lhen, for all succeeding programs, place an
asterisk in each FURM, DIM, or INIT statement, as
illustrated below. to prevent those variables from being
initialized when the program is loaded into memory,
Aw VATABUS 1100
Examples:
MIKE FORM #4,2
JUE DIM *20
BOB INIT "THIS STRING HUNT BE LUADED”
File declarations may not be made common between programs, The
reasoning behind this restriction 18 that mis-alignment in file
declarations could easily cause catastrophic destruction of the
file structure under DOS.C. Therefore, whenever a program 1S
loaded, all logical files are initialized to being closed and must
be opened before any file I/O can occur, when chaining between
programs, one should always close all files in which new space
could have been allocated and then re=open the files in the next
Program.
CHAPTER 3. FILE DECLARATION AND DATA DEFISTITOS =>
CHAPTER 4, PROGRAM CONTROL INSTRUCTIONS
DATABUS 1100 normally executes statements in a sequential
fashion, The program control instructions allow this flow to be
altered depending on the state of the condition flags, There are
five condition flags in DATABUS 11003 uveR, LESS, EQUAL, ZERU, and ©
FOS, EQUAL and ZERO are two names for the same flag. Ünly the >
numeric and character string manipulating instructions, the READ
instruction, and tne READKS instruction alter the states of these.
flags. Reference should be made to the individual instruction
explanations for the meanings of the flags.
4,1 GOTO
| The GUTO instruction transfers control to the program
statement indicated by the label following the instruction:
GOTD CALC
causes control to pe transferred to the instruction labeled CALC,
The GOTO instruction may be made conditional by following the
label by the preposition IF and one of the condition flag names,
For example:
GOTO CALC IF OVER |
will transfer control to the instruction labeled CALC if an o
‘overflow occurred in the last arithmetic operation, Utherwise,
the instruction following the GOTU is executed,
The sense of the condition can be reversed by inserting the
word NUT before the condition flag name as follows:
6010 CALC IF NOT UVER
meaning control is transferred only 1f the overflow did not occur.
def BRANCH
The BRANCH instruction transters contro! to a statement
specified by an index. For example?
BRANCH N UF START CALC PUILT
CHAPTER 4, PRUGRAM CUSTROIL LS That TT Iuns (| =]
causes control to be transferred to the label in the label list
pointed to by the index N (Ci,e, START if № = 1, CALC If N = 2, and
POINT if N = 3), If N is negative, zero, or larger than the —
number of labels in the list, control continues with the following
statement. The index 18 truncated to no decimal places before it
is used (1,7 = 1), |
The BRANCH instruction statement may be continued to the next
line by the use of a colon in place of one of the variable
delimiting commas, For example:
BRANCH N OF LOOP, START, READ1, WRITE1:
— WEOF1, STUP
4,3 CALL
The CALL instruction is very similar to the GUTO instruction
except that when a RETURN instruction ís encountered after a
transfer, control is restored to the next instruction following
the CALL instruction, CALL instructions may be nested up to 8
deep, That is, up to eight CALL instructions may be executed
betore a RETURN instruction is executed, Being able to call
subroutines eliminates the need to repeat frequently used groups
of statements, Note, however, that in DATABUS 1100 the space
allowed for a program is very large and that, due to the virtual
nature of this space, calling a subroutine is considerably more
time consuming than executing the code in line if a page swap is
invoked by the subroutine call, Therefore, in many cases it 1s
much better to. put some code in line instead of making it a
subroutine, especially if the amount of code is quite small (says
less than a dozen lines). This is a trade”oft which should be
considered when one 18 dealing with code that will be executed
very often (for instance, code that ls executed every time a data
item is entered), CALL instructions may be made conditional like
the GOTU instruction, For example:
CALL FORMAT
CALL xCOMP IF LESS
4,4 RETURN
The RETURN instruction is used to transfer control to the
location indicated by the top address on the subroutine call
stacke This instruction has no operand field but may be made
conaitional. For example:
RETURN
це VATABUS 1100
RETURN IF ZERO
4,5 STOP
The STOP instruction causes the program to terminate and
return to the MASTER program, This instruction has no nmerand
field but may be made conditional. For example:
STOP
STUP IF NOT EQUAL
Execution of the STUP instruction in the MASTER program
returns control back to D03,.C. | a.
4.6 CHAIN
The CHAIN instruction causes the program, whose LUS name —
(with extension LäC) is in the literal or specified string, to be
loaded and for control to be passed to its tirst executable a
statement. The characters used for the name start from under the
formpointer of the specified string variable (or with the first
quoted character in the case of a literal) and continue until
either the logical end of the string has been reached or etaght
characters have been obtained, 1+ the end of the string is —
reached before eight characters are obtained, the rest of the
characters are assumed to be spaces, All DATARUS 1100 program
object files are of extension DBC. The character after the 8th in
the name variable (or the character after the logical! length if
the name is less than 8 characters long) is used as the drive
number specification for the file, If the characters is not an
ASCII 0, 1, 2, or 3 or no character physically exists past the
name, no drive specification is assumed and all drives starting
with grive zero are searched when looking for the program name in
the DIS directory (or directories), Utherwise, only the specified
drive is searched for the name, for example, if in the following
example NXTPGM®s formpointer was 4 and logical length vas 6, the
CHAIN command would try to load the program named "ROL/DESC” from
drive 1, |
NATPGM INIT "PAYRULI"
CHAIN NXTPGM
In the following example, however, the CHAIN command would try to
load the program named "PAYKULLI/UBC" otf of any drive starting
trom the zeroth,
LHARPTER 4, PROGRAM CONTROL THSTRUCT LUND 4 = 4
CHAIN "PAYRULI"
lo make the CHAIN command try to load the program nameaq |
"PAYROL/ZLBC" from drive one, one would execute the statement:
— CHAIN "PAYROL 1"
since the 1 would appear after the eighth character in this case,
4,7 TRAP
TRAP is a unique instruction because, rather than taking
action at the time it is executed, {It specifies the location to
which a transfer of control (via the CALL mechanism) should occur
if a specified event occurs during later execution. For example:
TRAP EMSG 1F PARITY
specifies that control should be transferred to EMSG if a parity
failure is encountered during a READ or WRITE instruction, The
control transfer is performed in a manner similar to the CALL
instruction, Therefore, in the above example, if the parity error
occurred during a disk READ instruction, the effect would be to |
insert a CALL EMSG instruction between the READ and the
instruction immediately following it,
1f an event occurs and the trap corresponding to that event
has not been set, the message:
x ERROR * LLLLL X * or
x ERRUR * LLLLL X * 4
appears on the console display. The first form appears for all
traps except 1/0 traps, In the event of an 1/0 trap, a
qualification letter is given where a "0" is shown in the example
(explained below under the "10" trap). The LLLLL is the current
value of the program counter and the X is an error letter, In |
most cases, LLLLL points to the instruction following the one that
caused the problem. However, in certain I/U errors, LLLLL will
point after the list item where the problem occurred. The
following error letters can appears
P = parity failure
R = pecord number out of range
F = record format error
С = chain failure
| = 17/0 error
my VATABUS 1100
B - illegal operation coaqe |
U = call stack underflow or overflow
A = interruptions already prevented
Note that the last three items shown above cannot be trapped. The
B error will only show up if somehow an invalid object file is
executed or if the system is failing, The 4 error will happen if
the programmer forgets to perform a call or in some other fashion
manages to execute a RETURN instruction without a corresponding
CALL having been previously executed, or calls are nested more
than eight levels deep, The A error will happen if a FI -
instruction is executed while interrupts are currently prevented,
The events that may be trapped are shown below, The
capitalized name is the one used in the TKAP statement,
PARITY = disk CRC error during READ.or disk CRC error
during write verification (the DUS retries an
operation up to 5 times to get a good CRC
before giving up and causing this event),
RANGE = record Number out of range (an access was |
made that was off the physical end of the file,
a record was read which was never written, or a
WwRITAB was used on record which was never
| | written) | В
FORMAT * data being read into a numeric variable was —..
Mr not all digits and decimal point and minus
sign, or decimal point in input does not agree —
with the decimal point in FURM, or data from —
“disk has a negative multi=punch but no room for
a minus sign in FORM, or write specified ~~
multi-punch and the last iter of the field is a
decimal point, The operation stops with the
a | item in error and the statement is aborted.
CFAIL — * the specified program was not in the DOS
directory or a ROLLUUT was attempted with one
of the necessary system files missing, or a
program containing compile=time errors was
loaded. ) ВЕ
LO = there is only cone trap for all ot the |
| following conditions. Usually, however, the
trap is used only for detecting whether a file
exists or not, lt is a обода idea keep this
trap clear whenever it.18 not being used
specifically to detect tne presence of a file
to prevent confusion 1f one of the other
conditions occurs. If the trap is not set then
CHAPTER 4. PROGRAM CONTROL INSTRUCTIONS AL
d=
one of the following qualification letters
LATABUS 1106
indicates tne nature of the 1/0 problem:
an access sequentially by key was attempted
before any indexed sequential access was made
using the logical file,
the READ mechanism ran otf the end of a sector
without encountering a physical end of record
character (003), o
an operation on a closed logical file was
attempted, | |
a WRITE or INSERT indexed sequential operation
was attempted where the specified key already
existed in tne index. | |
an EOF mark without at least four zeroes was
encountered,
the index file specified in an OPEN statement
does not exist on the specified drive(s),
the index file found by the OPEN statement does
not reside in the correct physical location on
the disk (index files may never be moved, they
must always be re“created),
a null key was supplied in an operation where
the key may not be null, |
the data file specified in the OPEN statement
does not exist on the specified drive(s).
the data file name specified in the OPEN or
PREPARE statement was null, |
the index file name specified in the OPEN
statement was null, |
the file specified in the PREPARE statement had
some type of DOS protection (either writes
delete, or both),
the tab value in the READ or WRITAB statement
was off the end of the sector,
an EOF mark was encountered while a record was
being deleted in the indexed sequential file,
one of the indexed sequential access overlays
could not be loaded by the DOS loader,
an index file pointer sector could not be read.
an index file header sector could not be read.
the R.l.b., of the data file pointed to by the
index file could not be read, = (vVwXY errors can
be caused by parity errors, the drive being
switched off line, or the disk cartridge being
swapped with another wnile an operation 15
takiny place, )
Note that the trap locations are cleared whenever a CHAIN Occurse
Therefore, each program must initialize all of the traps it wishes
to use, Also, whenever a certain event is trapped, the trap
location for that event is cleared, which implies that, if the |
event 18 to be trapped again, its location must be reset by the
trap routine. -
4,8 TRAPCLR
This instruction will clear the specified trap, For examples
TRAPCLR PARITY
will clear the parity trap previously set.
«
4,9 ROLLOUT
The ROLLOUT feature allows the execution of the DATABUS 1100
system to be temporarily suspended while certain functions are
performed under DOS.C. when a ROLLUUT occurs, the program a
ROLLOUT/SYS will be run which writes system status and memory in a _
file called RULLFILE/SYS. A been is sounded at the console to - |
alert the operator when a ROLLOUT is initiated, Clicks are
sounded as RULLFILE/SYS is created and another beep occurs when |
the file creation is completed. The DOS is then brought up at the
console by the loading of SYSTEMO/SYS. The RULLOUT/SYS program
then supplies the characters in the string specified by the
~Databus ROLLOUT instruction as if they were keyed in from the —
console (this will usually call the CHAIN program), “hen the DOS
functions are completed, the DUS file JHNACK/CMD may be executed
“to restore the DATABUS 1100 system to its previous status (this is
usually the last program specified in the CHAIN file), DEBACK/CHD
clears the screen and then loads the ROLLEILE/SYS object file,
This returns the DATABUS 1100 program to the point of execution
when the RÚLLUUT occurred, RULLOUT/SYS is provided with the
DATABUS 1100 System, |
ROLLUUT is initiated oy a DATABUS 1100 program with the
following instruction,
ROLLOUT (string variavle) or
ROLLOUT (string literal)
The string variable or literal specifies what function is
inttialiy to be executed under DIS ang should ve a command line
acceptable to the DUS command nanaler., The string used 15 that In
CHAPTER 4, PROGRAM CuvTkiuL INSTRUCIITORS ye]
the variable from under the formpointer up to before a character
that has a value less than 040 (octal), vs a vertical bar (0174
octal), or has a value of octal 0200 or above, In the normal
case, this means the string used will be that from under the
formpointer up through the physical length of the string, If it
is desired for less than through the physical end of the string to
he used, one should store a vertical bar in the position after the
last character to be used in the DUS command line string, À CFAIL
trap will occur if the string variable is null, For example, the
string”s contents could be
CHAIN DBCFILE
when DUS 1s brought up by the ROLLOUT, the first thing to occur
would be a chain to DBCFILE, The commanos found in DBCFILE would
then be executed (see the DOS Program User's Guide for additional
information concerning the DOS CHAIN command), OBCFILE could
consist of these commands:
SORT AFILE,BFILE
SORT CFILE,DFILE
DBBACk
By using the CHAIN command, several DOS functions can be performed
and the system automatically restored witn the DBBACK command, lt
DBBACK is not included in the chain file, 1f the CHAIN aborted for
some reason, if DOS was booted during the CHAIN, or if the string
specified in the ROLLOUT consisted of a DOS function other than
CHAIN, the DATABUS 1100 system will have to be restored by the
operator keying in DBBACK at the console,
The ROLLOUT feature is particularly useful when a tile needs
to be sorted with the DOS SORT command or an indexed file needs to
be re=indexed using the DUS INDEX command, Note that the clock is
not updated while the DATABUS 1100 system 1s not executing,
here are a number of precautions which must be observed
during the use of ROLLOUT, The functions performed while under
the DUS must not affect any of the operations that were taking
place under the DATABUS 1100 system, For example, the MASTER
program must not be changed and files that are open and in use
must not be modified or deleted, The reason behind this is that
when the DATABUS 1100 operation is restored, certain items in
memory reflecting the state of the DUS file structure will also be
restored, If these items are no longer accurate in their
reflection due to the fact that the file structure has been
changed, terrible things can happen to the DATABUS 1100 system.
thw {3 DATABUS 1100
Operations to be watched in particular include the changing of the
object code of any program that is running, the changing of any
files that are open, and the re=arrangement of any disks with
files in use within a multi-drive system,
4,10 PI
This instruction (Prevent Interrupt ions ) enables the |
programmer to prevent his program from being interrupted for up to
20 Datapus instruction executions, This instruction has no effect
upon the foreground one millisecond interrupt which performs the
printer 1/0.
Normally, background execution can be interrupted through
execution of the Interrupt procedure at the console, By executing
the PI instruction, the programmer can postpone this interruption
for a specified number of instructions (up to a maximum of 20),
The number of instructions specified in the PI instruction is
always a fixed decimal number (it may not be a numeric variable),
For example: | |
PI 4
READ FrKEYFPN WT YUNH, LUD
SUB QTY FROM OTYUNH
GOTO WUTNUFF IF LESS
UPDATE FPN, QTYUNH, LOD
Interruptions wil] be prevented from the PI instruction through
the UPDATE instruction, Note that the number supplied to the PI
instruction denotes the number of instructions after the Pi
instruction,
“It a KEYIN instruction is executed while interruptions are
prevented, the effect of the PI instruction is canceled, If a Pl
instruction is executed while interruptions are currently
prevented, execution of the program is aborted with an error “A'
message, [his prevents a program from being able to prevent
interruptions for more than 20 instruction executions.
Note that when devising systems with complex data file
structures it is necessary to protect the file structuring against
irreparable agestruction by untimely interruption, The P]
instruction can be used to prevent the operator from causing such
a disturpance, However, 1t should not be used as a panacea for
the interruption problem since interruptions can still be caused
by power failures or the system operator restarting the processor,
CHAPTER 4, PROGKAS CURTROL 1ASTRUCTIONS 4=9
The PI can be very useful in preventing the operator from causing
a Situation which could require extensive recovery effort but the
precautions which allow recovery in the event of an interruption
at any point in the program must still be built in to allow
recovery in the other less likely but stil] possible interruption
cases, | | |
Although when operating under VATABUS 1100, there is only one
user program executing at a times and no consideration need be
given to another user updating a file as it is being processed,
the PI instruction provides the ability to lock out alternate
accesses, providing for future upgrades to multi=user DATASHAKE
4,11 TABPAGE
This instruction torces sections of the program into certain.
pages of object code, Execution speed can be enhanced in this way
because of the way the virtual storage mechanism for the object
code works, The instruction consists only of the verb TABPAGE and
has no operands (a label may be placed on a TABPAGE instruction
line, however). Execution of the TABPAGE instruction causes
control to be transferred to the first byte of the next page,
Note that liberally scattering TABPAGE instructions
throughout a user program will in general not result in an
increase in execution speed, Instead, the usual effect 1s to
increase the rate of thrashing of the program, ITASPÁLE should
only be used to force tiaht loops to reside entirely within one or
two pages.
d=10 VATAHUS 1100
CHAPTER 5, CHARACTER STRING HANDLING INSTRUCTIONS
Each string instruction, except LUAD and STURE, requires
either one or two character string variable names following the
instruction, (Note that the MUVE instruction is capable of moving —
strings to numbers, numbers to strings, and numbers to numbers, as
well as moving strings to strings. See the following section and
section 6.5 for the entire description of the MUVE instruction.
Also note that APPEND can move numbers into strings as well as
Strings into strings.) In the following sections, the first
variable will be referred to as tne source string and the second
variable will be referrea to as the destination string, In some
Cases, the source may be a literal, when it is, the formpointer
always points to the first physical character in the string and
the logical length always points to the last physical character in
the string. |
2.1 MOVE
MOVE transters the contents of the source string into the
destination string, Transfer from the source string starts with
the character under the formpointer ana continues through the
logical length of the source string. Transfer into the
destination string starts at the first physical character and. when
transfer is complete, the formpointer is set to one and the
logical length points to the last character moved, The EOS f!ag
is set it the ETX in the destination string woula have been
overstored and transfer stops with the character that would have
overstored the ETX, If the source string is null, the length and 5
form pointer of the destinat ion string are set to zero, and the
EOS condition is NOT set, a
The MOVE instruction can also move character strings to
numeric strings and vice versa, (The movement of numeric strings
to numeric strings is covered in section 6.5.) A character string
"will be moved to a numeric string only 1f the character string
from the formpointer through the logical length 1s of valid
numeric format (only digits, spaces, a leading minus sign, and one
decimal point allowed). (itherwise, the numeric string is not
changed, Note that only the part of the character string starting
with the formpointer 1s considerea in the validity check and
transferred if the string is of valig numeric format. The number
in the character string will be reformatted to conform to the
format of the numeric string. Kounding cccurs it the number in
CHAPTER 5, CHARACTER STRING MANDLISG ISSIRUCTIONS he]
the character string {8 too large to fit into the format of the
numeric string (see Section 6 for rounding rules followed), The
TYPE instruction is available to allow checking the character
string for valid numeric format before using the MUVE instruction,
When a numeric string is moved to a character string, all
characters of the numeric item (unless the ETX in the destination
string would be overstored) are transferred starting with the
physically first character in the destination string, when the
operation is completed, the logical length is set to point to the
last character transferred. The EDS condition is left true if the
ETX of the destination string would have been overstored, In this
case, transfer stops with the character before the one that would
have nverstored the ETX and the logical length is left pointing to
the physical end of the string (which contains the last character
transferred).
In the following examples, the logical length, formpointer,
and content of each variable is shown betore the statement 1s
executed, the statement is shown ang the contents of the variable
that is changed by the execution of that statement 1$ shown, The
^ denotes a space in the contents of a variable.
VAR LL FP Contents
STRING1 4 2 ABCD XL M ETX
STRINGE 6 5 DOGCAT ETX
MOVE STRING TU STRING?
STRING 3 1 BCDCAT ETX
STRING2 6 3 DOGCAT ETX
MOVE "HELLO" TO STRING@
STRINGA 5 1 PELLUT ETX
Dee DATAHKLS 1100
STRINGI 9 3 AK100,327 ETA
NUMBER — 0200: 39,00 ETX
MOVE STRING1 TO NUMBER |
NUMBER 0200 100,55 ETX
NUMBER 0200 100.33 ETX
STRING1 9 3 AB100,327 ETX
MOVE NUMBER TO STRINGI
STRINGI 6 1 100,33327 ETX
Note that in the statement:
MUVE | "АВС" TO NUMBER
‘the compiler will give an E error flag since it knows that this
cannot be a valid operation (the move will not occur because the =
literal is not of valid numeric format), In the statement:
MOVE "2.3" TO STRINGI
the compiler will generate a string to string move rather than a ———
numeric to string move, | - | | Don
5,2 APPEND
APPEND appends the source string or number to the destination.
string. A numeric item is treated exactly as if it were a string
with a formpointer pointing to the first physical character and a
logical length pointing to the last physical character in the
number, The characters appendea are those from under the .
formpointer through under the logical length pointer of the source
string, The characters are appended to the destination string
starting after the formpointed character in the destination
string. Ihe source string pointers remain unchanged, but the.
destination string pointers both point to the last character
transferred, The EOS condition a41|1 be set ıf the new string will
not fit pnysically into the destination strings hut all characters
that will fit will be transferred, | |
CHAPTER Se CHARACTER STRING HANULING INSTRUCTIONS | He}
The following example shows two strings before the operation,
the operation, and the result in the second string after the
operation: |
STRING] 8 6 JOHN" DOE ETX
STRING? 11 11 МАК ^ ЛОМЕ5 ^^^ ^^^ ^^ ^^ ^ ETX
APPEND STRINGI TU STRINGZ
STRINGS 14 14 MARY" JONES"DOE""*55°%° ETX
The tollowing example shows a destination string before the
operation, an operation appending a literal to the destination
string, and the destination string after the operation:
STRINGS 9 8 МАК ^ ЛОМЕ5 ^^ ^^ ^^ ^^ ^^ ^^ ETX
APPEND " XX, YY" TU STRINGe
STRING? 15 15 MARY “ JUN, XX, YY,Q 7 "ee ETX
The fo!lowing example shows the use of APPEND to move a
numeric item into a string items |
NUMBER 0200 100,335 ETX
STRING 9 2 ABCUEFGHI ETX
APPEND NUMBER TO STRING
STRING 8 8 AB100,331 ETX
5.3 MATCH
MATCH compares two character strings starting at the
formpointer of each and stopping when the end of either operand”s
string is reached, lf either formpointer is zero before the
operation, the MATCH operation will result in only clearing the
LESS and EWUAL flags and setting the EUS flag, f(therwise, the
"length" of each string is calculated to be LENGTH-FORMPOINTER+1
and the LESS flag is set it the destination string length is less
than that of the source string, The two strings are tnen compared
on a character*for*“character basis for the number of characters
Quo DATABUS 1100
equal to the lesser of the two lengths, If all the characters
match, the EQUAL flag is set. (therwise, the LESS flag's meaning
1s changed to indicate whether the ASCII value of the destination
character is less than the ASCII valué of the source character
(LESS flag set) or vice versa (LESS flag reset) for the first pair
of characters that do not match. Some examples and their results
follow: | Ш
SOURCE DESTINATION RESULT
ABCDE ABCD — EQUAL, LESS
ABC — ё NOT EQUAL, NOT LESS
222 ААА МОТ BEWUAL, LESS
ABC — ABC ENUAL, NOT LESS
ABCD —— ABCDE EQUAL, NUT LESS
Examples: |
MATCH A TU B
MATCH STRI,STR2
Ded LMOVE
CMOVE moves a character from the source operana to under the LS
formpointer in the destination string. The character from the -
“source operand may be a quoted alphanumeric (note that the forcing
character rule does not apply here), the character from under the
formpointer of a string variable, or an octal control character
(000 to 037), If either operand has a formpointer of zeros, an EOS
condition and no transfer occurs, Specifically, a variable
declared with DIM instead of INIT has an initial value of NULL.
Examples:
CMOVE XDATA TO YDATA
CMOVE "A" TO CAT
CMOVE X,Y
CMOVE 015,Y -
daD CMATCH
CMATCH compares two characters, one taken from each of the
source and destination operands, Ihe characters may be quoted
alphanumeric (note that the forcing character rule does not apply
here), from under the formpointer ot a string variable, or octal
contro) characters (000 to 03/), An ECS condition occurs jf
either formpointer is zero, and no other conditions are set.
CHAPTER 5. CHARACTER STRING HANDLING INSTRUCTIONS Geh
Utherwise, the EQUAL and LESS conditions are set appropriately,
The LESS condition is set if the destination string character is
less than the source string character,
Examples:
CMATCH XDAIA TO YDATA
CMATCH "A",DOG
CMATCH CAT TO "A"
CMATCH 015,D06
9.6 BUMP
BUMP increments or decrements the formpointer of the first
operanu if the result will be within the string (between | and the
logical length). If no parameter is supplied, BUMP increments the
formpointer by one. However, a positive or negative literal value
may be supplied to cause the formpointer to be moved in either
direction by any amount, Note that a numeric variable is not a
valid arguement to BUMP, although such a statement will not be
flagged by the compiler, This is because the compiler treats any
text appearing after a valid arguement as comments, providing it
is not recognisable as another arguement, The EOS flag will be
set and no change in the formpointer occurs if it would be less
than one or greater than the logical length after the movement had
occurred,
Examples:
BUMP CAT
BUMP CAT BY 2
BUMP CAT,=1
2.7 RESET
RESET changes the value of the formpointer of the source
string to the value indicated by the second operand, If no second
operand is given, the formpointer will be reset to one. The
second operand may be a quoted character, in which case the ASCII
value minus 31 (space gives one, |! two, " three, etc) will be used
for the value of the formpointer of the source string, The second
operand may also be a character string, in which case the ASCII
value minus 31 of the character under the formpointer of that
string will be used for the value of the formpointer of the source
string, The secona operand may also be a numeric string, in which
case tne value of the number will be used for the formpointer of
the source string.
9
o DATAKUS 1106
The use of a string variable as the second operand in a RESET
instruction may not be obvious at first, (ne application could be
in doing cede conversions where each character in the string to be
converted is used as a formpointer value in a code conversion
string from which is picked to corresponding converted character
to be used as the character in the converted string. Another use
is in the coding of item positions within a string into 4 single
Character, For example, in a file one might want to place an item
in a variable location within the record, The first character of
the record could be a character which corresponds to the column
position within the record of the start of the item, Une could
read tne first character of the record into a one character string
variable and then the rest of the record into a large string
variable, The large string variable coulao then have its |
formpointer reset to the position indicated by the first character
in the record and the item could then be moved to another variable
with the MOVE instruction. |
RESET also has the capability of extending the logical length
ot the first operand, It the formpointer value specified is past
the logical length of the first operand, the logical length will
be extended until it will accommogate the formpointer value, lf
this would cause the logical length to be past the physical end ot
the strings the logical length and formpointer will both be left
pointing to the last physical character in the string, This | Ш
feature is useful in extracting and inserting information within a
large string. The EOS condition will be set if a change in the
logical length of the first operand occurs, =
Examples:
RESET XDATA TO 5
RESET Y В
RESET 7 ТО NUMBER
RESET 7 10 STRING
Note that the RES ET instruction is very useful in coe
conversions and hashing of character string values as well
large string manipulation,
5.8 FENUSET
ENDSET causes the operands tormpointer to point where its
logical lengtn points,
Example?
CHAPTER YS. CHARACTER STRING Hamil ING JiSTRUCTIHES - 5-7
ENDSET PNAME
5,9 LENSET
LENSET causes the operand’ s logical length to point where its
formpointer points. _ Е |
Examples
LENSET QNAME
5.10 CLEAR
CLEAR causes the operand’s logical length and formpointer to
be zero, None of the data characters are changed,
Examples
CLEAR NBUFF
Sell EXTEND
EXTEND increments the formpointer, stores a space in the
position under the new formpointer, and sets the logical length to
point where the new formpointer points if the new logical length
would not point to the ETX at the end of the character string.
Utherwises the EUS flag is set and no other action is taken,
Example:
EXTEND BUFF
5.12 LOAD
LOAD performs a MOVE from the character string pointed to by
the index numeric variable, given as the second operand, to the
first character string specified, lhe instruction has no effect
if the index is negative, Zero, or greater than the number of
items in the list, Note that the index is truncated to no decimal
places before it is used (e,q. 1.7 = 1), | |
Example:
LOAD AVAR FRUM м UF NAME, TITLE, HEDING
Hed DATARUS 1100
5.13 STORE
STURE performs a MOVE from the first character string
specified to a character string in a list specified by an index
numeric variable given as the second operand, The instruction has
no effect if the index js negative, Z€FO; Or greater than the
number of items 1n the list. Both LOAD and STORE can be used with
numeric arguements, see the section under "Arithmetic Uperations,"
Note that the index 1s truncated to nc decimal places before it is
usec (2,9, 1,7 = 1). | |
Examples:
STORE Y INTU NUM OF ITEM, ENTRY, AL [HK
STORE "XX" INTO NUM OF A1,A2,A3
- The LAND and STORE instructions may be continued to the next
line by the use of a colon: | o
Exemples:
LOAD SYMBOL FROM N OF VAR, CONST, DEC;
COUNT, FLAG,LIST
- STORE NAME INTO NUM OF A, "Веб, 0, tof, Gg
| | Ho Lodo Kolo
5.14 CLUCK
CLOCK enables the Programmer to access the DATABUS 1100
clock. This interrupt is accurate to approximately 0.005 percent
or four Seconds per day, There are three variables that the CLOCK
instruction can access, These are given the names TIME, DAY, and
YEAR, All are character strings with TIME being in the format:
12334356
‘and ranging trom 00:00:00 to 23:59:59, DAY being in the format:
les
and rangina from 001 to 36% (except to ibo an leap years), and
YEAR being in the format:
le
CHAPTER 5, CHARACIER STRING HAUDLING ISSTROCTIINAS = 9
and ranging from 00 to 99, being the last two digits of the year,
Note that when the TIME goes from 25:59:59 to 00: 00: 00, the day is
incremented, The new day value is not checked to be a valid
Julian date, however, implying that the system must be manually
reset at midnight at the end of the year. The CLUCK instruction
performs a character string to character string move with the
special variable in the source and the character string to receive
the information in the destination operand specification. Note
that the user’s program may have variables called TIME, DAY, and
YEAR, |
For example:
CLOCK TIME TO TIME
CLOCK DAY TO DAY
CLOCK YEAR TO YEAR
would move the information in the system variables into user
defined variables called TIME, DAY, and YI AR also,
Note that the clock value is not allowed to be updated by the
foreground interrupt during the actual transfer ot characters from
the system data into the user’s data item, However, an interrupt
could occur between the time one clock item was moved and the
next, thereby necessitating a precaution 11 both the time and the
day figure are ovtained. For example, if the time was 23:59:59
and the TIME was moved into a variable and then the foreground
interrupted and caused the clock to be incremented to the next
second, the TIME would then read 00:00:00 and the DAY woulag have
been incremented, If the DAY figure were then obtained, it would
be wrong, Therefore, when obtaining both the TIME and DAY, one
must first get the DAY, then get the TIME, and then do back and
make sure the DAY had not changed, For example:
CLOCK DAY TO DAY
CLOCK TIME TO TIME
CLOCK DAY TOD DAYZ
COMPARE DAY 10 DAYZ
GOTO TIMEOK IF ÉQUAL
- — CLOCK DAY TO DAY
TIMEDK ...
=10 DATABUS 1100
5.15 TYPE
TYPE sets the EGUAL condition it the string contained from
the formpointer through the logical length of the specified string
variable is of valid numeric format (only leading minus, one
decimal point, and aigits or leading spaces), Note specifically
that a field that is all spaces, only a decimal point or NULL is
not a valid numeric field.
Selo SEARCH
SEARCH compares one string ot characters (a key) to a series |
of contiguous variables (a list) and returns the positional number
(the index) of the matching item. The search starts at the
tormpointer of the key variable ang the forrpointer of first list
variable. Each compare through the list stops when the key lenath
is exhausted (the items do not have to be of equal lenath), If
the key matches the itemseven though the item is longer, a match
will occur, If the list item is shorter than the key, no match
pccurse The instruction must include a numeric variable |
containing the number of items in the list. The key will be
compared to each item in the list until the list length is
exhausted or a match occurs, a a |
It a match 15 found, the number of the matching variable -
(that is, its position in the list) 1s stored in the numeric
variable specified as the index and the ELUAL flag is set.
1f no match is found, the index variable is set to zero and -
the OVER flag is set,
For example:
SEARCH KEY IN LIST TU LISTEN WITH INDEX
SEARCH ACTNO UN VALIDACT TU TEM USING CLASSNO
The key and list may be of either numeric or StF ing type,
However poth the key and list items must be ot the same type as it
is not possible for a match to occur when one item is a string
variable, and the other 1s a numeric 1tem, Kegardless of the
type, only compare without ali1gnment 1s preformeda,. The list
arquement 1s the name of an item in the user”s data areas, and
defines the beginning of the search operation, As the search
progresses, one data item after another is comparea against the
key variable (using criteria similar, but not identical to MATCH)
CHARTER 5. CHARACTER STRING MASDLING INSTRUCTIONS 5-1 |
until the specified number of {tems have been compared, or a match
has been found. It is the user's responsibility to limit the
“search operation to a valid number of items, lf the number of
items specified in the search exceeds the number of items in the
user's data area, the search continues blindly until the count is
exhausted, | | |
5, | / REPLACE
— The REPLACE (or REP) instruction allows any ASCII character
in a string variable to be replaced by any other ASCII character.
The tirst variable {п the instruction contains one or more pairs
of two characters, each pair consisting of the character to be
replaced and the replacing character, The second variable is the
string to be modified , | |
ABV AR INIT "PERS"
"REPLACE ABVAR IN SVAR
REP "AB" IN SVAR
In the latter example string SVAR will have any "A" character
replaced by a "B" character, - |
ie VATABUS 1100
CHAPTER 6. ARITHMETIC INSTRUCTIUNS
| All of the arithmetic instructions have certain
characteristics in common. Except for LUAD and STURE, each a
arithmetic instruction. is always followed by two numeric string
variable names. The contents of the first variable 1s never
modified and, except in the CUMPARÉ instruction, the contents of
the second variable is always the result of the operation, for
example, 1n:
ADD XAMT TO YAMT
the content of XAMT is not changed, but YAMT contains the sum of
XAMT and YAMT after the instruction 18 executed,
Following each arithmetic instruction, the condition flags
UvER, LESS, and ZERO (or EQUAL) are set to indicate the results of.
the operation, (VER indicates that the result of an operation 1s
too large to fit in the space allocated for the variable (a result
is still given with truncation at the left and rounding at the
right, however). LESS or ZERU (EQUAL) indicates respectively that.
the content of the second variable is negative or zero following =
the execution of the instruction (or would have been in the case —
of COMPARE). | o
Whenever overflow occurs, the higher valued digits that do
not fit the variable are lost, for example, if a variable is
defined: | | |
NBRAZ2 FORM 2,2
and a result of 4234,67 is generated for that variaple, NBR4P will
contain only 34,67, E
whenever an operation produces lower order digits that will
not fit in the destination variable, the result is rounded,
Rounding on five is the next greater variable, À variable with
the FURY 3,1 would contain:
Ut. à for 46,213
810,5 for Bl2,4hH3
3,7 tor 3,0006
3,9 for 5,850
652.0 tor 4632
CHAPTER E, ARTIMMETIC INSTRUCITICNS ó=1
with the UVER condition occurring for only the last result,
Note that if an OVER occurs during an ADD, SUB, or COMPARE of
two strings of different physical lengths, the result and the LESS
condition flag may not be correct. | В
6,1 ADD
ADD causes the content of variable one to be added to the
content of variable twos
Examples:
ADD X TO Y
ADD DOG,CAT —
ADD "1", LEN
bel SUB or SUBTRACT
The SUB instruction (the compiler will also accept a mnemonic
of SUBTRACT) causes the content of variable one to be subtracted
from the content of variable two, |
Examples?
SUB RX350 FRUM TOTAL
SUB "32,5" FROM RATE
SUBTRACT Z,TOTAL
6,3 MULT or MULTIPLY
The MULT instruction (the compiler will also accept a |
mnemonic of MULTIPLY) causes the content of variable two to be
multipliea by the content of variable one, The restrictions
mentioned in the introduction about the length of multiplication
operands are that the sum of the number ot characters in the two
operands must be less than 32.
Examples:
MULT 6 BY A
MULT ". 00%" BY TOTAL —
MULTIPLY sel
bo VATANUS 1100
6.4 DIV or DIVIDE
The DIV instruction (the compiler will also accept a mnemonic
of LIVIDE) causes the content ot of the second variable to be
divided by the content of the first variable. The restriction
upon division operands is that the number of characters in the
dividend plus the number of cnaracters 1n tne divisor plus two
times the number of characters after the decimal point in the
divisor must be less than 32, Division by zero results in the
OVER condition being set and the destination variable not being
changed.
If the quotient cannot be represented fully in tre
destination variable format, the quotient will be rounded to the
number of places in the destination variable it the divisor has at
least one digit place after the decimal point, If there are no
digit places after the decimal point in the divisor, the quotient
will be truncated (rounded down) to the number of places in the
destination variable, | | |
Examples:
DIV SFACT INTU XRSLI
DIV "3,0" INTO QUANTITY
DIVIDE X3,HOURS
6.5 MOVE
MUVE causes the content of variable one to replace the o
content of variable two. -
Examples:
MOVE FIRST Tu SECOND
MOVE "0" TO COUNTER
MOVE A,t
6,6 CUN"PARE
CU:MPARE does not change the content of either variable but
sets the condition flags exactly as 1f a SUtH instruction has
OCCUrre:a.
Examples:
CHAPTER e, ANRITH=ETIC 1NSTRUCTIUNS 6" 5
COMPARE XFR# 10 YFRM
COMPARE "100" TO LINENR
COMPARE TIME1, TIME?
6,7 LOAD
— The LUAD instruction selects the numeric string variable out
of a list based on a numeric index variable, It then performs a
MUVE operation from the contents of the selected variable into the
first operand, If the index is truncated to no decimal places
vefore it is used (e.g. 0,120).
Examples
LUAD CAT FROM N UF CAT,MULT,SPACE
6,8 STURE
The STURE instruction selects a numeric string variable from
a list based on the value of a numeric index variable, It then
pertorms a MUVE operation form the contents of the first operand
into the selected variable, If the index is negative, zero, or
greater than the number of items in the list, the instruction has
no effect. Note that the index is truncated to no decimal places
before it is used (e.g, 0,1379), |
Examples
STORE X INTO NUM UF VAL,SUB, TUI
The LOAD and STORE instruction statements may be continued to
the next line by the use of a colon,
Examples?
LABEL LOAD NUMBER FRUM N OF М1, м2, №3, №4, М5 ;
| | №6, М /, МВ, №9 | -
ENTRY STORE "2,3" INTO X OF N1,N2sN3
6-4 bATABUS 1100
6,9 CHECK]
The CHECKI1 (or CK11) instruction performs a check digit
calculation (modulo 11) on two string variables. Hoth string -
varianles must consist of digits only, The first variable is the
pase number and the check digit to be validated: E.
11254171
| BASE | xm== CHECK DIGIT
The second variable is the weighting factor:
i 5 4 3 2 |
Note that the weighting factor ano the base portion of tne number
are of the same length. The weighting factor is assumed to have
the length of the base, If it is shorter, an LUS condition is set
and the instruction 1s not completed. If the weighting factor 1s
longer, only the first (n) digits are used, where (n) is the
length of the base,
The calculation is performed starting at the “form pointer of
each variable using the length = 1 of the first variable When
“the check digit value. has peen computed, it 1s compared to the
last digit of the base. If they match, the ESUAL flag is set; it
the resultant check digit does not match, tne OVER flag is set and. -
the EUUAL flag is cleared,
For example: .
CHECK11 — BASECK BY "7654327"
CK11 NMBR BY WEIGHT
The algorithm used to generate the modulo 11 check digit value isi
1) bach digit in the base is multiplieo oy the corresponding
digit in the weighting factor. |
2) The individual products are added.
$) The sum of the products is divided by eleven,
4) The remainder of the division is subtracted from eleven
giving tne check digit,
CHAPTER 6. ARITHMETIC INSTRUCTICAS he
4) A check digit with a value of 10 cannot be used and causes
the UVER flag to be set,
be 10 CHECK10
The CHECK10 Cor CK10) conforms to the same restrictions and
is performed in the same manner as the CHECK11 instruction with
the exception of the algorithm used to compute the check digit.
For examples
CHECKIO ACTNU BY "21212"
Ck10 A BY 8
The algorithm for modulo 10 check digit computation isi
1) Each digit in the base number is multiplied by the
corresponding digit in the weighting factor,
2) The individual digits in these products are added,
3) The sum ot the digits is divided by 10,
4) The remainder of the division is subtracted from 10 with the
result beina the check digit,
hb DATAÁLUS 1100
CHAPTER 7, INPUT/QUTPUT INSTRUCTIONS
The DATABUS 1100 statements that move data between the a
program variables and the terminal, printer, or disk, allow a list
ot variables to follow the operation mnemonic, This list may be
continued on more than one line with the use of a colon,
The I/U 115% may contain some “special control information
Desides the names of the variables to be dealt with. It may also
include octal control characters (000 throuah 9037), Care must be
taken in tne use of these special control characters as their use
can cause Jnpredictable results if the 1/0 device (such as the.
Servo Printer) does not have provision for them. DATABUS 1100 has
no formatting informatíon in its input and output operations other
than the list controls and that implied by tne format of the
variables, [Ine number of characters transferred is equal to the
number of characters physically allocated for the string (except
in some special cases) allowing the programmer to set up his
formatting by the way he dimensions his data variables,
7,1 KEYIN
KEYIN causes data to be entered into either character or
numeric strings from the keyboard, A single FEYIN instruction can
contain many variable names and list control items. when N
Characters are being accepted from the keyboard, the flashing ;
cursor is on. At all other times the cursor is oft,
~~ when a numeric variable 15 encountered in a KEYIN statement,
only an item of a format acceptable to the variable (not too many
digits to. the left or right of the decimal point and no more than
one sign or decimal point) is accepted. If a character 1s struck
that is not acceptable to the format of the numeric variable, the
character is ignored and a beep is returned to the console, Note
that if fewer than the allowable number of digits to the left or
right of the decimal point are entered, the number entered will be
reformatted to match the format of the variable being entered.
when the ENTER key is struck, the next item in the instruction
list is processed, | |
‘then a character string variable 1s encountered, the system
accepts any set of ASCII] characters up to the limit ot the
physical length of the string. The formpointer of the string
variable is set to one ana characters are stored consecutively
CHAPTER 7, INPUTZOUTPUT IsNSTRUCTICAS 7-1
starting. at the physical beginning of the string, when the ENTER
key is Struck, the logical length is set to the last character
entered and the next item in the keyin list is processed. If the
ENTER key is struck without any other characters having been
entered (a null string is entered), both the logical length and
form pointer of the string are set to zero, The program can check
for a variable with a null entry by checking for an EUS condition
after doing, a CMATCH instruction on the variable in question.
During a KEYIN, any unrecognizable characters (not in the printing
ASCII set) sent in from the console will be ignored and a beep |
returned, a
Zelel Displaying with KEYIN
Other than variable names, the KEYIN instruction may contain
quoted items, list controls, and octal control characters (000 to
037). Quoted Items are simply displayed as they are shown in the
statement, — | | | |
Vol.e2 List Controls
| The list controls begin with an asterisk and allow such
functions as cursor positioning and screen erasure, The #P<n>;<m>
control positions the cursor to horizontal position <n> and
vertical position <m>. Note that these numbers may be literals or
numeric variables and both positions must always be given in a *P
command, The horizontal position 19 restricted by the interpreter
to be from | to 80 and the vertical position is restricted to be
trom | to 12, Numbers outside this range have the effective value
of 80 horizontal and 12 vertical,
The *ES control positions the cursor to 131 and erases the
entire screen, the *EF control erases the screen from the current
cursor position, the *EL control erases the rest of the line from
the current cursor position, the *C control causes the cursor to
be set to. the beginning of the current line, the *L contro) causes
the cursor to be set to the following line in the current
horizontal position, the *N control causes the cursor to be set to
the first column of the next line, ana the *R control causes the
screen to roll up,
Normally, the cursor is positioned to the start of the next
line at the termination of a KEYIN statement, However, placement
of a semicolon after the last item in the list will cause this
posttioning to be suppressed, allowing the line to be continued
with the next KEYIN or DISPLAY statement. This feature is also
true of the PRINT Command, |
[=2 VATABUS 1100
Example:
KEYIN *ES, "NAME: ",NAME, *P 3521, "ACNTI Nk: "3
ACTNR," ADDRESS: ",?,STREET, *P10:3:
CITY,xPX:4, "ZIP: ",ZIP;
KEYIN "ABC", OR1,NVAR
Peal.3 KEYIN Continuous
A mode called keyin continuous is available (turned on with
list control *+ and turned off with list control *r or the end ot
the statement) which causes the system to react as if an ENTER key
had been struck when the operator enters the last character that
wil] fit into a variable, [his mode allows the system to react in
much the same way 85 a keypunch machine with a control card, a
7.1.4 BACKSPACE and CANCEL
| while keying a given variable, the operator can strike the
HACKSPACE key and cause the last character entered to be deleted,
Ihe operator may also strike the CANCEL key and cause all of the
characters entered for that variable to be deleted,
- A circular input butter allows the operator to send co
characters from the keyboard before they are requested by the —
system, ote that there is no feedback at this level as the Ва
characters are fed back only as they are taken from the buffer, ©
This buffer allows the operator to continuously enter data without
being affected by minor delays in the response of the systeme
7.1.5 úperator Interrupt Procedure
A special case of KEYIN is the interrupt procedure, entered
oy keying CANCEL with both the KEYBUARD and DISPLAY keys depressed
on the system console. Normally, when the cursor is not flashing,
‘all characters will be 1gnored (not acceptea from the circular
input nuffer) until input is requested, The exception, however,
is the interrupt characters which may be keyed at any time (it
will be postponed if a Pl instruction is in ettect) and will
result in an immediate CHAIN to the HASTER program. Thus, the
currently executing program will stop, the printer, 11 DEINQG used:
wIll be ahorted, and the MASTER program will] begin execution,
CHAPTER 7, IsPUT/UUIPUT 155IKELTIONS 7-5
141,6 New Line
Another special case of KEYIN 1s the NEW LINE character,
which is the DEL or underline character on the system console, If
this key 18 struck during a KEYIN statement, the current variable
1s terminated as jf the ENTER key were struck and all subsequent
variables in the statement will pe set to zero or their
tormpointers and logical lenaths set to zero depending on whether
they are numeric or string variables, Control! will fall through
to the next DATABUS 1100 statement,
Tole? KEYIN Timeout and Pause
The list control, XT, may be included in the KEYIN statement
causing a time out if more than two seconds elapse between the
entry of two characters, The time out has the same results as if
the NEW LINE key had been struck,
The list control, *W, may be included in the KEYIN statement
causing a one second pause at that point in the list sequence,
This control is especially useful in programs which wish to simply
pause for a number of seconds, Any number of seconds of pause may
be achieved by putting in the required number of *w controls in
tne list,
7.1.8 Echo Control
The list controls *EOFF and *EUN may be included in the KEYIN
statement causing the echo of entered characters to be inhibited
or enabled respectively. when echo is inhibited, the KEYIN
statement causes only the characters specifically mentioned in the
list to be displayed on the console, Therefore, the statement:
KEYIN *EOFF,INLI-VE;
would allow the variable INLINE to be entered from the keyboard
with absolutely no characters being displayed at the console,
Since the cursor display at the console will not be enabled, there
will be no indication in this case that input is being requested.
his feature could be used where passwords are to be entered and
it is desired to suppress their display. In this case, the
statement: = 5
KEYIN XEOFF »2P1 210, "ENTER PASSWORD: ":
022;,PASSWURD, 024
[=i DATABUS 1100
could be used. Note that even though echo is Inhibited, the | |
cursor positioning and literal characters are still displayed on
the console since they are specifically mentioned, Notice also
that the carriage return ang line feea will be sent at the end of
the statement since a semi=colon is not supplied, The 022 |
character 1s a cursor on ang the (24 1s a cursor off for the
system console. The cursor controls must be specifically
mentioned since the echo inhibit prevents them from being sent
automatically, The echo is always enabled at the conclusion of
the KEYIN statement, Therefore, one must always inhibit tne echo
at the start of each statement in which no echo 1s desired,
1.1.9 KEYIN Format Controls
Numeric and String variables in the KEYIN may be preceded by
à format control function which can change the justification —
and/or fit! control normally performeu during KEYIN,
The special KEYIN controls apply only to the variable
following in the KEYIN statement. |
Ihe *JL control leftejustifies numeric input ana zero=fills at
right if there is no decimal point entered from the terminal,
KEYIN x JLo NVAR
The xJK control right=justifies String input and blank-fills at
left. o | Е
KEYIN — *JR,SVAR
The *ZF cantrol performs zero=fill on String entry, ‘Characters
that normally would be supplied as blanks are supplied as ASCII =
zeroes. - | Но
KEYIN *LF,SVAK
The combination of *ZF and *JkR is valia,
KEY Li AF px JK SVAK
The DE control can be used to restrict String input to digits
only (0=9), A non=diagit will not be accepted at the keyboard.
KEY IN XÍE ,SVAR
CHAPTER 7, InPUL/)UTRUT INSTRUCTIONS De
1,.1,10 Text Input
The keyboard input can be programmed for text input through
the use of the *1T and *IÑ controls. The control *11 is used to
turn=on the text input mode. This converts all alphabetic
characters to shift case as on an office typewriter, The keyboard
remains in the text input mode until the control *IN returns the
keyboard to normal mode, В | | |
KEYIN —»*1T,SVAR,*IN
7.2 DISPLAY
DISPLAY follows the same procedure as KLYIN except that when
a variable name is encountered in the list following the
instruction, the variable’s contents are sent to instead of being
requested from the console, Character strings are displayed
starting with the first physical character and continuing through
the logícal length. Spaces will be displayed for any character
positions that exist between the logical length and physical end
of the string unless the *+ mode (keyin continuous in the KEYIN
instruction) is active, in which case no more characters are put
out after the logical length, Numeric strings are always
displayed in total, Quoted strings, list controls, and octal
control characters may be included in the display instruction and
are handled in the same manner as described for the KEYIN
instruction. Note that the xT, *EON, and *EOFF controls will
simply be ignored in the DISPLAY statement,
Examples:
DISPLAY *P5:1,"RATE: ",RATE:
APS22, "AMOUNT: ",AMNT
DISPLAY "ABC",021,5817 |
1,35 ВЕЕР
SLEP causes a beep to be sent to the console,
Example:
BLEP
76 DATARUS 1100
[etd PRINT
LATABUS 1100 supports either one local printer or one Servo
orinter, depending en printer availability,
fhe PRINT instruction causes the contents of variables in the
list to be printed in a fashion similar to the way DISPLAY causes
the contents of variables to be displayed, The list controls are
much the same as DISPLAY except that cursor positioning cannot be
used, column tabulation 1s provided (*<n> causes tabulation to
column <n> ) and *F causes an advance to the top of the next form,
Uctal control! characters may also be included in the print
instruction, The PRINT statement may ne continued on more than
one line by the use of a colon,
Examples:
PRINT DATE, x20," TRANSACT TUN SUMMARY", XL , XL:
MIAME p&p x JU, RATE p 220 p HLURS , % 402 о
АМТ, xi
PRINT "АНС", 021,51;
The control character, *ZF may be used before any numeric -
variable to cause zero fill on the left, moving tne sign to the
left if necessary. The tabbing in the PkINT statement can move
the carriage in the reverse direction and any sequence of printer
controls will be executed in precisely the sequence specified.
For example, one could print 10 characters, tab back to column 5
and overprint that column, do one line feed, ana print five |
characters which would appear in columns 6 through 10 under the
first line. Une could tnen ao a form teew ang orint 10 more ‘
characters which would appear in columns 11 tnreugh 20 at the top
of the next page. | |
1+ the servo printer is being useg, the parer out condition
will be checked whenever a top of form control 18 given in a PRINT
statement, If, after the top ot form function 1s performed, the
paper out condition is present, the console will make a uniquely
characteristic beeping sound (morse coge "P") to alert the system
operator that more paper must he placed in the printer, lhe
heeping sound will stop when the front cover af the printer 1s
swung out but will resume 1f the cover is replaced to its original
position with the paper out indicator still on. Ihe recommendea
Procedure is to open the frant cover, remove the last form still
CHAPTER /. IsPUTZ/GUIPUT I4STKUCT 10145 Lei
in the printer, place new paper in the printer with the top of the
torm aligned with the print head, and finally close the front
cover, | |
Another feature allowed with the servo printer is minor
vertical spacing (there are eight minor vertical spaces for one
standard line space), Control characters given directly in the
PRINT statement and can cause the paper to be fed either up or
down up to seven minor vertical spaces, The characters zero
through seven (in binary value) cause the paper to be fea down the
page (the normal spacing airection) a corresponding number of
minor spaces, The characters eight through fifteen cause the
paper to be fed up the page (opposite to the normal spacing
direction) zero through seven minor spaces respectively, The
characters sixteen through twenty=two cause the carriage to move
to the left seven through one column positions respectively
(horizontal minor positioning cannot be performed), The character
twenty“three causes no printer action, The characters twenty four
through thirty one cause the carriage to move to the right one
through eight column positions respectively, This feature on the
servo printer allows different kings of underscoring and super”
and/or sub=scripting in the printed output, Note that it 1s the
user's responsibility to keep track of the carriage |
micro=position,
7.5 Disk 1/0
DATABUS 1100 allows a large variety of file structures and
access methods, The structures can be dependent upon the physical
sectoring of the disk, ohysically sequential, or logically
indexed, The access methods can be physically random, physically
sequential, logically random, or logically sequential with any mix
of these being allowed on logically indexed files, This section
will describe the various file structures that can be created, how
positioning is maintained within these structures, and how access
‘to desiren information within the structure can be achieved, It
will then describe the various operations that can ое performed
upon the information within the file. ©
7.5.1 File structures
“The most basic structure within a file is a physical record.
A physical record can contain at most 251 data characters (note
that there is no decimal number compression within any of these
file structures so a number always occupies the number of
characters that are contained within the FURM which defines the
number), A physical record corresponds to exactly one physical
zh VATABKUS 1100
sector on the disk and is always terminated by a U03 character,
The next level of structuring is a logical record. Depending
upon the way the user structures his tile there may or may not be
an integral number of logical records witrin a physical record. A
logical recora 1s terminated by a 015 character after which
another logical record begins, Note tnat logical records can
extend across physical record boundaries (terminated by 005
characters) so that a file witn logical records may appear in the
first two physical records as follows (the items in parentheses
are the logical and physical record termination characters):
01128550382 AASDFGRERKFKDSKA (015) 12354646 (003)
6483 LAKSIDFLKASUFKAJ (015) 48828388483 KI (003)
Note that the first logical record extends about two thirds of the
way through the first physical record and is then terminated by |
the U15 cnaracter, The first seven characters of the second
logical record are also contained in the first physical record at
which point the first physical record is terminated, The rest of
the second logica! record extenus about half way through tne |
second physical record and is then terminated by the 015 _ | |
character, . At this point the third logical record starts and so
оп. - | | |
Also note that there is no restriction upon the length of a
logical record (a sinale logical record may extend across many
physical records) but that it is a good 1gea to keep logical
records reasonably short to prevent them from tecoming hard to
deal with, If it is wanted to keep only one logical record per
physical record then make the file appear as follows:
01128558382 AASDFQNERKEKDSKA (015) (005)
123453488484 LAKSJDFLKASOFKKJ (015) (605)
48BEC253B84R3 KILKJLKJLKSJDFKU (019) (703)
ote that it took more disk space to store the same amount of
information in this case than in the previous case. lt is
sometimes desirable to give up this space in return for the
capapility of using the fastest accessing method of directly
accessing nnysical records, À structure which allows logical
records to cross physical record noungartes 18 Called a record
compressen structure, |
In some data files large numbers of contiguous spaces appear.
[nese files can be compressed even furtner tnan simple use of
record compression by the use of space cornressiaon (the general
CHAPTER Jo TNFUTZUJTRPLT lus TRGC TICS — [y
purpose LUS editor, the DOS SURT program, a number of the terminal
emylator programs, the DATABUS 1100 compiler (listing file
output), and DATABUS 1100 programs can all generate space
compressed records), A space compressed structure appears much
like a record compressed structure except for the addition of the
Jil control character, This control indicates that the next byte
is a positive 8=bft binary word which tells how many spaces were
replaced by the compression code character pair, This number will
never be less than ¢ (since it is wasteful to expand one or zero
spaces into two characters) and may be as large as 255, In
addition, the 011 will never appear as the last character in a
physical record since the character indicating the number of
spaces will always appear after the 011 (otherwise the 003
indicating the end of the physical record and three spaces
compressed could not be differentiated), For example, in the
following a logical record is shown first without space |
compression and then with space compression: |
NOW 18 THE TIME FOR (015)
NOW IS THECOL1)(O02)TIMECO11)(CO0O7)HOR (015)
The second record is physically shorter than the first by six
characters, It may seem silly to compress two spaces into a two
character compression code but most programs do this because it 1s
logically simpler to program, If more than 255 contiguous spaces
appear in tne data record, multiple space compression codes will
appear. Space compressed records are most useful where large
numbers of spaces appear in the file (as in print files) and where
the records ‘are not to be modified in place, If the record is to
be moaified in place, space compression is discouraged since the
number of spaces could change and the physical length of the
logical record could change,
A file which can be accessed physically sequentially must not
nave any physical records without the proper format between the
beginning of the file and an end of file mark, The end of file
mark always starts at the beginning of a physical record and
contains exactly six 000 characters followed by the physical
record termination character (003), The rest ot the characters in
the physical record are of no significance, Note that if there
are no physical records besides the one containing the ena of tile
— mark, the file would be null (wnich is a valid condition for a
- file). | | |
A physically sequential gata file can be logically indexed,
ne cannot tell that a file is incexed by looking only at the data
file since the indexing information 1s maintained 1п a separate
[=10 DATABLS 1100
file called the index file (and usually of DUS extension IST).
The index file contains the name and extension of tne data file
which it indexes ang a set of keys and pointers which relate the
key value of a logical record to its physical position within the
data file. DUS utilities exist for the creation of the index file
which must always be performed outside of the DATABUS 110
interpreter,
The 1noex file is a n=ary tree where n is determinec by the
length of the key and uhere there are enouuh levels to make the
top node in the tree always fit within one disk sector (contain at
most n branches), (ine can conservatively estimate the number of
sectors that will be used in the index file by the following
method, The actual number used may be less because trailing
spaces in keys are discarded and more than the minimum number of
keys may f1t 1m a sector,
To compute tne index file length, divide 259 py the key
length plus / and discara the remainder (do not round up the
result), This number should then pe divided into the number of
logical recorus to be indexed and the answer rounded up (if the
remainder 1s non-zero then add one to the answer and discard the
remainder). Save this number which is the number of sectors at
the lowest level ot the index tree, Then divide 250 by the key
length plus $ and discard the remainder, This number should then
be divided into the number saved betore the previous step and the
answer rounded up, Save this numper which 18 the number of a
sectors at the next higher level of the index tree, If the answer
produced is greater than one, repeat the previous step (oividing
050 divided by the key length plus $ into the previous answer).
«hen the answer has been reduced to one, total all of the numbers
of sectors required for each level ana the result will be the
total number of sectors required in the index file. |
For example, assume that the gata file contains 1U000 logical
recoras and the. key is 10 characters long, The first computation
is 220/(10+7) = 14,/1 or 14 discardina the rerainder. Ihe next
computation 18 10000/14 = 714,29 or 715 rounding up. Therefore,
the lowest level of the index tree will require 715 sectors, The
next computation is 250/(10+3) = 19.25 or 19 discarding the
remainaer, lhe next computation is 7/15/19 = 37,65 or 38 rounding
Upa. Therefore, the next higher level of the index tree will
require an additional 38 sectors. Ine next computation 15 58/19 =
2,UU or 2 rounding up, Therefore, the next hianer level of the |
index tree will require an additional ¿2 sectors. The next
computation is 2/19 = 0.11 or 1 rounding up, Since one sector has
been reached, the totals are macge: 715+384+/41 = 756 sectors for
CHAFTER de INPUTZUOTPJT TESTU TIS mil
the entire index tree,
Do De 2 Positioning and accessing.
In DATABUS 1100, all files are referenced by way of logical
files, These files are declared in the data area of the program
using the FILE and IFILE declarations, The declarations relate a
logical file to a certain physical file that is specified by the
UPEN or PREPARE statement performed upon the logical file, The
data space used by the declaration holds all of the physical
position intormation needed for that particular file. During file
operations, DATABUS 1100 establishes a position within the file
using a specified access method and then increments this position
based upon the operation specified,
For physically accessed files, a file position is defined by
a physical record number (0 through the maximum number of records
in the file) and a character pointer within this record (1
through 249). when the file is initially opened (with OPEN or
PREPARE), the physical record number is set to 0 and the character
nointer is set to 1, All read and write operations sequentially
increment the character pointer as the individual characters are
read or written. If the physical record terminator (003) is
reached during a read or the 249th character is written during a
write, the character pointer is reset to 1 ana the physical record
number is incremented (when writing, a physical record terminator
is automatically written after the 249th data character before the
physical record is written out to the disk and movement on to the
next physical record is made). If an end of file mark is written,
the current physical record 15 terminated, the physical record
“number is incremented (unless the position was at the start of a
physical record when the operation was entered), the end of file
mark is written in the first seven characters of the new physical
record» and the character pointer is left at 1,
The character pointer may be set directly by what 1s called a
tab operation in some disk 1/0 statements, WRITAB, UPDATE, and
all read operations may contain these positioning operators. When
physical access is being made to the file, the tab position given
in the statement is relative to the beginning of the physical |
record. hen indexed access is being made to the tile, the tab
position given in the statement is relative to the beginning of
“the logical record, Note that when tabbing relative to the start
of a logical record, it is an illegal operation to tan past the
end ef a pnysical record, Therefore, when using tabs in indexed
7-12 DATABUS 1100
tiles, there should always be an integral number of logical
records per physical record to prevent taboing past the end of a
physical record, Note that tabning may not be used when physical
access is being made to a file declared as indexed. lo do tabbed
physical accesses to the file as well as indexed accesses, declare
two logical files to the same data file; one to be used for
physical accesses (having peen declared using the FILE directive)
and the other to be used tor indexed accesses (having been
declared using the IFILE airective),
Ahen an indexed file is being used, two additional pointers
are kept for the logical file. The first is a pnysical record
number and character pointer to tne first character of the last
logical record accessed using the index. Tne second 1S a pointer
to the next sequential key after the last key accessed using the
index, The first pointer enables re*reads anú updates to be made
to the indexed file and the second pointer enables tne indexed
file to ne accessed sequentially by key. “Note that neither of
these pointers is changed when a physical ACCESS 15$ mage using the
logical file,
An additional counter maintained for all logical files is the
space compression counter, = This counter is used in the
‘decompression of spaces during read, the compression of spaces
during write, and as a flag as to whether or not space compression
1s to be performed during a write (decompression will always be
performed by the read). It js suggested that the reader come back
and read the tollowing paragraph closely after he feels he
understands the disk read and write access methods and operations
since some of these ideas are referenced in the following section.
Une must understand the following section ta be able to
effectively deal with space compressed files.
When the space compression counter has a value ot =| during
write operations, spaces will not pe compressed in the output,
The counter value 1s set to 0 when the file 1s initially opened
(using OPEN or PREPARE) and at the start of a physically random or
Indexed access read operation or when a *+ control in a write
operation statement is encountered. Ihe counter value is set to
“1 when a physically random or inaexed access write operation is
performed or when a *= control in a write operation statement is
encountered, Therefore, space compression will be on at the
beginning of a pnysically sequential write that occurs as the next
operation after the file has been opened or a read operation of
any kind has been performed, space compression will be off at the
beginning of any physically randor or inde.ed access write
oneration, and the status of space compression «ill not be changed
CHAR TE i fe InPLT/UTPUI Tha TRULT IONS f=15%
7
by any other operations, lf the cesired space compression mode
for a write operation is not obtained by the above rules then the
A+ and *= controls will have to be used to get the desired mode.
Note that these controls can erase the memory of previously
accumulated spaces if used after the beginning of the statement
list while spate compression has been on, |
/+5.2.1 Physically Random Access
The fastest random access method available under DATABUS 1100
is physically random access, To perform a physically random
access, a numeric variable containing a positive number is
supplied as the recora specifier to the statement, Any fractional
part of this variable will be truncated and then the physical
record number will be set to its value, The character pointer
will then be set to one and the read or write operation will
proceed, Unfortunately it is often hard to find a map from a key
value in the data records to a fairly contiguous set ot numbers,
necessatating the use ot an index structure, However, if such a
map can be found, physically random accessing imposes lower
overhead than the indexed accessing,
75.2.2 Physically Sequential Access
Une can cause the read or write operation to simply pick up
where the physical record number and character pointer are
currently positioned by specifying a numeric variable with a
negative value in the record specifier, Usually, when a read or
write operation is finished, it leaves these pointers at the
beginning of the next logical record, However, a read or write
operation can be parameterized (by placing a semi-colon at the end
of the variable list) such that it will simply leave the pointers
after the last character dealt with, In this case, the physically
sequential access can be used to continue a previous operation
from where that operation stopped. The previous operation could
have used any access method (including this one) which implies
that one can continue a logical record to any length. However, it
is often a good idea to keep logical records reasonably short to
nrevent them from becoming hard to deal with. Note that the SORT
and INDEX utilities require the key value to be within the first
255 characters of a logical record,
14 DATABUS 1100
[252.3% Indexed Access
As described in the previous section, a data file may have an
associated index file which associates key values to physical
record number and character pointer values, There are five basic
indexed operations: read a record of a given key value, read a
record of the next ASCII] sequential key value, update the record
that was last accessed through the index, insert a new record of a
given unique key value, and delete a record of a given key value,
Since there can be any number of indexes into one data file, the
insertion and deletion operations will have to perform key
insertions and deletions upon all indexes. Therefore, these
operations will nave to be performed once for each index that
points to the data file,
For the indexed read and write operations: once the indexed
access has been performed (the physical record number ana a
character pointer values have been set), the actual operation is
performed identically to the operation as performea for physical
accesses, Ihe one exception is when a record 18 being inserted,
Since records are always inserted at the physical end of the file
a new end of file mark must be written after the inserted record
has been written. In this case, a flag is set so that when the
write statement has been finished (and it has not been specified
that the write operation is to be continued), then the ena of file
mark will automatically be written, This automatic end of file
mark writing operation will not ne performed if the write
operation is to be continued, thereby making it the responsibility
of the DATABUS - 1100 program to write the end of file mark. when the
record has finally been written in its entirety,
The indexed access using a given key value will cause at
least one disk sector to be read for each level in the ingex in
addition to whatever disk functions are required to perform the
actual read or write operation. If records have been inserted
into the indeŸ and the INDEX utility has not been run since then,
additional disk sector reads may take place depending upon the
length and path of the linked list at the lowest level in tre
index, Therefore, when many Insertions are being performed the
INDEX utility should be run as often as 1s practical to keep tne
access time trom becoming overly large. Also, «Per a data nase 1S
being initialized, it is not a ood 1dea Го была 1t from a null
Ingexed file doing insertions. It would ne much more efficient to
burla the data base physically sequentially as long as indexed
accesses neeu not be made to 1t and then create the index file on
CHAP TE K РГ, ТРИО ТРО LOST TIL fm 15
a reasonably large data file after which additional insertions can
then be marie using the insertion facility,
/45.244 Physical] Access to Indexed Files
Hoth physically random and sequential accesses may be made to
indexed files, Therefore, a file can be indexed only on primary
records and the rest of the records obtained using physically
sequential accesses, A file which is already physically randomly
accessed may have an index added based on some other key value for
fast access to other aspects of the file, If the file has been
declared as indexed (using the IFILE directive) then all access
methods may be used upon it. However, if the file has been
declared as noneindexed (using the FILE directive) then only
physical access methods may be used upon it,
7.5.3 PREP or PREPARE
PREPARE (the compiler will also accept a mnemonic of PREP) is
used to create a new file under the DOS file structure, The name
used for the DOS file name is given in the string variable or
literal specified in the PREPARE instruction. The characters used
for the name start from under the formpointer ot the specified
variable and continue until either the logical end of the string
‘has been reached or eight characters have been obtained, (If the
item is a literal, the formpointer is one and the logical length
points to the last character.) If the end of the string is
reached before eight characters are obtained, the rest of the
characters are assumed to be spaces, All data files used in
DATABUS 1100 are of extension TXT. The character after the 8th in
the name variable or the character after the logical length, if
the name is less than 8 characters, is used as the drive number
for that file, lf the character is not an ASCII 0, 1, 2, or 3 or
no character physically exists past the name, no drive
specification is assumed and all drives starting with drive zero
are searched when looking for a name in the directory or
directories, Utherwise, only the drive specified 1s searched.
If the file already exists (and is not delete or write
protected), it is deleted and a new file created, If the file has
any protection or the drive specified is off line, an IU error P
or ™ respectively will occur,
716 DATABUS 1100
VATARUS 1100 always deals with "logical tiles" once they are
opened with either the PREPARE or OPEN instructions, Any number
of logical files can be openea at one time, the limitation being
the amount of space the user has available to devote to the data
space needed by each logical file that 1s declared, Ihe logical
tiles are declared using the FILE or IFILE instructions (see
Section 5.1), NOTE: The PREPARE instruction can only create a
file that has been aeclared as a FILE type, lhe compiler will
flag an attempt to PREPARE a file that has рееп declared as an ©
IFILE type, FILE type files myst be createa by use of the INDEX
Jtility running under the DOS. —
For example, let the following definitions be made:
FDECL FILE
ENAMEL INIT "FILE"
Fi AME 2 INIT "FILEZ 1"
РМАМЕ 3 INIT "ASUFF ILE $2"
Let the formpointer and logical length of FNAMEL be 1 and 5, that
ot FNAMEZ be 1 ana 9, and that of FNAMES be 5 ana 9, Then if the
statement: | | |
PREPARE FOECL ?,HNAMET
were executea, the file FILE1/TXT would be prepared as logical —
file FDECL on the first drive (beginning with drive 0) on which
space was available, 1f the statement: | |
PREPARE. FOECL?,FNAMEZ
Jere executed, the file FILE2/TXT would ce prepared as logical
tile FOECL on arive 1, If the statement: SR
PREPARE FDECL,FNAMES
were ‘executed, the file FILES/TXT would be prenarea as logical
file FOECL on drive 2. If the statement: |
PREPARE FUECL, "ASDF"
“ere executed, the file ASDF/IXT would be prepares as lonical file
Fit Ll. on tne first drive ON which space vas available. If the
statement:
PREPARE FOECL, "unt R y"
СНАРТЕК 7, INPUT/UUTPUT INSTRUCTICAS id
were executed, the file UNER/TXT would be prepared as logical file
FUECL on drive 3,
If the logical file specified is already open (having been
specified in a previous PREPARE or UPEN instruction and not since
in a CLUSE instruction), the old file will be closed before the
new one is gealt with,
when preparing a very large file a program should be run to
write a dummy record into the largest record number, This will
cause the 005 to allocate all records up throuah the one accessed
In as physically contiguous a manner as possible, thus increasing
the speed with which the file may be randomly accessed, Note that
the use ot the DOS implies that a file must be contained on one
drive. If the writing of the gummy record tries to extend the
file past the amount of space available on tne disk, an error k
will occur,
Kemember that Space compression mode for writing 1s left on
by a PREPARE instruction. я
145.4 OPEN
OPEN causes a DUS file alreaqy in existence to be prepared
for use by the DATABUS 1100 program. Except for the fact that it
deals only with files already in existence (giving an IU error if
the name specified cannot be founa and not killing the file 1f 1t
already exists), OPEN works in a tashion similar to PREPARE, In
addition, UPEN may specify a file that has been declared as an
IFILE type (indexed sequential), In the IFILE case, the extension
of the name supplied in the literal or string variable is assumed
to be 151 instead of TXT (the IS] file header contains the name of
the data file it indexes), The opening of the [51 file
automatically causes the data file indexed by the 15S] file to be
opened, If the data file is indexed by more than one index file
(15] file) then each of the indices must be opened using a
ditferent logical file for each one, (When dealing with indexed
files, the data file itself is never explicitly specified since it
is automatically specified by the header of the ISI file that 1s
openea,) For example, if the following logicel files were
declared:
FDECLI FILE
FUECLe IFILE
HDECLS IFILE
and a data file FILEL/TXT existeca and the ISI t1les FILE1/ISI and
le DATABUS 1100
FILEJA/ISI had heen created using the IWLEX utility as follows:
INDEX FILE1:1=5
IDEA FILEL,FILELA; b= =10
and the following OPEN statements were executedg:
OPEN FDECLI,"FILEL"
UPEN FOECL2,"FILE1"
OPEN FDECLS;"FILEIA"
then the logical file FDECL1 would be opened to the normal
(physical access) file FILE1/IXT, the lonical tile FUECL? would be |
opened to the indexed file whose index name was FILF1/ISI and =
whose data file name (as specifieg in the FILE1/ISI header) was
FILEÍ/IXT, and the logical file FUECL3 would be opened to the
indexed file whose index name was FILELA/1SI ano whose data file
name was FILELI/TXT. This would Give physical access plus access
via two different inaices into the gata file FILLEI/TXT, Note that
an IS1 file does not have to reside on the same disk as the data
file that it indexes,
Remember that space compression mode for writing 1s left on
by an JPEN Instruction . | К
7.5.5 CLOSE
CLUSE closes the specitied logical file, This insures that
any newly allocated space that was not used in the file will be
returned to the LUS tor allocation to another file, |
Example:
CLOSE FECL
If only reads or updates were performed on the tile, the CLLSE
instruction does not need to be used, Also, a CLUSE is
automatically pertormed when one opens or prepares a logical file
that is already open. when a CHAIN 1s performed, all files that
are currently open are automatically closed without space |
deallocation being performed. Note that this means files cannot
De held open across procram chains. Also, if the interrupt key 15
struck a chain 1s autoratically invoke:i meaning that all files
4111 pe closed without space deal location.
CL:ISE 1s also usea to delete a file fro: the MiS file system,
bt a FEV 1s performed on a logical file and the next operation
CMARIER Ze dur T/UUTPUT TINSTRUCTICGNO f=19
performed upon the logical file is à CLUSE, the file described by
the logical file declaration will be deleted from the DOS file
system, | | В |
7.5.6 READ
READ performs all file data reads (physically random,
physically sequential, indexed random, tabbed or not) except for
indexed key sequential reads, The READ statement format consists
of a logical file declaration name, a record specifier variable
(numeric or string), anda list of variables to be filled by the
data from the record. The list may also contain tab indicators
which can specify that only certain portions of the data record
actually be read into the variables listed, Tabbing ís a DATABUS
1100 feature which can eliminate unwanted data transfers from and
to the disk controller buffer and can allow the programmer to save
considerable space in his data area, It can only be used,
however, when the logical records do not cross physical disk
sector boundaries, This condition can usually be enforced through
the use of the REFORMAT utility and careful use of the DATABUS
1100 write instructions,
| When data is transferred from the record into a numeric
variable that is specified in the READ statement list, the number
of characters corresponding to the length of the variable are read
in. Any non*leadina spaces read will be converted to zeros (e.g.
s3sdsl, where s stands for a space, would be read as 830201), If
a non=numeric character other than a negative sign as the first
nonespace character, decimal point, or space is read, a FORMAT
trap will occur. A FORMAT trap will also occur if the variable is
dimensioned to one and the character is a negative sign, A FORMAT
trap occurs if the data does not match exactly the format of the
numeric variable to be read, For example, if X was dimensioned to
4,2 and the characters read were 77778677, a FORMAT trap would
occur since the digit B appeared where a decimal point appeared in
the variable, If a FORMAT trap occurs during a reads the logical
file pointers are left pointing at the current file position
before the read was attempted,
If a numeric variable to be read includes a "minusroverpunch"
character, the variable is converted to the normal numeric format
with the minus sign preceeding the first non=blank digit.
when a string is read, the number of characters corresponding
to the physical length of the variable are read into the variable,
The formpointer is set to one ana the logical length is set to
point to the last physical character in tne string,
IQ NATABUS 1100
If the end of the logical record is reached before all
variables in the list have been read in full, and the variable
which is being filled with data »nhen tne EDK is detected is a
String, 1t will have its logical length pointer set to the last
cnaracter entered before the EUR was reached and the rest of the
characters physically in the string paddeo with spaces. Note that
this fact can be used to advantage when reading sequential space
compressed files, Remember that the trailing spaces in such file
records are not written and that the DISPLAY and PRINT statements
Can be force: to outnut only up througn the character being
pointed to by the logical length (using the *+ control). These
features can be combined to make listing sequential files on the
terminal or orinter much faster ny the deletion of trailing
spaces, ;
Ihe above discussion deals with the action taken when the ena
of the logical recora is reached while reading data into a string’
variable, If the data is being read into a numeric variable, the
rest of the variable is padded with either spaces OF Zeros as
appropriate, Note that if one of these locations within the
variable is the decimal point, a FURMAJ trap will occur.
11 the list contains more variables after the one being
tilled when the end of the touical record 1s detected, these.
variables will either be set to zero (if numeric) or have their
loaical lengths and formpointers set to zero.
If tne list 18 exhausted before the logical end ef the record
is reached, two actions can take place, If a semicolon is placed
at the end of the list, the file pointers are simply left after
the last character read so a subsequent I/! operation will pick up
where the pointers were left, 1f a semicolon is not placed at the
end of the list, the file pointers are advanced until they are
pointing after the next logical end ot record marker so a —
sunsequent I/U operation will pick up at the start of the next
logical recoru.
A RANGE trap will occur and the logical file pointers will
not be changed if an attempt is made to read a record which has
never before been written, (note that tne LOS RANGE or FURMAT
traps will noth cause a VATABUS 1100 KÁNGE trap ama that the
DATABUS 1100 FUKMAT trap has nothing to do with the DIS F£ORMAT
trap.)
Ihe following is a list of the different types of REAU
statements, In the examples, the variable kn 1s a positive
numeric item, SEN is a negative numeric item, KEY is 8 NnonN*tNUl]
CHAPTER 7. IsPUI/UUIPUR LaSTROL TIMING A
string item, NULL {is a null string item, FNDECL is a FILE |
declaration name, FIDECL is an IFILE aeclaration name, and FDECL
is either a FILE or IFILE declaration name,
7.5.6.1 Test for End Of File
| Before discussing the READ operations, the end ot file
indicator should be discussed. The UVER condition flag being set
indicates that a REAL operation has run across an end of file mark
on physical accesses or has accessed a non=existent key om indexed
accesses, The test for the UVER condition should be made after
the READ statement. For example:
READ FDECL,SEQFA,B,C
6010 LABEL IF OVER
if an end ot file is read on physical accesses, the variables in
the statement will be set to zero or have their logical lengths
and formpointers set to zero depending upon whether they are
numbers or strings respectively, Note that the OVER condition
will also be set if a semicolon appeared at the end of the READ
list, The way the READ mechanism works, whenever an end of file
mark is found the file pointers "stick" at the beginning of the
mark and spaces are supplied for all characters requested to fill
variables, Therefore, if one continues to perform READ operations
ignoring the fact that the (OVER condition flag is being set, the
READ operations will simply continue to set the OVER condition
flag and clear or zero all variables. This. is also true of READ
operations whose lists are terminated by semicolons,
The OVER condition being set after an indexed READ operation
indicates that the KEY specified could not be found in the index.
For a READKS (read key sequential) operation, the OVER condition
being set indicates that the last record in the sequence has been
read and the current operation tried to read a nonvexistent
record, See the relevant sections that tollow for further |
information on indexed operations setting the OVER condition flag,
REAL FDECL, Riv A161 C
[his is a physically random access read, The physical record
Pointer 15 set to the value of kN and the character pointer is set
to the beginning of the physical record (any digits after a
decimal point in RN are truncated).
[me DATABUS 1100
‘discarded since the operation leaves the file pointers pointing to a
the beginning of the following logical record.
READ FDECL,RN:A,B,C;
This is similar to the above operation except that the file
pointers are left pointing to the character after the last one
read into the vartable C. This enables another 1/0 operation
(write as well as read) to continue from the character after the
last one loaded into the variable C,
READ FDECL,SEQ7/A,B,C
This is a physically sequential access read, Variables A; Br
and C are read from logical file one beginning at the position
indicated by the current file pointer values, The file pointers
are left pointing to the beginning of the following logical
record,
READ FOECL,SEG?A,B,C;
This is similar to the above operation except that the file
pointers are left pointing to the character after the last one
read into variable C, This enables another 1/0 operation (write
as well as read) to continue from the character after the last one
read into the variable C.
READ FDECL, ZERO: ;
Assume that the numeric variable ZERO is defined to be a zero
in value. This operation would then cause the file pointers to be
positioned to the physical beginning of the file exactly as if a
PREPARE or OPEN instruction had just been performed, This implies
that space compression will be on if a WRITE is then performed,
and the user must turn off space compression if it is not desired,
READ FDECL,RN;A,*100,B,4NVAR,C,*50,D3
| By including the tabbing controls in the read statement list,
selected positions may be read from a record without having to
read all of the positions in the record. The list controls
* (numeric literal) or *(numeric variable) are used to position the
character pointer to the specified character position in the
specified physical record and may appear anywhere in the líst.
Reading for the rest of the list (unless another positionine
control is encountered) begins at the character position specified
by the positioning list control, Note that tabbing in physically
CHAPTER 7, INPUT/OUTPUT INSTRUCTIONS T=23
random access reads is allowed only upon logical files that have
been declared using the FILE directive (since the tab values are
biased by the starting point of the last index accessed record on
reads using a logical file that has been declared using the IFILE
directive), | a |
Tab positioning in physically random access read operations
{is calculated from the first data position of the physical record
specified, If the tab position is greater than 249 characters, an
IO trap will occur, When reading 4s completed, the character
pointer is moved to the beginning of the next logical record if
the statement list is not terminated by a semicolon. If the list
is terminated by a semicolon, the character pointer is left
pointing one character position past the last character read.
Note that tab positioning in a physically random access read
operation will inhibit the ability of that operation to detect an
LOF mark that may be in the given sector, Either a non=tabbing
read can be performed first (to determine whether an EOF exists in
the sector in question) followed by the tabbing read 1f the EOF
was not found, or the programmer can invent his own EOF marking
convention (which will mot require double reads),
The above example would set the physical record pointer to RN
and the character pointer to one and variable A would be read,
The character pointer would then be set to one hundred and
variable B would be read. The character pointer would then be set
to the value contained in the numeric variable NVAR and variable C
would be read, The character pointer would finally be set to
fifty and variable D would be read, The character pointer would
be left pointing after the last character read into variable D
since a semicolon appears at the end of the list,
Note that for physically random access reads, it is generally
a good idea to place a semicolon at the end of the list {f the
next read will involve an access to a logical record other than
the one which appears next physically. The reason for this {8 —
that there is no need to require the processor to scan the rest of
the logical record tn an attempt to place the file pointers at the
beginning of the next logical record when that placement will not
be used, This is especially helpful if the read does not leave
the character pointer near the end of the logical record as would
often be the case where tabbing is being used.
Note that using the read tab on physically sequential access
reads (where the record number specified is a negative value) is
possible but not advisacle. Tab positioning on physical accesses
724 DATABUS 1100
is always calculated from the first character position in the
current physical record. The program could obtain characters from
a previous or following logical recora {f tabbing {s used in a
file where the relationship between logical amd physical record
boundaries is not known,
READ FIDECL/KEY;A,B;C
This is an indexed access read, The index file is searched
for the key given in the string variable KEY starting with the
formpointed character and going through the character pointed to
by the logical length. The KEY is considered to match an ítem in
the index file if both have exactly the same number of characters
and all of them match or if all of the characters up through the
length of the index item match and then the rest of the characters
in the key variable are spaces, Remember that there are no
trailing spaces in the index file key items. This means that even
if the INDEX utility was told to index on columns 1 through 10, if
that field in a certain record consisted of an "A" followed by 9
spaces, the index file key item would consist of an "A" followed
by the key terminator character. - | a
ти a match is found, the next key pointers are left pointing
to the following item in sequence in the index file, the physical
record and character pointers are obtainea from the index file,
and the rest of the read proceeds precisely as if a physically
sequential read were being performed. When finished, the file
‘pointers are left at the start of the physically next logical
record in the file.
If no match is found, the OVER condition flag is set, all of
the variables in the list are left with the values they had before
the READ was attempted, and the next key pointers are left
pointing to the next ítem in sequence in the index file,
Therefore, a read key sequential (see the section on READKS) can
be performed to obtain the first item by collating sequence
following the item that could not be found. This can be very
useful for obtaining lists of classes of items,
For example: one could have a file of serialized items with
model codes, One could index the file on the model code followed
by the serial number. He could then access a given model code
with a serial number of all spaces (spaces being lower in
collating value than zeros). The access would return with the
OVER condition flag set indicating that no such ítem existed in
the file. The program could then proceed to read sequential by
key obtaining a list of the serial number of all items of a given
CHAPTER 7, INPUT/OUTPUT INSTRUCTIONS 7“e5
model code by the collating sequence of the serial number, The
program would have to detect when the model code changed to
determine when the list of a given model code should be
terminated. |
Another feature is that physically sequential accesses can be
made after an indexed access. The INDEX utility allows a file to
be indexed only upon what are called primary records (this is a
SORT utility option). For example, a file could consist of a
primary record followed by five secondary records followed by
another primary record followed another five secondary records and
so forth, If the index were built only on the primary records,
one could do an indexed access to the primary record and then do
five physically sequential accesses to read the five secondary
records, | |
An indexed access read takes approximately half a second
regardless of the size of the data file. This assumes that
relatively few insertions have been made upon the file, See the
section below on index insertions (WRITE) for a discussion on how
insertions can affect the indexed access timing,
READ FIDECL,KEYFA,B,C}
This is similar to the above operation except that the
physical file pointers are left after the last character read
rather than at the beginning of the physically next logical
record. This is useful if one is not going to do a physically
sequential access afterwards since it saves time not scanning to
the end of the logical record, It is also useful {f one wants to
read the rest of the record in a later READ operation or to update
the rest of the record by following the indexed read by a
physically sequential write, | |
READ FIDECL?,NULL;A,B,C
This is an indexed re=read, If the index key supplied to the
READ operation is null (logical length and formpointer equal to
zero), then instead of accessing a given item based on the key,
the operation re=reads the last logical record that was accessed
“using the index specified by the given logical file, Remember
that physical accesses do not change the pointer to the last
record accessed using an indexed access,
This operation enables one to re-read an indexed record
without having to search the index file for a given key. An IO
error is given if there has not previously been a successful READ
7“26 DATABUS 1100
performed using a non-null key on the specified logical file,
Otherwise, the operation proceeds exactly as in the normal indexed
access READ,
READ FIDECL NULL; A/B/C;
— This is similar to the above operation except that the a
physical file pointers are left after the last character read into
the variable C. |
READ FIDECL?KEY;x25,B,*NVAR,C,*10,Di
This operation performs an indexed access, positions the
character pointer to column 25 relative to the beginning of the
logical record, reads the required number of characters into the
variable Br positions the character pointer to the column
specified in the numeric variable NVAR relative to the beginning
of the logical record, reads the required number ot characters
into the variable C, positions the character pointer to column 10
relative to the beginning of the logical record, reads the
required number of characters into the variable D, and leaves the
physical record pointers after the last character read. Note the
difference between using tabbing in physical accesses and indexed
accesses is that in indexed accesses the tab position specified {Is
made relative to the beginning of the logical record and not to
the beginning of the physical record. The reason for this 1s that
one may desire to have several logical records per physical record
in an indexed file and be able to use tabbing on the accesses to
that file, The problem is that when doing indexed accesses, the
program has no idea of where the logical record is in the physical
record so the system must make the tab values relative to the
beginning of the logical record to make tabbing in indexed files
useful. Remember that an attempt to cross a physical record
‘boundary with a tab results in an 10 error,
Note that once again it is usually advisable to use a
semicolon at the end of statements using tabs since it Just wastes
time to cause the processor to scan to the beginning of the next
logical record if the next access to the file will mot be to the
physically next logical record. | |
READ FIDECL,NULL;*2S,B,*NVAR,C,*10,D;
This is similar to the above operation except that the last
key~accessed record in the given logical file is read instead of a
new index access being made,
CHAPTER 7, INPUT/0UTPUT INSTRUCTIONS 7=27
7.5.7 READKS
This is a read key sequential operation, Whenever an indexed
access is made the access routines update a pointer to point to
the following key entry in the lowest level of the index, When a
READKS operation is performed, instead of searching for a key of a
given value, the key pointed to by the next key pointer is used
(no key is supplied to the READKS operation). READKS alse bumps
the pointer to the next key in the index causing successive READKS
operations to obtain records in collating sequence, If the
pointer to the next key in the index is pointing past the last key
in the index (either a key larger than any existing was accessed
in the last indexed access or the last key sequential read
obtained the last record in the collating sequence) then execution
of the READKS operation causes the OVER condition flag to be set
and all of the variables in the list will have an indeterminate
value. The READKS instruction can appear as follows:
READKS FIDECL¿A,B,C
READKS FIDECLIx25,A,*NVAR,B,x10,C1
Except for the access method, the functioning of READKS is
identical to the functioning of an indexed access READ (this is in
reference to the action taken once the desired logical record is
located).
7.5.8 WRITE
The write statement is ysed for physically random, physically
sequential, or indexed insertion writes, The write statement
consists of a logical file declaraction mame and a record
specifier (a numeric variable for physical accesses and a string
variable for indexed insertions) followed by a list, The list may
include variable names, quoted characters, and octal control
characters (000 through 037). Note that tab positioning is not
allowed in the WRITE operations (the WRITAB operation must be used
to do tabbing in writing functions).
Each character string variable in the write list will be
written from its first physical character through the logical
length. Spaces will be written for any character positions
between the logical length pointer and the physical end of string.
Each numeric item will be written in total. Note that only the
data in each variable is written and not any of the control
information (logical length, formpointer, 0200, or ETX), The
7=28 DATABUS 1100
quoted items and octal control characters will be written exactly
as they appear in the list, For example, if the following |
definitions were made:
TIME INIT "10:23"
TOTAL FORM "001"
FDECL FILE
and the statement:
WRITE FDECL,RN;"TIME: ",TIME,015,"TOTAL: ", TOTAL
were executed, the file would be written with the characters!
TIME: 10:23(015)TOTAL: 001(015)(003)
where the (015) and (003) demote control characters, Remember.
that certain control characters (000, 003, 011, and 015) mean
special things to the read operations and their use can cause
confusion, In the example above, two logical records were written
with the one write statement because of the 015 written in the
middle. |
The format control, *ZF may be used before any numeric
variable to cause гего= #111 on the left, moving the sign to the
left if neccessary.
The format control *MP converts a numeric variable to a
"minus=overpunch" format, where, on negative numeric variables,
the minus sign is over=punched over the rightmost digit. The *ZF
and *MP are valid for the immediately following variable only,
WRITE —FDECL,RN;*ZF,A,*MP,B,C
A negative overpunched zero converts to a right bracket ")" and
one thru nine convert to "J" thru "К", |
The following is a list of the different types of write
statements. Although the following examples show lists with only
three variables, it should be remembered that all of the WRITE
operation lists can contain the various items shown im the above
example,
— WRITE FDECL,RN; A,B,C
This is a physically random access write, The physical
record pointer is set to the numeric value contained in RN and the
CHAPTER 7. INPUT/QUTPUT INSTRUCTIONS 729
character pointer is set to the beginning of the physical record
(amy digits after a decimal point in RN are ignored), Variables
A, Br and C are then written followed by end of logical record
(015) and end of physical record (003) characters. The character
pointer is left pointing to the 003 character, Note that all
WRITE statements are allowed on either FILE or IFILE declared
| logical files,
WRITE FDECL,RNJA,B,Cj
This is similar to the above operation except that the 015
and 003 characters are not written after the last. data character.
The character pointer is left pointing after the last character
written, This operation is useful for writing the first part of a
record where more of the record will be written later or for
updating part of a record where the 015 and 003 would, {# they
were written, destory data characters that followed,
wRITE FDECL,SEQ:A,B,C
This is a physically sequential access write, Variables A, :
Bsr and C are written beginning at the character position currently
being pointed to by the logical file pointers, If the file had
just been opened, the current position would be the first
character position in physical record zero of the specified
logical file, Otherwise, the file pointers would be positioned
according to the results of the last read or write operation
executed, End of logical record (015) and end of physical record
(003) characters are written after the last character in variable
C. The character pointer is left pointing at the 003 character.
Remember that space compression mode will be on after the file is
opened which means {If the file is to be opened and then written
sequentially but space compression is not to be used, one must
execute a write statement whose first list item {5 a **“ control,
WRITE FOECL,SEQ;A,B,C;
This is similar to the above operation except that the 015
and 003 characters are not written after the last character in the
variable C. The character pointer is left pointing after the last
character written, |
WRITE FIDECL,KEY;A,B,C
This is an indexed access record insertion, The KEY variable
must not be null and the key specified must not already exist in
the index specified by the given logical file (either condition
7-50 DATABUS 1100
will cause an IO error). The search algorithm used to determing
that the key is not already in the index {5 identical to that used
in the indexed access READ operation,
‚The key whose value lies from the formpointer through the
logical length of the KEY variable is inserted in the index file
specified by the given logical file and the record is written at
the physical end of the data file, The record is always started
at the beginning of the physical record which contains the EOF
mark and then a new EOF mark is automatically written in the
physical record which physically follows the new record, Note
that this implies that for each record inserted into the data
file, at least one physical record will be used (even if the
record inserted is only 30 characters long). The record inserted
may be longer than one physical record, in which case an integral
number of physical records will be used for the inserted record,
The reason the inserted record is always started at the beginning
of a physical record is that this insures that tabbed operations
can then be performed upon the new record in case they are desired
(assuming the new record will fit within one physical record).
Insertions will take longer if many records very close
together in collating sequence are inserted together. When
inserting items whose keys fall randomly within the collating.
sequence one can usually insert a number of records equal to one
tenth of the total number of records in the file before the
insertions will start to take significantly longer, It 18
generally a good idea to run the INDEX utility as often as
practical when many insertions and deletions are being performed
to keep the speed of insertions and indexed accesses as high as
possible. . |
NRITE FIDECL,KEY;A,B,Ci
This operation is also an indexed insertion write except that
the new EOF mark is not automatically written at the end of the
file, One could desire to finish writing the record with a later
operation and could do this by following the above statement by
physically sequential write operations and then writing the EOF
mark at the end of the file One must make certain, however, that
in doing this that no other program can try to do an insertion
before the ЕОЁ 1s written or the other program will get a RANGE
trap since it will not be able to find the EOF which it will want
to overstore,
CHAPTER 7. INPUT/OUTPUT INSTRUCTIONS 731
7.5.9 WRITAB
This operation is the write tab feature which requires a
different instruction mnemonic from the normal write operations,
With this feature, characters may be written into any character
position of a physical record without disturbing the rest of the
record, A RANGE trap will occur and the logical file pointers
will not be changed if a write tab is used on a record of the file
that has never been written before. The write tab can be
performed only upon logical files which have been delcared using
the FILE declaration, The UPDATE operation is used to do tabbed
writes into indexed files, The list controls *(numeric literal)
or *(numeric variable) are used to position the character pointer
to the specified character position in the current physical
record, writing of the variable begins at the point specified by
the position control. If no positioning is specified, the writing
of the first variable starts at the beginning of the physical
record,
Tab positioning in physically random accessed writes is
calculated from the first position in the specified physical
record, If the tab position is greater than 249 characters, an IO
trap will occur. Only the quoted characters, octal control
characters, and variables appearing in the list are written, The
character pointer is left pointing ome character past the last
character written (there is an implied semicolon at the end of the
WRITAB operation), For example,
WRITAB FNDECL,RN;A,*70,B,x10,C,XNVAR, "TIME".
would write variable A beginning with the first position In the
physical record specified by RN, Variable 8 would be written.
beginning at position 70 in the physical record and variable C
would be written beginning at position 10 in the physical record.
The characters "TIME" would be written beginning at the position
specified by the numeric variable NVAR (any places after a decimal
point will be truncated) and the character pointer would be left
pointing ome character past the "E" written for the quoted
characters "TIME", An IO trap would occur and the record would
not be written it NVAR was greater than 249.
A word of caution is appropriate at this point {nm the
discussion, If in the above example NVAR had had a value of 248,
the letter "T" would have been written as the last character in
the physical record specified by RN. That physical record would
7-32 DATABUS 1100
then be written and the following physical record would have been
read into the buffer, The letters "IME" would have then been ..
written into the first three positions of this new physical record
and the record then written back out. If more tab positions had
followed the writing of the characters "TIME", these would have
been in the new physical record, not in the one specified by the
contents of RN. This action would probably not be that expected
by the programmer and would all take place without a whimper of an
error message from the interpreter, Just be careful about your
tab positions! | |
Note that using WRITAB with a physically sequential access
(where RN contains a negative value) is possible but not |
advisable, Tab positioning on physical accesses is always
calculated from the first character position in the current
physical record, The program could obtain characters from a
pervious or following logical record if tabbing is used in a file
where the relationship between logical and physical record
boundaries is not known, |
745.10 UPDATE
This operation allows modification of the last record that
was accessed with 8 READ or READKS operation. Only the logical
file declaration name is supplied to this operation (no key is
supplied) but the list may have all of the items allowed in the
WR1TAB liste For example, a.
UPDATE FIDECLIA,*20, B,x40,"ASDF",033
would read the last indexed accessed record in the logical file =
FIDECL and would overstore the first characters in the logical
record with the contents of the variable A, would overstore the
characters starting with the 20th character in the logical record
with the contents of the variable B, and would overstore the
characters starting with the 40th character in the logical record
with the characters "ASDF" followed by the octal character 033,
The character pointer would be left pointing after the 033
character (the last character written from the list). Note that
as in indexed access reads using tab positioning, the tab |
positions in the UPDATE operation are relative to the beginning of
the logical record (and not the beginning of the physical record
as in WRITAB). As in the WRITAB operation, the UPDATE has an
implied semicolon at the end of its list,
CHAPTER 7. INPUT/0UTPUT INSTRUCTIONS 7= 53
7.5.11 INSERT
This operation allows an index insertion into more than one
index file, The WRITE operation mentioned earlier is used to
physically insert the record into the data file and insert the key
into one index file, If more than one index is being used, one
INSERT operation must be performed for each additional index into
which an insertion ís to be made. when the WRITE operation
performs the physical record insertion, a pointer is xept which
contains the physical location of the newly inserted record in the
data file, When the INSERT operation is performed, the specified
key (with a pointer to the remembered physical location into the
data file) 13 inserted into the specified index file, Since only
one of these insertion memory pointers is kept for each program,
one must make sure that all insertions necessary for a given
record are made before performing the next WRITE to insert the
next record, For example, the sequence to insert twe records into
two indices would be WRITE INSERT WRITE INSERT and mot WRITE WRITE
INSERT INSERT, The format of the INSERT statement is as follows:
INSERT FIDECL,KEY
where FIDECL is the name of the logical file declared for the
index being used and KEY is the string variable in which from the
formpointer through the logical length is contained the key to be
inserted in the index, An IO error is given {f KEY is null or if
the key specified already exists in the specified index file,
Otherwise, the key is simply inserted into the index, Note that
it is not necessary to prevent the program from being interrupted
between the WRITE and INSERT operations since the pointer to the
record which was inserted is kept for each program and even if
another program inserted a record in the same file or index
between the WRITE and INSERT of the program in question, all
insertions would be performed correctly,
7Te5,12 DELETE
This operation allows a record to be physically deleted from
a data file and for its key to be deleted from the specified
index, The DELETE instruction is also used to delete keys from
other indices which can index the data file, For example,
DELETE FIDECL KEY
will delete the record specified by the key (whose value lies from
7=34 DATABUS 1100
the formpointer through the logical length in the variable KEY) in
the data file specified by the index file specified by the logical
file whose declaration name is FIDECL. The record is physically
deleted by having all of its characters up through the logical end
of record mark (015 character) overstored with 032 control
characters, The 032 character does not appear to exist when the
record is read using the DATABUS 1100 reac mechanism or the
REFORMAT utility read mechanism since when these mechanisms see
such a character they simply bump the character pointer (moving on
to the next physical record if running off the end of the current
physical record) and try to fetch the next character, Therefore,
when DATABUS 1100 performs physically sequential reads across
records that have been physically deleted, the records do not
appear to exist, The REFORMAT utility eliminates these 032
Characters to close up the deleted space in a file and to make the
file readable by other DOS utility programs such as SORT,
The DELETE operation will not try to overstore the record
being deleted with 032 characters if the first character already
contains a 032 character. This allows the DELETE operation to be
used to delete the key entries from all index files which index
the given data file. For example, |
DELETE FIDECL1,KEYI1
DELETE FIDECL2,KEY2
DELETE FIDECL3,KEY3
would be used to delete the record and keys out of the three
indicies which pointed to that record. The first DELETE would
actually overstore the logical record with 032 characters and
delete the key from the index file specified by the logical file
whose declaration mame was FIDECL1. The other two DELETE
operations would only remove the keys from their respective index
files since ít would be noted that the logical record already
contained a 032 character in its first position, |
745,13 WEOF |
Standard DOS end of file marks (000 000 000 000 000 000 003)
in the first seven character positions of a physical record) can
be written in DATABUS 1100, WEOF does not change the physical
record or character pointers for the given logical file, For
example,
WEOF FDECL,RN
will write an end of file mark in physical record RN while
CHAPTER 7, INPUT/OQUTPUT INSTRUCTIONS 7=35
WEOF FDECL,SEQ
will write an end of file mark in the next physical record after
the current physical record pointer. Note that the WEOF operation
may be performed upon logical records which have been declared
either FILE or IFILE but that the record is always specified using
a numeric variable for the record number. This implies that one
cannot write an end of file mark using an indexed access. |
7-36 DATABUS 1100
CHAPTER 8, PRIGRAN GEmLRATIONS
8,1 Preparing Source Files
Files containing the source language for JATAGUS 1100
programs are prepared using the general purpose editor running
under DUS,C and whose use is covered in a separate document, [he
editor tab stops may be set to be suitanle for keyin of DATABUS
1100 programs by usina the :1 commano ani settina two tabs, one at
10 and the other at 20, o
86,0 Lompiling Source Files
GATABUS 1100 programs are compiled using the DATANUS 1100.
compiler running under VUS.C. The DATAHUS 1100 compiler 158
parameterized in the following manner: a.
DBLICMP <source>(,<object>] L-<print>] (;<L><U><E><R><X><D>] ©.
File Specifications:
ine compiler may be parameterized with up to three file |
specifications. These file specifications follow the standard DOS
conventions, Heter to the DUS Users Luice tor further | о
information concerning DUS file specifications, À bad drive
specification for any of the files will result in the error
messages | | | | | ая
BAD DEVICE SPECIFICATION
It any of the file specifications are identical, the message:
SOURCE AND OBJECT FILES THE SAME or
SOURCE AuD PRINT FILES THE SAME or
OBJECT AnD PRINT FILES THE SAME
wili be displayed,
ihe source file contains the DATAbUS 1100 program text
created with the editor. This tile must always pe specifiea, If
No extension is aiven on the source tile mame, the extension TXT
15 assumeg, If the source file name 18 not suppliea, the messages
CHAP TEX * a FRU ЕЕ КАТ ТО: К - |
NAME REQUIRED,
will ve displayed, „If the source file name does not exist in the
DUS directory, the messages: | -
NU SUCH NAME,
will be displayed, It no drive is specified, all drives beginning
with drive 0 will be searched for the source file,
The object file will contain the object code generated by the
compiler from the specified source code. If the name of the
object code file 1s not given, the name ot the source code file
with an extension of DBC will be used for the name of the object
code file, Note that DATABUS 1100 can run only those files with
extension LHC, If the source code file is specified without a
drive number, the compiler will search all drives for the name
given, If the object code file name (with the extension specified
or the assumed extension DBC) is not found on any drive, the
object code file is placed on the same drive as the source code
file, If the object code file is found, it is killed and
re=opened on the same drive it was found on to assure a maximally
contiguous file space is available,
Tne print file specification is also optional. If it is
given, any print output requested will be written in this file (in
the standard GEDIT format) instead of being printed on the local
printer. Top of torm will be indicated by the character “1” in
column one of the print line. Utherwise, column one is always
blank and the line starts with column two (this is the standard
CUBOL and FURTRAN print file format),
If no name is given for the print file specification, the
source file name will be assumed, If no extension is given, an
extension ot PRT will be assumed. However, if the orint file is
to be read under DATABUS 1100 it must have an extension of TXT
since all DATABUS 1100 data files must have that extension, If no
drive number is specified, the print file will be placed on the
same drive as the source file, A print file may be specified
simply by keying in a comma after the object file svecification
or, if no object file is specified, by keying in two commas after
the source tfile specification. Notes however, that the extension
assumed in this case will be PRI, |
Had VATADLS 110€
Jutput Parameters:
These parameters allow the user to svecitv what type of
output is wanted in addition to the object file, If a print file
is specified, any print output is written in that file instead of
being sent to the printer, Lf the semicolon but no parameters are
specified, the only output is the object file (if in this case a
print file was specified it would be null). — |
The DATABUS 1100 compiler can output to eitner a local or
servo printer, The compiler is self=configuring in this respect
and will output to whichever printer it finas connected to the
system I[/U bus. Since the compiler looks first for a servo В
printer, output will be to the servo printer if poth a local and
servo printer are addressable by the system, a |
Any source code lines which have errors are displayed on the
screen during pass lI, with the appropriate error flag,
Addrtionailys the compiler displays at the lower left corner of
the screen the current line number beina compilea, for every 10th
line. Every lüth line is indicated pDecause displaying the line
number for every line would slow down the compiler, No numbers
«111 be displayed if the program is fewer than 1U lines long.
1615 line number display is cleared when processing of included
files begins or ends, so the line nunber gisplay will link off
momentarily during compilation of source files using included
files. В | | |
lo specity output options, a semicolon plus one or more of -
the following shoula be placed after tne last file specification:
LA listing of the compilation results 15 printed. Each line
ot source code 1s numbered and the object code location |
counter value tor the first byte of code generates for the
line is listed to tne left of each source code line. A “+
appearing as the first character of a line causes a new print
page to be started. The rest of the line following the + may
be used as a comment line, А “*” annearing as the first
character of a line causes a new print page to te started if
the current line is within two inches of the bottom of the
current page. A good way to improve the readability of a
Program 18 to begin each section or routine «ith a comment
before which a line is entered which contains a star in 1ts
first column, This will make sure the comment appears on the
Same page as the first lines of the code to which 1t 18
attached,
CHAPTER Ko mima Ht red] Ji Hed
CA listing of the compilation results is printed and the
generated object code is listea to the lett of the source
code, Printing the object code usually makes the listing
about twice as long. If this option is given, the L option
is implied ana need not also he given, |
| Ihe source code for lines with errors will be printed in
addition to being displayed on the screen, This parameter
has no meaning if the L or C options are given since listings
produced under those options will include error flags anyway.
A The line numbers for referenced labels in an cperano string
will be printed at the right margin of the listing, The line
number is the line on which the Reterenced label was defined,
If the L, C, or E option is not also given, this option has
no effect, This option may be given instead ef or in
audition to the X option, The k option is especially
convenient with GOTO or CALL instructions in following the
logic path of a complex set of code. Note that for the R
option to be effective, a printer with at least 150 column
printing capability must be used,
X A cross”reference listing is printed at the end of the
compilation. There will actually be two crossrreferences:
one for the data labels and one tor the executable labels.
Lach cross~reference is sorted alphabetically, The data or
executable label is given preceded by the octal location
where the label was defined and followed by a list of all
line numbers in which the item was defined or reterenced, An
asterisk flags those line numbers which are definitions, The
SORT utility is called by the compiler to do the actual
reference sorting, and the messages displayed on the screen
will be appropriate to the progress of the sorte A
cross“reference may be obtained regardless of whether a
listing was requested. | |
D A copy of the source code is displayed on the screen during
“the compilation.
It a listing has been requested, the compiler will ask:
HEADINGS
[his moy be /0 characters long and is printed at the top of each
page. Indicating tne time and date of the listing is helpful in
keeping listings in chronological order. The source file name 15
automatically listed to the left ot the heading,
tee 4 DAT Anus 1100
Examples:
UBLICKP PROGRAM
1915 is the simplest compilation specification, Ine source
code found in tile PROGRAM/TXT would be compiled with the object
code placed in file РЕОБКАМ/ ОВС, NO other output vouleo be given
excent for errors displayed on the screen, |
DBLICMP CHECK Crib Crag CX
The source code in (HECK/TXT would ne compiled and the object
code placed in CHECKMN{I/UBC. A listing would be nrintea on the
printer and consist of the source and object code with a data and
executanle label cross-reference at the end. | Е
UB11CHP FILEIDKO, oF ILELST/ TXT 1DR1;LX
The source code in FILE/TXT on arive U would be compilea and
the object code placed in FILE/E:5C on grive 0. a copy of the |
source code and a data and Janel cross-reference will be written
in FILELSI/IXT on drive |, a |
“The compiler may be stopped temporarily by depressing the
DISPLAY key. Tne DISPLAY light will pe turned on and execution
will not pe resumed until the DISPLAY key is depressed again (the
DISPLAY light will then be turned off), Compilation may be
aborted at any time before the cross-reference sort is begun by
depressing the KEYBOARD key, 1f the compilation 1s abortea in
this manner the object file and the dictionary file are deleted. —
as are tne reterence file and tne print file 1t a cross-reference
list or print file was specified, |
If a compiler print option (Ly Cy, Е, or X) is selected, the
orint is not being sent to a print file, ana there are no printers
attached to the diskette 1100, the compiler will progress until.
the first print buffer is full, and wait at that point for a
printer to vecome ready, This implies that if there is no printer
at all attached, the compiler will enter a perpetual wait loop.
Hes Lompilation directives
Two u1rectives are available in the VATADUS 1100 compiler as
mentioned in Section 2.2. Une is the LyU statement whicn allows a
label to be assigned a decimal numeric value trom 1 tnrouah 249,
For example:
LMAPITER В. РККА БН КАТ р Beh
LM EQU S
A label which is detined in this manner may be used as tab values
in disk 1/0 statements and as cursor positions in KEYIN and
DISPLAY statements. This is particularly useful when one defines
a data base record format, If all item positions within the
record are defined using the EQU directive, then changes in item
positions can be achieved by simply changing the ore directive
value, If the LWU were not used, the user would have to hunt
through al) programs to change all disk 1/0) statements to change
the item position in the record, a
The second compiler directive is INCLUDE (the compiler also
accepts a mnemonic of INC) which allows another text file to be
included at that point as if the lines actually existed in the
main file. For example: | |
INC RECDEFS
will cause the file RECDEFS/TXT to be scanned as 1f all of its
lines existed in the place of the INCLUDE line. The assumed
extension on included files is TX! but may be specified to be any
extension, If no drive is specified, al} drives starting with
drive zero will be scanned for the file, Inclusions may be nested
up to four deep, with a maximum of 16 included files, The INCLUDE
directive can be used to include a file containing the tQU
directives and data variable definitions which define the format
of a data base file record, This can prevent the programmer from
having to keyin the data area (and common data area) definitions
over and over for each program to use a certain data file, lt
also will make it much easier to update the data area definition
since the programmer would have simply to update the one text file
and then compile all the programs (which would ıncluae the
modified definition file) to update all programs to the new data
area definition.
8,4 Compilation diagnostics
The compiler prints and displays diagnostic messages on the
listing to help the programmer debug syntatical errors in his
code, These messages take the form ot an error code letter at the
left of the listing and an asterisk under the line at the position
of the scanning pointer when the error occurred. The letters are
“E for an expression error (a generalized syntactical error), U for
an undefined variable or label, and 1 for an undefined a
instruction, In the case of £ errors a number is given on the
line with the asterisk pointing out the error position 1n the
8-6 DATABUS 1100
source line, This numoer refers to the list of detailed error
explanations ın Appendix CL of this cocument, If army of these
{1895 appear, the compiler will tlag the orogram as being I
non=executable, If the faulty proaram 1s then executed, it will
return control to the MASTER program or to BUS.C,
The VATAHUS 1100 system uses tne 1058 logical file zero for
reading and writing all data to and from the gisk, lhis irplies
that a segment boundary may not be crossed py the object code
during a rEAD or WRITE statement (since fetching the statement
also involves disk 1/0), For this reason, the DATABUS 1100
compiler will insert a TAGPAGE instruction if 1t detects a READ or
“RITE statement crossing a segment boundary, Normally, this is of
no particular concern to the user, however, programs using TARPAGE
ana dona extensive optimization should be aware that this may
occur.
8.9 Liisk space requirements
The DATAKGUS 1100 compiler maintains 1ts label dictionary on
disk in the file named USCLICIZSYS, Moreover, this file 1s always
placed on tne same drive as the outeut object file because 1t 18.
reasonably certain that that drive will not ne write protected,
For these reasons, there may not be more than 254 files named (255
11 the object file name already exists) on the disk onto which the
object file 1S to be written.
Furtner, if a cross reference 15 desired, there must be four
more file name places available among the drives on=line, (ne of
the file names that will be in use during the compilation 15
VSCREF/SYS (the file onto which the compiler writes information
apout each label reference). Three files will be generated by
SURT: *ASORTMRL/SYS, *SORTREY/SYS, and DSCREFT/SYS., The first of |
the two files by SURT are scratch files, and the third is a
taa=tile pointing back into the DSCREF/SYS file, At normal
completion of the compilation, all files mentioned above (except
the output object file) will have been deleted and the file space
again made available to the user,
CA Lord Ag Fomuilab Ar HE ERAT TUN 6 = /
CHAPTER 9, SYSTE% UrPEXAT Ia
This chapter discusses i1oaaing the DATASUS 1100 System on
Diskette under DUS,C and the use of tne UATABUS 1100 Interpreter.
The use of the DATABUS 1100 Compiler 18 arscusse in the previous
chapter,
9,1 System Loading.
The DATABUS 1100 System is availanle on either Cassette or
Diskette media. The DUS files furnished with DATABUS 1100 are the
Interpreter, DS11/CMD and Del1/0v1 trru Doll/0vSr the Compiler,
Dsl 1CMP/CHD and DHIlCMP/UVO tnru DBILCHP ZONE DHHACK/CMD, and
ROLLUUT/SYS. :
9.1.1 Loading From Cassette
The DATABUS 1160 compiler ana interpreter system programs are
contained on one cassette, The cassette 1s in the LMF (DUS
Multiple File) format which includes a agrrectory of tne files on
the tape. lo load the DATABUS l10U files to Diskette, keyin:
MIN 7A
The MIN (Multiple IN) program will ne activated and will)
display the date of creation ef the taper the tile names in the
tape directory, and each file name as the file is beino loaded.
If the file already exists on the diskette, the MIN program will
ask 11 it is to be overstored., lhe operator can decide to
overstore the file or can tell it not to overstore the file in
which case MIN will allow the file to oe storea under a arfferent
name. Consult the DOS USER”S GUIDE for further information оп 155
opération.
The DATABUS 1100 interpreter system tiles can ре re=named to
any name desired as long as tne command tile ana all the overlays
have the same name. For example, If WkIl/C0 was re=namea DB/CMD,
then utsli/0V1 tnru LH11//v5 woula have to te named Un/iNI thru
ab ZN
CARRIER 2. SYSTE= HFENAJIL: 9= |
9,1,2 Loading from Diskette
It the DATABUS 1100 System is obtained on Diskette media,
additional copies of the saystem should be generated for backup
purposes using the DOS,C commands, DUSGEN, COPY, and/or BACKUP,
Y. Program Execution
[t the DATABUS 1100 Interpreter is named DB11/CMD then a
VATABUS 1100 program can be executed by enterina:
DB11 PROGA
The DATABUS program compiled and filed under the name PROGA/DBC
will begin execution, This program will continue executing until
an irrecoverable error 1s detected or until a STUP instruction is
executed, At this time system control will return to DOS,C,
The general form for the DATABUS 1100 interpreter command 138}
DB11 (<object>) [;<">
/
تنزيل
مجرد تذكير ودي. يمكنك عرض المستند هنا. ولكن الأهم من ذلك، أن الذكاء الاصطناعي لدينا قد قرأه بالفعل. يمكنه شرح الأشياء المعقدة بعبارات بسيطة، والإجابة على أسئلتك بأي لغة، ومساعدتك في التنقل بسرعة حتى في أطول المستندات أو أكثرها تعقيدًا.
إعلان