You are on page 1of 217

0 !

+ 1
K
MANUAL OF LANGUAGE HBL

0 !+ 2
K
1. CHAPTER 1: INTRODUCTION TO LANGUAGE
HBL

This manual describes the language for programming in HBL and is


addressed to whom are already familiar with programming and wants
not be a lesson about programming skill.

The language HBL is originated from DIBOL 11 (DEC) and preserves


some peculiar feature of that.

Who’s already expert of DIBOL programming can easily utilize HBL


without traumas.

K MANUAL OF LANGUAGE HBL ;

K1. CHAPTER 1: INTRODUCTION TO LANGUAGE HBL ;

Page 1
0 !+ 3
K
1.1. System Philosophy

A computer programmer should have permission to spend his working


time on thinking about creative solutions without have unnatural
constrictions made by programming language.

The elements of structured program of a language permit the


programmer
to show quickly the solutions by a code having a logic structure very
clear.

This reduces working time and the possibility to make mistakes of


programming; many programmers believe in fact that structural
programming improves efficiency and accuracy of a program.

The HBL, instead, generally, doesn’t permit structured programming


because misses those instructions ( as BEGIN-END of DIBOL) that
realize this kind of programming. However, some conventions and
criteria of programming, they will be described in details in this text,
will allowed to create codices of programming having a logic structure
similar to that structured, inheriting all the advantages and more easy
to carry through and read again.

The operational features of a programming language should remain


consistent across operating systems.

HBL permit user to develop a program in a system and move his


software to other system without refill it.

The time to be spent by user to change his program is only when the

K System Philosophy;

Page 2
original application is created expressively for a particular operating
system and he will be helped by facilities available only in that system.

On giving less elements as possible depending on the system, HBL


minimizes the inclination on developing software and realize
programs for particulars operating systems.

Therefore by HBL is possible reach a wide market of sales without


having to keep a different version of program for each operating
system.
0 !+ 3
K
1.2. Components of System

The main components of HBL are:

Compiler

Accepts rising files including instructions of language HBL


and creates the
strings object containing information at system level that
explain the actions
requested by the program. This manual describes instructions
and organization necessary for a program.
The program of HBL link combines the files object to
make the files of executing code.

Runtime

Performs the actions requested by HBL programmer during


the execution.
This code is never linked with HBL program, so that the
user can generally
update the runtime without link again the existent HBL
programs.

Library of Subroutine External (HLIB)

Is a collection of external subroutines given by HBL, it’s


including functions added standard that really extend the
same language.

KComponents of System;

Page3
Method of Access Sequential with Index (ISAM)

Although a programmer can designate his own structures of


file, HBL
does permit facilities ISAM that give a powered structure of
file that improves the access to records whether casual or
sequential.
HBL permits a system ISAM multi-keys that reuses the
space of deleted data, giving up to frequently rearrange of
files deleted ISAM.

The user can create a file to store, restore and update the
information basing on one or more key fields of data of the
record.
For example, the information utilized can be stored in
a file ISA by using the number to identify any record done.
Debug Symbolical

Allows the program to run in special debug mode


.
This mode is used during the development of program or
when a problem arises during the program drawing up.

Unlike some debuggers that require programs to include


special codices of debug program, it’s not necessary any
preparation to have HBL running debug mode.
Page 4
0 !+ 2
K
2. CHAPTER II: BASIC ELEMENTS OF LANGUAGE

This chapter gives general information about HBL language and about
the structure of HBL programs, introduces the instructions used to
construct the programs and describes the basic elements of language.

K BASIC ELEMENTS OF LANGUAGE ;


0 !+ 3
K
2.1. Assemblage of Characters

The basic unit of HBL language is the ASCII character.( Appendix A


lists a assemblage of ASCII characters) The characters are combined in
sequences representing the elements
of HBL language and they are called separators. The sub assemblage
of ASCII characters used in this manual are defined as follow:
:

Numerical : 0, 1, 2, 3, 4, 5, 6, 7, 8 e 9.

Alphabetical: are capital characters from “A” to “Z” and small


characters from “a” to “z”

Alphanumerical: are both numerical and alphabetical.

Alpha: all ASCII characters, except those that control the devices of I/O
(i.e. carriage return, line feed and form feed).

KAssemblage of Characters ;
0 !+ 3
K
2.2. Organization of a Program

A HBL program consists of a Data Division and a Procedure


Division.

The Data Division defines the data structures that will be used,
instead the Procedure Division defines the algorithms.

The compiling instruction of control PROC splits the two divisions.

The compiling instruction of control END in Procedure Division ends


the main lines
of program (i.e. main)

HBL encourages the modular programming that reduces big programs


to programs checking few main lines and very small subroutine
programs.

Subroutines programs are called by main lines and possibly by other


lines of program.

HBL anticipates an instruction SUBROUTINE that identifies


beginning of subroutine
(See chapter 3 for discussion of instruction SUBROUTINE)

K Organization of a Program;
Outline of major features of a program:

Instructions of Data Division


.
.
PROC (Instruction)
Instructions of Procedure Division
.
.
END (Instruction)

Schema of program subroutine:

SUBROUTINE (Instruction)
Instructions of Data Division
.
.
PROC (Instruction)
Instructions of Procedure Division
.
.
END (Instruction)
0 !+ 3
K
2.3. Types of Instructions

The HBL instructions are classified as follow:

Instructions of Control for Compiling

Instructions to Manipulate Data

Instructions for Control of Program

Instructions of I/O

In this section will be briefly explained the categories and the


instructions.
A more detailed description will be given on next chapters.

2.3.1. Instructions of Control for Compiling


The Instructions of Control for Compiling are to teach the HBL
compiler and are evaluated only when the program is compiled; they
are not included in the resulting executable program.

PROC
Ends the Division Data and starts the Procedure
Division.

END
Marks the end of program.

KTypes of Instructions;
2.3.2. Instructions of Data Division

The instructions parts of this group appear only in Data Division,


where the instruction RECORD defines the elements and the other
instructions determinate which modules are using these elements.
The instruction SUBROUTINE is included in this group because it
does appear at the head of Data Division and in the subroutines.

COMMON
Is similar to instruction RECORD in a main program, in fact
both define data of type record and the field associated.
Records and defined fields can be used both by main
program and by subroutine programs.
The data is part of main program.
In a subroutine program COMMON defines the references to
areas of data defined in the main program.
Differing from instruction RECORD, however, it will not be
defined a new space of data.

GLOBAL
Specifies that all definitions RECORD following the
instruction
GLOBAL must be spaces of data allocated in regions of
memory particular having a name instead of in the region
that normally the compiler uses.

This allow both main and subroutine programs to declare


some connections with these data regions and that can be
shared.

RECORD
Defines the disposition of a data type record and defines his
data field.
Data field in record are defined from left to right in
sequence as they show themselves up.
Only the program that is defining it can access to a data of
kind record (and to his associated fields).

VRECORD
Defines a record VIRTUAL, to build in RUN-TIME.
Inside of a VRECORD we can define pointers to other field
already defined, to obtain a different data grouping.

SUBROUTINE
Identifies the program to compile like a subroutine more than
as
a main program
The instruction SUBROUTINE defines also the parameters
by which the information are passed from the calling
program and subroutine program.
2.3.3. Instructions to Manipulate Data

These instructions are manipulating data directly:

CLEAR
Initializes one or more variables both by blank (for variables
alpha) and zeros (for decimals variables)

DECR
Decreases of one a decimal variable specified.

INCR
Increases of one a decimal variable specified.

LOCASE
Converts all capital characters of a variable alpha into small
characters.
UPCASE
Converts all small characters of a variable alpha into
capital
characters.
2.3.4. Instructions for Control of Program

The execution of HBL program starts by the instruction following


PROC and proceeds sequentially on all the remaining program’s
instructions.
These kinds of commands are used to create cycles and functions
internal to a program.

CALL
Does transfer the control to a label of program. The control
backs when a command of RETURN is done, ending the
function.

GOTO
Does transfer the control of execution to a specified label.
can be used both non conditioned form or calculated form;
the last one selects a label from a ordered labels list.
IF
Performs an instruction if the logic condition in TRUE.

OFFERROR
Disables the errors trapping (management) set by
ONERROR instruction.
ONERROR
Permits program to manage errors trapping.
The program is stopped immediately when detects the
specified error and restarts at the instruction following the
error label.

RETURN
Completes the execution of a function internal to program or
subroutine program.
The execution backs to the instruction following CALL or
XCALL that invokes the function or the subroutine.
SLEEP
Stand by the execution for a specified number of seconds.
STOP
Finishes the execution of current program.
Are foreseen two forms: one unconditioned, that backs the
control to system control, the other one is a linking form that
backs the control of execution to another program.

XCALL
Transfers the execution control to a subroutine program
external.

The information can be transferred by variables COMMON or


GLOBAL
or through the arguments of subroutine.
2.3.5. Instructions of Input/Output

This group of instructions controls the data exchange between the


programs in execution and devices of input/output connected to the
computer system.
These are including devices to store data (i.e. disks and floppy),
printers,
terminals and any other way for data transmission connected to
system.
ACCEPT
Obtains next sequential character from a file (generally from
terminal).
CLOSE
Ends I/O activities on a HBL channel.

DELETE
Deletes a record with key from a ISAM file.
DISPLAY
Writes on file a sequence of one or more characters
(generally on terminal)
FIND
Detects the position of a record in file ISAM to be next
record read by instruction of READS.
FORMS
Controls line or page shift on output file (i.e. printer)
GET
Gets a fixed length binary record from a specified point of
file.
This is an operation binary that is not giving importance to
ASCII characters received.
GETS
Is similar to instruction GET except that the access is
sequential
instead of casual. The record follows immediately last
information exchanged with the files.
OPEN
Connects an I/O device to the internal channel HBL.
Once that this association is done, the instructions of I/O can
work in this channel till done CLOSE or till program ending.
PUT
Writes a binary record of fixed length in a point of file
specified. This is an operation of binary writing and no
record terminator is affixed (unlike of WRITE)
PUTS
Is similar to instruction PUT except that the access is
sequential
instead of casual. The record is placed in file in the current
position.
READ
Obtains a record ASCII of variable length, from a specified
point of file. The information is accepted until encounters a
record terminator.

READS
Is like the instruction of READ not including that the access
is sequential instead of casual. The record follows last
information exchanged with the files.

READB
Is valid only for files ISAM, does permit to read sequentially
backward. It gives back the record previous to last
exchanged
with the files. This instruction is not in DIBOL-11
RECV
Receives a queued message by an instruction SEND
previously
executed by current program or by some other program in
the same session.
SEND
It does put a message in queue. We can get it later by
instruction: RECV.

STORE
Memorizes a record into a file ISAM based on one or more
keys
that are internally to the record.

UNLOCK
Unlocks blocked records (automatically) from the current
program.

WRITE
Transmits a record ASCII of variable length to a point
specified
of file. The information transmitted is affixed with a record
terminator.

WRITES
Is like WRITE instruction except the access that is
sequential. The record is inserted in file after last record
exchanged with the files.
0 !+ 3
K
2.4. Format of Instruction Lines

HBL instruction is a single logic line of information that can have no


coincidence with a physic line of code.

Because is not practical to work with lines over 120 characters (80
for the majority of CRT terminals), some time is necessary use lines of
continuation to split a logic line of instruction to shorter physic lines.

The compiler manages a physic line and all the succeeding lines as a
logic line.

A physic line can’t be longer than 256 characters (excluding line


terminators).

An instruction can be anywhere in his own logic line.


Blanks and precedent or following tabs are ignored.

The programmer can adopt convention reasonable on identifications


to make the program more readable as possible, because a good
reading
simplifies all other appearance of program’s develop and
maintenance.

We’ll discuss widely about the appearance of program reading in


chapter 6.

KFormat of Istruction Lines;


2.4.1. Label of Istructions

Any instruction of Procedure Division can be referred by a symbolic


name.

To this label are referred many control instructions of program to


transfer the control to a specified instruction.

The label of instruction must be the first sequence of the instruction,


followed by comma.

The label is composed by alphanumerical characters, but the first one


must be alphabetical.

In example the name SUB04 is acceptable, 3ST6 is not. Consider as


follow:

GOTO LBL02 ;(no label, referred to LBL02)


.
.
.
LBL02, IF (FLG)
CALL SF03 ;( label, referred to F03)
GOTO DONE ;(no label, refers to DONE)
2.4.2. Lines of Continuation

.
An instruction line HBL can be broken in more consecutive parts.
The second part and next are called continuation lines and they start
by
“e commercial” (&).

On to improve the reading, blank and tab can precede the symbol &.

However no blank line or comment or directions compiling, can be


inserted
between continuation lines associated or between the first physic line
and
his continuation lines.

For example:

LBL02, GOTO(YSC01,YSC02, ; First two choices


&YSC03,YSC04 ; Second two choices
&),K ; Depending on K

Is not compiled correctly because there are comments. Those comments


are breaking the continuity.

Instead:

LBL02, GOTO(YSC01,YSC02,
&YSC03,YSC04
&),K ; Depending on K

It’s correct and can also be written as:


LBL02, GOTO(YSC01,YSC02,
& YSC03,YSC04
& ),K ; Depending on K

Both are functioning in the mode like to:

LBL02, GOTO(YSC01,YSC02,YSC03,YSC04),K

All the characters that are following the symbol &, except the
comments
at end line, are considered part of the instruction.

To avoid ambiguous problems of programming is not possible break a


constant alpha by the continuation symbol.
In necessary case we need support by opportune traced record and
initialize
the constant alpha by fragments.
See the section 2.8.1 for further discussion of alpha constants.
2.4.3. Comments

The comments to program scattered between instructions can make


more
understandable the function of the program.

The HBL compiler allows all the physical lines to be ended by a


comment.

In HBL a comment starts by (;), followed by a sequence of ASCII


characters.

If a line contains a constant alpha without a closed apostrophe, the


comment will be interpreted as part of the constant alpha.

2.4.4. Lines Blank

The lines wholly made by blank, tab or optional comments, will be


written
in the list of program but they’ll be ignored by HBL compiler.
0 !+ 3
K
2.5. Separators

Some ASCII special characters are used to split consecutive elements


of language in HBL instructions.

Space e Tab

Space and horizontal tab are permitted between adjacent


elements of language and they can be used to improve the
program reading, but they can’t be placed internally to the
element s of language and inside constants alpha.
For example, key words, labels with name and data names
can’t contain space or tab
Virgola
More than internal of alpha constant, comma has to be used
as permission in specific mode in the description of
instruction format

Parenthesis Right and Left


Right and left brackets must be used as balanced pair except
in alpha constants.
That is for any left bracket must correspond in the following
text a right bracket also.
The left bracket is considered open parenthesis and the right
one is a closed parenthesis.
The bracket pair is including indexes and parts of
information,
is altering the evaluation order of mathematics expression
and Boolean and including the associated arguments to some
instructions HBL.

KSeparators;
Apex single
The alpha constant are delimited by single apex, open and
closed. The constant alpha value is the whole sequence of
characters between the two limiters.

Semicolon
When semicolon (;) is used external to a constant alpha it
does indicate the end of instruction contained in that line and
the beginning of comment.
All the information from (;) to the physical end of line are
showed in the program list but they are ignored by the HBL
compiler.

Dollar Symbol

The dollar symbol ($) cannot be used in alpha constants,


variables and labels.

If an identifier starts by a ($) symbol, is considered a


function intrinsic. Those functions are explained in Chapter 4.
0 !+ 3
K
2.6. Identifiers

The identifiers are sequences of characters alphanumerical that


transmit information to compiler.

In this section will be described the four kinds of identifiers:


key word, variables names, intrinsic functions names and subroutine
names.

The first character of all the identifiers must be alphabetic, with the
exception of names for intrinsic functions that have to initiate by ($)
symbol or (%) symbol.
Examples of identifiers are: NFIRST, NLAST, TRX.

The HBL compiler is sensitive to context where is used an identifier,


in the way that the same identifier can be a key word, a variable name,
a label, all in the same program.

However if we want obtain a good reading of the program it’s not


recommended to use this last possibility.

KIdentifiersi;
2.6.1. Key Words

The key words i.e. READ,END, transmit information to HBL


compiler.
They must be used exactly has showed in the instruction description.

2.6.2. Names of Variables

The names of variables are identifiers that refer to data of record


kind and to the associated fields.
They can be used to improve the program reading;
However, only the first 5 characters are recognized by compiler that
ignores the remaining.
Because the HBL compiler does not convert the small characters to
capital, is necessary that the variable names have to be written by
alphabetic characters capital, with the max length of 5 characters.

2.6.3. Names of Intrinsic Functions

The HBL language supplies with numerous internal functions, known


as intrinsic functions.
A function name is like other identifiers but they have to initiate by
a ($) sign to distinguish them from other identifiers.
( See chapter 4 about name and description of those functions).

2.6.4. Subroutine Names

The names of subroutine are identifiers telling compiler to which


subroutine external program we are referring.

As for the variables names, subroutine names can be long as necessary


for reading, but the compiler recognizes only the first 5 characters of
the name
and ignores the remaining.
0 !+ 3
K
2.7. Data Types

HBL, because is directed to information processes, uses two forms of


common representation of information:
the string of alpha characters and the string of decimal characters.
Optionally, to speed up eventual computation processes, is possible
use the kind of binary data 32 bit; using this kind is not suggested for
normal
management of I/O files.

2.7.1. Data Alpha

A value of alpha data is a sequence consecutive of character s that


can be treated as an information unit.
Here below there are some examples:

a. This is an example, an example of data alpha!


b.Constant entire per units:
c. 1234567
d. 1a2b3c4d#*&*$&^kh<JHK)(&)(&$$

2.7.2. Data decimals

Inside of Data Division, the numbers indicate the extent of data field.
.
Is possible declare field of decimal data that contain more than 18
digits
and they have initial values bigger than 18 digits.
However if in the calculation is used a field with a value exciding
the 18 digits significant, will be given the error of “Number too big
[#15]”,

K Data Types;
that means the number is too long.
Data decimal field are not checked when the records are obtained
from data files; they are checked any time they will be used for
calculations or
as sources of instructions to assign from decimal to alpha or vice
versa.
If characters not numerical are present in a instruction for assign
from decimal to decimal, is generated an error of: “Wrong digit on
variable [#20]”
Because decimal data fields are including entire values, the
programmer
has to be sure that the data are correctly formatted and regulated
during arithmetical calculation.

2.7.3 Data binary


Data binary of 32 bit can be specified, those will occupy 4 byte of
memory, to be used for index of variables, in the way to speed up the
access in language side.
By this kind of data we can cover a range from -2.147.483.648 to
+2.147.483.647.
Is not recommended use this kind for operation of I/O files,
otherwise we can be limited to sole instructions GET and PUT.
0 !+ 3
K
2.8. Constant

A constant is both a sequence of numerical characters inside limiters


(Single apexes) and a sequence of numerical characters optionally is
preceded by a sign plus or minus.
A constant represents a specific value defined in phase of compilation
and can’t be replaced in phase of execution.

2.8.1. Costant Alpha


:
A constant alpha is a sequence of characters contained by single
apexes:
the value of constant is the sequence of characters between two
limiters.
Example of alpha constant as below:

a. 'This is' a constant alphà


b. 'as those that follow.......'
c. 'but now', there are not more''

Examples a and c show that when a limiter of an alpha constant is


contained as part of constant value, must be used two limiters adjacent
to represent only one.

In example c, the limiter appears at the end of the constant, then occur
specify one more limiter to close the definition of constant.
Sometime is more convenient to split alpha constant in smaller
physical parts.

KCostant;
2.8.2. Constant Decimal

A decimal constant is a sequence of numerical characters,


optionally is preceded by a sign plus or minus.
The max number of characters permitted in this constant is 18.
If a decimal constant positive or negative will be used in arithmetical
expression, must be enclose by brackets because the arithmetical
expressions can’t contain adjacent arithmetical operators.
0 !+ 3
K
2.9. Variables

Variable is an identifier that refers to a location of memory.


Constant values can’t be modified during the execution of program
but variables values can be altered during the execution.
Before to use a variable in a instruction of Procedure Division,
it must be defined in Data Division as a record, or a field alpha or a
decimal field.
More than definition of name and type of data in variable,
the instruction of Data Division determinates the characteristic of
memory of that variable ( that is the length, possible initial values
and positions of memory related to other defined variables).

2.9.1. Simple Variable

Simple variable consists only of name and area data.

A variable not defined as array is referred to the entire area data of


variable, while in the array the variable simple is referring to the first
element of array.
Here below are listed some example of simple variables:
a. HELP
b. Amount
c. P72X3
d. Pins
e. Y73

2.9.2. Variables indexed

KVariabili;
An indexed variable is referring to an element individual inside of a
list of elements. The name of variable is followed by value of index
contained between round brackets.
The index can be an expression decimal bigger than 0 and defines
the element of list to which we want get in.
For example index to 1 represents the first element of the list.
Any variable can be indexed but his memory area must be inside of
the area data accessible to program.
If area data isn’t accessible or if the value of index is smaller of 1,
there will be error:” wrong index [#7]”.
To better understand how the indexed variables are functioning and the
difference with dimensioned array, see the following example:
Considering the following instruction of Data Division:

RECORD DEMO
ALPHA, 3D4 ,3 ,9876 ,4321
BETA, A6 ,'ABCDEF'
GAMMA, D3 ,545
DELTA, 4A2 ,'LM' ,'NP' ,'RS' ,'TV'

Memory data is allocated as follow:

Variables Memory (characters)

ALPHA(1) 0 0 0 3
(2) 9 8 7 6
(3) 4 3 2 1
BETA A B C D E F
GAMMA 5 4 5
DELTA(1) L M
(2) N P
(3) R S
(4) T V

Reference: to variable Data obtained

DEMO 000398764321ABCDEF545LMNPRSTV
ALPHA 0003
ALPHA(1) 0003
ALPHA(3) 4321
ALPHA(4) ABCD
ALPHA(5) EF54
BETA(2) 545LMN
GAMMA(ALPHA(1)) PRS
DELTA(4) TV
DELTA(-3) Indexing wrong

ALPHA (4) e ALPHA (5) are both valid references because they are
not extended out of total data space allocated by instructions of data
division;
DELTA (-3) is not acceptable because is not expected a reverse
indexing.
Note that BETA and GAMMA can be indexed even they are simple
variable. BETA (2) is referred to the second group of 6 characters after
beginning of area data of BETA (6 is the extent of single data BETA).
2.9.2. Interval Absolute

This form of intervals of expression specifies the interval of a


sequence of characters found, and indicates explicitly the initial and
final position by two arithmetical expressions separated by a comma.

Considering the following example:

RECORD ABS
DFLD, D8 ,10203405
AFLD, A13 ,'ABCDEFGHIJKLM'

Reference to variable Data obtained

DFLD(2,4) 020
ABS(8,13) 5ABDCDE
AFLD(3,6) CDEF
AFLD(DFLD(2,3),DFLD(7,8)) BCDE
AFLD(DFLD(2,3)+2,5) DE
AFLD(13,14) MA
DFLD(6,3) Indexing wrong
2.9.3. Variables indexed Differed

This form permits to refer a field defining his ordinal position inside
to a RECORD, respect to a field “PIVOT”.
We can combine this index by one of the two methods seen
previously.

Considering the following example:

RECORD ABS
DFLD0, D1 ,9
DFLD, D8 ,10203405
AFLD, A13 ,'ABCDEFGHIJKLM'
DFLD1, D5 ,60708

Reference Data obtained

DFLD(1:) (D8) 10203405


DFLD(2:) (A13) ABCDEFGHIJKLM
DFLD(3:) (D5) 60708
DFLD(4:) (A27) 910203405ABCDEFGHIJKLM60708
DFLD(5:) (??) next memory area
not suggested
AFLD(2:) (D5) 60708
DFLD(2:2) (D8) CDEFGHIJ (bad digit)
DFLD0(3:5,6) (A2) EF
0 !+ 2
K
3. CHAPTER III: DATA DIVISION

The Data Division is the first section of HBL program.


It defines the basic elements used in Procedure Division.

The instructions of RECORD, COMMON, GLOBAL e VRECORD are


used to define the elements and their connections.

The instruction SUBROUTINE must be included at the beginning of


Data Division of a sub routine program.

The instructions RECORD and COMMON define units of information


called record; they are constituted by one or more fields.

The instructions of Procedure Division can manipulate whole records


but also single field.

The instruction RECORD defines the records that can be accessed


generally only from program containing that RECORD instruction.

If the instruction RECORD is inside a field of validity of GLOBAL


instruction, the memory area of record is accessible from any module of
program that refers to the same memory area GLOBAL.

The instruction COMMON defines records accessible from main


program and from subroutine programs referred to record COMMON or
some of his field.

The instruction VRECORD defines a VIRTUAL record to build up in


RUN-TIME any time that is referenced.

KDATA DIVISION;
Under this instruction we can combine the fields that allocate memory,
with fields that define only the address of other field and are defined in
other RECORD.

The instruction VRECORD can’t be contained in a GLOBAL.


As was clear, is necessary to limit the use of VRECORD, because of
heavy management at RUN-TIME level
0 !+ 3
K
3.1. General Meaning

The following sub section introduces some general meaning that


should become familiar to HBL programmer and gives important
information to help the programmer that will resolve more efficiently
the arising problems.

3.1.1. Record

The records are areas of computer memory in which is memorized


dynamic data during program execution.
Every module of program has local areas of record to which only it
can access.
In addition to those local areas , a main program can define common
areas of record, that are part of main program but also external
subroutine programs can access those areas.
The modules of programs can also define global records in one or
more global areas of memory by name.
These global areas are not directly associated with any program
module.
The associated memory area to record has a disposition internal
defined by record fields and is allocated sequentially in the order in
which the field are declared.
The total length of record is the sum of memory areas length
allocated to each of his fields.
The records can be with or without name;
in this case we say that they are labeled and their name can be used
to refer to the whole space of memory associated to the record.

KRECORD;COMMON;GLOBAL SECTION;OVERLAY;VIRTUAL;
This way is used overall in the I/O operations to exchange records in
a data file.
Note that, when we refer to a record in an instruction of Procedure
Division, it’s treated as a variable alpha.
3.1.1.1. Local Record

The local records are defined by instruction RECORD given outside


of
validity field of instruction GLOBAL.
The local record and his fields are called local variables.
The program module in which local variables are defined can be
accessed directly.
Other modules instead can’t access directly. However we can refer
directly a subroutine which has specified that variable in his arguments
to a local variable.
To do that, the calling program should specify the variable name in
the instruction XCALL that is calling the subroutine.

3.1.1.2. Record Common

The instruction COMMON defines the record common of a main


program.
Both record common and his fields are called variables common.
A subroutine can refer to a variable common directly by the
instruction
COMMON or can refer indirectly through the arguments of subroutine.
The allocated memory is part of local data area of main program.

The compiler recognizes only the first 5 characters of variable


common name.

The other additional characters appearing in program list are ignored.


L' uso dell' istruzione COMMON nelle subroutine stabilisce i
riferimenti alle aree di memoria del programma main.

The use of instruction COMMON in subroutines determinates the


references to the main program areas.
Because of the physical structure of record common is defined in a
main program, that structure is unknown during a subroutine
compilation;
Then the control of the structure can’t be executed during the
compilation of instruction COMMON in a subroutine.
The compilation creates a reference symbolic to the variable common
called.
The link phase,( that is the process that combines main program and
his subroutines in executable program), determinates the addresses of
memory correctly for any symbolic reference.

Then any declared variable in instruction COMMON in a subroutine


is referred to beginning of memory in the respective variable common
of main program.

That is different from DIBOL-11 that during a link phase of


program,
fixes only the initial point of each variable common of subroutine
and the link of HBL, controls the length of any single variable
COMMON and gives error signal when this one is different from the
one declared in main.
Often the subroutines utilize the common to declare variables in
mode not volatile. (volatile may be = erasable ??)

This can happens when a group of subroutines are executing complex


functions that are sophisticated screen input and control output.

The main program linked with subroutines may have or not have
necessity of data in common.
Despite of it the main program must contain the instruction
COMMON
to define the co division of data areas, because the memory is
allocated during the compilation of instruction COMMON of main and
because COMMON in a subroutine is referring only to the memory
areas declared in main.

The subroutines with instruction COMMON are stated associated with


their main programs.

When an ensemble of subroutines are modified to be more efficient or


powered, the content or the structure of area COMMON may change.
This makes problems in the management of program, because any
main program that has linked subroutines must be modified at any time
the structures of areas data shared changes.
The programmer can avoid those problems using the instruction
GLOBAL
that is not depending from modules.
3.1.1.3. Record Global

The global records are defined by instruction RECORD that is inside


of
instruction GLOBAL.
Both global record and his fields are named global variables.
Any instruction GLOBAL defines by name one area of memory
accessible to all programs, then local global are allocated in the
memory
internally the global area in order in which they are declared.

Considering the following instructions of Data Division:

GLOBAL SECTION GLB


RECORD ALEX
FLD1A, A6
FLD2A, D3
RECORD MARY
FLD1M, D2
FLD2M, D7
ENDGLOBAL

Those instructions define a reference to a section named GLB.


The program module access to the first 18 characters of global area and
split them in two consecutive global records.

In DIBOL-11 the magnitude of any global area was determinate by


the bigger global section between those defined by the same name.
If the global section GLB of the above example was used also in
another module, but with length of 139 characters, during the execution
GLB program was established a length of 139 characters.

The above definition was referred only to the first 18 characters of


the area.
On the contrary the linker HBL makes a control on the length of any
GLOBAL SECTION and signals error in case of declarations unlike
between them.

The global variables accomplish an important function when the


programmer develops the subroutines connected to library.
When these subroutines are in use, they can co divide different
assembles
of data without influence the main program to calling.

Because the calling module is not interested to the content and to the
disposition of global areas, the changing of these areas does not
requires
to modify any main that uses them.
3.1.1.4. Record Overlay

A program often must re-define the format of a record area.

Considering a data file with a record of uniform length but with a


disposition different determinate by a record variable in all record:
a solution can be to request a program that can use the same internal
area of storing repetitively during the memorizing that comes in
execution.

HBL allows programmer to define those alternative dispositions for a


memory area, including an indicator of overlay (of superimposition) in
any
definition of record.

This indicator consists of two characters—“,” and “X”—they appear


like:
“X” immediately after the name of alternative record disposition;
if the alternative disposition has not name, the overlay indicator is
disposed where the name should stay.

This cause the field definition following the indicator of filling to refer
to memory area defined in overlay record more recent.

We can’t assign to overlay record an area of memory bigger than the


one allocated in previous record in overlay if this happens we get an
error of compilation syntax.

On record overlay are added the following restrictions:

1.no one global record can be a record global overlay;


2. global records cannot superimpose not global records;

3. common record cannot superimpose local record and vice-


versa
(that is on contrary of DIBOL-11)
Simple examples of record in overlay:

RECORD REC1
A, A5
B, A18

RECORD REC2,X
C, A2
D, A3

RECORD REC3,X
E, A23

COMMON CMN1
CA, A4
CB, A5

COMMON,X
CC, A2

The variable C is referred to the first two characters of A.

The variable D is referred to the last 3 characters of A.


The variable E is referred to the whole area of memory
allocated to REC1.
3.1.1.5 Record Virtual

The virtual records can be considered an extension of OVERLAY


records.
Also in this case new memory will not be allocated but will be defined
a record trace that use defined fields in other records.
To insert reference to other records fields, after the field definition, we
insert the name of reference field, preceded by symbol @ (see 3.2)
Inside virtual record there’s also the possibility to define fields
allocating memory.

Using this technique we simplify considerably the writing of code by


programmer, because we are allowed to define some “views” of data
that are the combination of other data.

In these views, for example, we can insert values coming from another
trace record, blank selectively fields define a trace of print and edit.

The construction of record is made at execution time, that is


any time the record is referenced, for this, should not abuse using
virtual records and utilize them only for make a “group” as previously
discussed.

If we reference the single field of virtual record, it does not make


heavy
the execution and the compiler act as per the record in overlay.

To the virtual records, more than the restrictions indicated for record in
overlay, are added the following restrictions:

1. Is not allowed define a record in overlay to a virtual record.


2.Is not possible define a virtual record inside of GLOBAL SECTION.
Examples:

RECORD
BETA, D5,12345
DELTA, A8,'paperinò
UA30, A30

VRECORD VREC
ALFA, A10,'ABCDEFGHIJ'
IND, D5 @BETA
GAMMA, D8,87654321
INDA, A6 @DELTA

Riference Content
VREC ABCDEFGHIJ1234587654321paperi
IND 12345
INDA paperi
ALFA(2:) 12345
3.1.2. Fields

The fields are the components of record, and any record contains one
or more field.

The field can be located w/out name (FILLER), and in this case
occupe only the record space or can be variables with name taht
allocate the value of data used for program execution.

The fillers can be used when a record has many fields but a module
of program uses only a little sub assembly of field of that record;
in this case can be called only the fields used.

The fields adjacent, that are not used, are generally grouped in single
field of fillers that are shortening the definition of record, but they have
the effect to not document completely the structure of whole record in
list of program.

Any field defined in a program has some characteristic that are


specified
in his description, and that include the name, type, length, position in
records, initial values and time of occurrences consecutive that is
occupying in the record (see section 3.2 for definition).

3.1.3. Array

The structure record often require particular field that occur many
time, and any occurrence represent an element separated of data.

When a field is defined with more than one occurrence, it’s named
array.
The memory area allocated to array is the product of number of
elements
defined and magnitude of a single element.

Then, if a field of 6 characters is defined of 10 elements, should be


allocated in memory a space of 60 characters.

In HBL an array can be defined only as simple array,


that is to one dimension, with fields of kind alpha or decimal, and no
more than 16.384 characters.

To the elements individual of an array we can refer in simple mode or


indexed.

The simple form refers to first element of array;


The indexed form refers to n. elements, if “n” is the value of index;
the first element in number 1, the second is 2, and by the way.

The following example shows the modes above decrypted to access


arrays.
Considering and evaluating the following instructions of Data Division:

RECORD
ARRAY1, 4A6 ,'ABCDEF' ,'GHIJKL'
&,'MNOPQR' ,'STUVWX'
ARRAY2, 3D3 ,123 ,4 ,789

The space of memory will be allocated as follow, from left to right and
from above to below:

Variable characters in memory

ARRAY1(1) A B C D E F
(2) G H I J K L
(3) M N O P Q R
(4) S T U V W X

ARRAY2(1) 1 2 3
(2) 0 0 4
(3) 7 8 9

The references are as follows:

Reference Variable Data obtained

ARRAY1(1) ABCDEF
ARRAY1(3) MNOPQR
ARRAY2 123
ARRAY2(7,7) 7
ARRAY1(ARRAY2(6,6),12) DEFGHIJKL
3.1.4. Memory of Work

Generally the definition of a record reflects the structure of records


file data.
The content of area record is checked and the information is
transmitted to, or received by a data file.
However, the majority of programs request a work memory to contain
the values that are not directly associated with the activities of I/O in
data file.

Examples of variables of work memory include:

Variables of control of loop

Flag of internal process

Variables to memorize the intermediate results

In a program HBL this kind of variables are generally declared


as part of one or more records of work w/out name.
The definition of record allocates a section of memory to keep
the work variables that are necessary to program.
0 !+ 3
K
3.2. Definition of Fields

Any instruction of definition of record requires one or more instructions of


field definition.

Any definition of field specifies the behavior of a single field, and all the
field definitions are giving the disposition in memory of record.

.
he format to define a simple field is the following:

[name] , [dim] type length [@pos] [,value initial]

where:
name is optional name used to refer to space of field memory.

If no name is specified, we can also refer to content by index of variable


record
whose the field is part.
If the record name isn’t specified, the field content can’t be accessed directly.

dim is a constant decimal optional, named field dimension, and indicates how
many times the field is repeated (default 1).
The presence of this specification of dimension indicates a simple array’

type is “A” for alpha, “D” for decimal and “I” for binary.

length specifies the number of characters in any occurrence of field.

If the dimension was not specified, the length should be a constant decimal
positive.
In case of variables “I”, do not specify the length because is fixed to 4 byte
(32 bit).
pos (optional), indicates a field that is pointing to another field, specifying

Kfields;
eventually an offset.

In this case the field will not reserve memory for the current record, but will
define in alternate a field previously declared.

The referenced field must appertain to the same class of memory


(RECORD/GLOBAL/COMMON).

Similarly for Overlay fields, is not possible specify an initial value for this
kind of fields.

value initial
is the assemble of initial values that are assigned to succeeding
occurrences of field.
This specification is optional and is described with further details
here below.
The initialization of binary fields must be executed as decimal
operation.

The following are simple definition of fields:

RECORD
, A3 ,'XYZ'
INVAL, A20 ,'initial Value’
FLD1, 2D7 ,123 ,987
DATA, D6 ,10394
MESE, D2 @DATA ; punta a '01'
GIORNO, D2 @DATA+2 ; punta a '03'
ANNO, D2 @DATA+4 ; punta a '94'
INDEX, I

DATA= DATE
MESE= MONTH
GIORNO=DAY
ANNO=YEAR

punta a = point to
0 !+ 3
K
3.3. Specification of Initial Values

At start of execution of program, the default value in a alpha field is


blank, (code ASCII 32), and default value of decimal field is zero
(code ASCII 48).
The field is set to the given value before the first instruction of
Procedure Division is executed.
If initial values for an array are specified (i.e. a assemble ordinate of
elements), they are assigned in succession to all the elements starting by
the first.
However is not necessary to give initial values to all the elements of
array: to the elements for which is not given initial value will be
assigned
default value.
Initial values for alpha fields have to be constants alpha and are
allocated by justifying to left by the blank, that mean positioning from
left, or
filling by blank to right, if the initial value is shorter of the specified
field.
Decimal fields require constants decimal and are allocated by
justifying from right with zeros.

If initial value is longer of a single field element, will generate a


"syntax error".
By this way, a constant alpha with 6 characters is not permitted as
initial value to any field having attribute of length less than 6.
The initial values can be specified only for fields allocating memory.
Once that the memory is allocated, the succeeding fields referred to
the allocated area can’t have initial values specified.
Then the fields in a record overlay cannot have values initial; if that
will happens, the initialization will be ignored.

KValori Iniziali;
Considering the following instructions of Data Division:
RECORD
F1, A30
F2, A15
RECORD ,X
FO1, A5
FO2, A3

The fields F1 and F2 can have initial values, because are part of
declaration of a record not overlay.
Then these fields prepare the space in memory to be allocated.

The fields FO1 and FO2 cannot have initial values, because are in the
declaration of an overlay record;
They can only specify an alternative mode to see the previous memory
space allocated.

Because the variables common of a subroutine are giving only


references
to variables common of main, all the initial values specified for
variables common in a subroutine are ignored.

The memory areas GLOBAL are not directly associated with any
module.
For that reason, generally, the definition of records GLOBAL doesn’t
permit initial values.

However, the instruction GLOBAL permits to a module to specify


some initial values including option “INIT”in GLOBAL instruction.
The programmer has to make sure that the memory area of GLOBAL
is not accessible before that may be initialized by a module in main or
in a subroutine.
If occurs a premature access, the memory area will assume an
indefinite content.
We must pay attention when we specify initial values in subroutine.
The value is assigned to the first invocation of subroutine,
but after one more invocation the variables may contain the resulting
values of subroutine, instead of the initial values.
0 !+ 3
K
3.4. instruction RECORD

The instruction RECORD defines both a record local and a global


record and describes their component fields.
If the instruction of RECORD is outside of the field of validity of an
instruction GLOBAL, it will be defined a local record, otherwise is
definite a record global.

The structure of instruction RECORD is the following:

RECORD [name] [,X]


definition of field 1
.
.
.
definition of field n

In this definition, “name” is an identification optional that refers to the


whole area record, and “X”is the identification of overlay optional.
Every definition of field defines a single field inside of the record, and
a field at least must be present.
For the record in overlay are not permitted initial values.

KRECORD;
The following example defines an area local of 35 characters and a
global area named GBL of 11 characters.

Local area consists of one local record named REC1 (21 characters)
and
of a record w/out name (14 characters).

The record REC1 has an alternative disposition named R1 and one


more w/out name.

The record w/out name has an alternative disposition named OVR.

The global area consists of a global record named G1 and a


disposition alternative without name.

RECORD REC1
ALFA, A13 ,'Valore inizialé
BETA, A2
GAMMA, D6 ,975126
RECORD ,X
R1FLD1, A3
R1FLD2, A7
RECORD R1,X
R2FLD1, A5
R2FLD2, A1

RECORD
XX1, A7
XX2, D7 ,11765
RECORD OVR,X
XX1OVR, A3
XX1END, A4

GLOBAL SECTION GBL ,INIT


RECORD G1
G1A, D5 ,164
G1B, 3D2 ,1 ,27 ,3
RECORD ,X
GOVR1, D2
GOVR2, A1
ENDGLOBAL
0 !+ 3
K
3.5. Instruction COMMON

Instruction COMMON defines a record common and the fields that


compose it.
The memory space is allocated to the record if the instruction is in
main program, if it is in a subroutine that is not happening.

In fact, the symbolic pointers are created to refer to data in main


with which the subroutine has link.

The structure of instruction COMMON is the following:

COMMON [name] [,X]


definition of field 1
.
.
.
definition of field n

In the showed definition,” name” is an identification optional of


reference to record common, and “X”is the indicator of overlay
optional.

Every definition of field defines a field in the record, and at least a


definition of field must be present.

The initial values are ignored in subroutine and in spec. di overlay.

KCOMMON;
In the example here below are created two areas record called CMN1
(10characters) and DEMO (51 characters).

CMN1 is a record common with an overlay common named OVR1,


there are an overlay common w/out name and an overlay local w/out
name.

DEMO is the area of a local record with two overlays called TYPE1
and TYPE3 and a overlay common called TYPE2.

COMMON CMN1
CMN1A, A5 ,'abcdé
CMN1B, D5 ,12345
COMMON OVR1 ,X
COVR1, 5A1
COMMON ,X
, A5
OVR2, 2D2
RECORD ,X (!! ERROR)
, A5
DIGITS, A5

RECORD DEMO
TYPE, D1 ;area I/O
, A50
RECORD TYPE1 ,X (!! ERROR)
, A1 ; first tipe of disposition
FLDA1, A5
FLDA2, A6
FLDA3, 3D7
COMMON TYPE2 ,X
, A1 ; second type of disposition
FLDB1, A7
FLDB2, A9
RECORD TYPE3 ,X (!! ERROR)
, A1 ; third type of disposition
FLDC1, A1
FLDC2, 5D2

On the contrary of DIBOL-11, the records common can’t over impose


definitions of local records. In the above example, are indicated the
declaration illegal, that will have error signals in phase of compilation.
0 !+ 3
K
3.6. Instruction GLOBAL

The instruction GLOBAL is referred to an area of data global labeled.


Differently from instruction COMMON, the instruction GLOBAL works
equally in main program and in subroutine.
The global areas have no needing to be defined in a module of
specified program.
During the link phase of a program, the capacity of area will be
controlled for any subroutine that is using it, and in case of dissonance,
error will be signaled.

The structure of instruction GLOBAL is as follows:

GLOBAL [DATA] [SEZIONE] name [,INIT]


RECORD instruction 1
.
.
.
RECORD instruction n
ENDGLOBAL

In this definition, “name” identifies the global memory area to which


we refer. The key words DATA and SECTION are both optional,
“INIT” is also optional. Any instruction RECORD defines a record
global and his component fields. If the instruction does not include
option “INIT”, the initial values in definition of RECORD global will
be ignored, and the values of data in area GLOBAL will stay indefinite.
When the option is there, the initial values can be declared.
Only one module in a program can specify the option “INIT” for a data
area of global memory, if more than one module is using that option an
error in phase program link will be displayed.

KGLOBAL;
The following is a simple section of GLOBAL:

GLOBAL SECTION GLOB1


RECORD ABLE
ABLE1, A23
ABLE2, 7D2
RECORD ,X
FFF, A5
GGG, A6
SSS, A7
RECORD SCRATCH
SCR1, A50
SCR2, A25
SCR3, A5
ENDGLOBAL
0 !+ 3
K
3.7. Instruction VRECORD

The instruction VRECORD defines a local record VIRTUAL and describes


his component fields.
The structure of instruction VRECORD as follows:

VRECORD [nome]
definition of field 1
.
.
.
definition of field n

In this definition, “name” is an identifier that refers to a whole area record.


The record area is considered virtual because does not occupy static space, but
is to be made in execution phase, to reading or writing in other defined areas
of field that are following.
The importance of instruction VRECORD resides in the possibility to refer a
group of data to specifying only one name.
This avoids annoying assignments, in case that we have to pass traces record
different to subroutines.
The following example defines the row of print RSTAM,long 80 characters,
for a partial table of any element of record ANAG, long 129 characters.
The record RSTAM can be utilized directly on an instruction WRITES or
DISPLAY, after read the record ANAG,w/out make further assignments.
Vice versa, executing the instruction RSTAM=, will blanking the fields
NOME,
CITTA, INDIR

RECORD ANAG RECORD ANAG


NOME, A30 NAME
INDIR, A30 ADDRESS
CAP, A5 POST CODE
CITTA, A20 CITY

KVRECORD;
PIVA, A11 PIVA ?
DARE, D11 GIVE
AVERE, D11 HAVE
SALDO, D11 BALANCE
;
VRECORD RSTAM
, A1,'!'
PROGR, A5 ; Progressive of print
, A1,'!'
, A30 @NOME
, A1,'!'
, A20 @CITTA
, A1,'!'
, A20 @INDIR
, A1,'!'

Note that the names of field VREC are omitted because are not essential to
the purpose.
0 !+ 3
K
3.8. Instruction SUBROUTINE

The instruction SUBROUTINE identifies a module of program same as subroutine


external and defines also the type of arguments that are necessary.
A subroutine is a section of code separated that resides in a file different from main
program file.
In a program module, the instruction SUBROUTINE must be the first instruction of
Data Division.
The subroutines obey to specific duties that many program modules may request.
Consequently, the subroutines can shorter the time to develop program and facilitate
his maintenance.
The format of instruction SUBROUTINE is as follows:

SUBROUTINE subname
definition of argument 1
.
.
.
definition of argument n

In the above definition, “subname” is the name by which the subroutine should be
called
(to using instruction XCALL).
The compiler will recognise only the first 5 characters of name and will ignore the
remain.
Is not necessary to define the arguments if subroutine and program have no needing
to exchange information between themselves.
How ever, if the arguments are defined, any definition must include the name that
subroutine uses to refer to argument and the type of argument (alpha:[A},decimal:[D]).
The instruction XCALL in calling program can’t contain a number of arguments
bigger than those declared in instruction SUBROUTINE, otherwise we’ll get error:
“Number argument XCALL wrong [#6].
It’s possible that the instruction XCALL in the calling program has less arguments
of those declared: in this last case the subroutine can’t utilize in input nor in output
the arguments that are not passed.
The calling program may have as arguments both variables and expressions.

KSUBROUTINE;
During the execution, for any variable is created a pointer, that will be used to
access variable when the subroutine refers to that argument.
When the subroutine try to modify the value, a control assures that the argument has
not constant nor expression; if this happens, will be given error of “Writing on literal
[#8]”.
Over arguments is not executed a control of type. So that, a subroutine may define an
argument of type alpha, and the call specifies instead a variable decimal for the same
argument in instruction XCALL.
The instruction SUBROUTINE defines the types added by arguments, but does not
control their length; it is the specified argument to determinate the length.
The length can change at any call to subroutine, if the call uses different variables as
argument. If subroutine tries to go out the memory area of arguments, is signaled a
“Indexing error [#7]”.This can happen only by indexed access or interval to argument.
Note that this access can refer to information not requested if the length of argument
is not the same of the one expected by the subroutine.
The example here below contains a subroutine that wait for argument long at least 10
characters; Is showed what happens when the call specify an argument shorter than
the one expected by subroutine.
Considering the following subroutine:

SUBROUTINE ROTAT
;
; Rotate to left the first 10 characters of WHAT
;

WHAT, A

RECORD
FIRST, A1

PROC
FIRST = WHAT(1,1)
WHAT(1,9) = WHAT(2,10)
WHAT(10,10) = FIRST
RETURN
END
If the calling program has only the following instructions of Data
Division:
RECORD
FLD1, A10 ,'abcdefghij'
FLD2, A9 ,'123456789'
RECORD
FLD3, A2 ,'xz'

Analyze the following calls to subroutine:

XCALL ROTAT(FLD1)

Assign the string 'bcdefghijà ad FLD1.

XCALL ROTAT(FLD2)

Is making ROTAT accessing to 10 characters that begin with the first


character of FLD2.
By this, are considered 9 characters of FLD2 and the first character of
FLD3.
Backing from subroutine, the value of FLD2 is '23456789x' and the
value of FLD3 is '1z';
Note that the second character from left of FLD3 is not touched.

XCALL ROTAT(FLD3)

Makes ROTAT on try to access to 10 characters, which start from the


first character of FLD3.
Because there are only two characters remaining in the data space, the
trial to access will cause an:”Indexing error [#]”.
0 !+ 2
K
4. CHAPTER IV: PROCEDURE DIVISION

The Procedure Division starts by the compilation instruction of control


PROC and contains HBL program instructions.
This chapter describes various instructions available in Procedure
Division.

KPROCEDURE DIVISION;
0 !+ 3
K
4.1. Expressions
An expression is a combination of elements of data (called operand)
and arithmetical operation that produces an unique value.
The expressions HBL are both arithmetical and conditional, and
depending on interpretation of expression value.
If the value is interpreted as decimal number, the expression is
arithmetical;
If the value is interpreted as TRUE or FALSE, the expression is
conditional.
The simplest form of expression contains a single constant or
arithmetical
variable w/out operators.
The programmer can make expressions complex by using operators to
combine various kind of operands
The operators “unary” act only on a single operand and must stay
in left side of the expression;
Binary operand act on two operands and are inserted between the
operands.
Two operators cannot stay adjacent.
Simple examples of expressions valid are:

X - Y * 73/T

ALFA - (BETA.GT.GAMMA)

SINGLE

(VARO1.NE.'Abort').AND. (VARO1.NE.'Destruct')

-TIMER + (.NOT. (LAPSE.GT.TARGET))

KEspressions;
4.1.1. Operands Available
The operand gives data base for the expression value. In one
expression can be used the following kind of operand:

1. Constants alpha and decimals;


2. Variables alpha and decimals in form simple or indexed or at
intervals;
3. Expressions arithmetical and conditional;
4. Assembles balanced of parenthesis used to clear or modify the
order
of evaluation of expressions.

.
The programmer can make expressions complex how much he wants by
using the four kinds of operands.
Generally the brackets are not requested to evaluate correctly an
expression;
However, they are necessary if the evaluation order is going to be
distorting; they can also be used to document the evaluation order that
we want for a complex expression, or to make easier determinate the
sequence of evaluation of an expression in the next reading of program.
Some operations impose restrictions about the type of data of their
operandi;
GT.Requires that both the operands must be of the same type;
So that is not allowed to relate an operand alpha to an operand
decimal.
Where there is restriction, it must be respected.
To be noted, anyway, that the compiler will not give error, when done
relation between operandi of different type, because, is possible evaluate
the string null and this one will be understood as TRUE or FALSE.

In example:
ALFA.GT.5
Is interpreted as:
(ALFA.NE.<blank>).GT.5
That is correct syntax (see 4.1.3).
4.1.2. Operators Availabe

The operators control the sequence of evaluation of an expression.


In the group of available operators, to each of them is assigned a priority by which
we measure the importance of operator.
In the evaluation of the expression, the operators act in order of their priority.
The following table lists and defines the arithmetical operators and is ordered by
priority,
starting from operators which have the highest priority.

Priority Operator Type Description

7 + Unary Plus unary (ignored)


- Negative
6 * Binary Multiplication
/ Division
5 + Binary Addition
- Subtraction
4 .EQ. Binary Equal to
.NE. Not equal to
.GT. Major of
.LT. Minor of
.GE. Major of or equal to
.LE. Minor of or equal to
.IN. Inclusion string
.LIKE. Compare with mask (4.6)
3 .NOT. Unary NOT Boolean
2 .AND. Binary AND Boolean
1 .OR. Binary OR Boolean

When two or more operators with the same priority are adjacent, they are evaluated
from left to right.
So that, A*B/C is evaluated multiplying “A” by “B” and dividing the result by “C”.
Some time the normal priorities associated to operators are modified. In example, if
the programmer wants do the following equation:

A+B
-------
C-D
The expression is written as A+B/C-D, the priorities of operators said that the division
should be executed at first. The value resulting is calculated as the function is written:
B
A + --- - D
C

The only way to give a correct order of evaluation is to using the parenthesis, writing
the equation as (A+B)/(C-D).
A balanced assemble of brackets elevate the expression that is enclosing a higher
level of priority.
For example, if the priorities are numerical values assigned from 1 to 19, an
assembly
balanced of brackets creates a new priorities assy from 11 to 19,
(Anyone of these is higher than any normal priority).
Any assemble of parenthesis repeated elevate the priorities (with an increase of 9 in
our example).

So that is in the expression:

A + B * (C - (D + E)/(F * (G - H)) + I)

The factor “G-H” is evaluated for first because it is closed by the most internal
brackets.
Assuming that the variables have the following values:

A = 10 B = 30 C=5 D=2

We observe the result of following expressions:

Expression Result

A+B / C*D 22
A + B / (C * D) 13
(A + B) / (C * D) 4

The variables and constant alpha are permitted as operand only when are used with
the operators relational (that is EQ., .NE., .GT., .LE., .IN.).

The operators of relation request that both the operands are of the same type.
The operands decimals are compared like in the standard arithmetic; the operand
alpha
are compared by use the order of characters of assemble of code ASCII (NULL is
the character with the lowest order).
Consider the following expressions:

Expression Result

'ABCDEF' .EQ. 'ABC' true


'ABCDEF' .EQ. 'ABD' false
'CDE' .IN. 'ABCDEF' true
4 .IN. 123458 true

If the alpha operands differ in length inside an expression, only the characters of the
shortest operand are compared, and the additional characters of the longest operand
are ignored.
The operator “LIKE” can be used only in variables alpha and it permits to compare
with a masck, that is a string containing characters “jolly”as the regulation of “shell”
of UNIX:

* = Any string of characters, also empty


? = Any character
[xyz]= Any character of the list of characters closed by brackets:
in the case showed, the characters x,y,z.
The characters enclosed by squared brackets can also be “jolly”(excluded the “]
that in this case, they don’t have particular meaning.
[x-z]= Qualsiasi carattere nel range specificato: nel caso mostrato, i caratteri
a,y,z.
\ = Take out the particular meaning from jolly characters.

Of both strings, is analyzed only the significant part excluding the final blank.
Examples:
Expressions Result

'ABCDEF ' .LIKE. 'ABC' false


'ABCDEF ' .LIKE. 'ABC*' true
'ABCDEF ' .LIKE. '*DE*' true
'ABCDEF ' .LIKE. 'A?C?EF' true
'ABCDEF ' .LIKE. 'A[B-D]CDEF' true
'ABCDEF ' .LIKE. 'A[ABC]CDEF' true
'AB*DEF ' .LIKE. 'AB*F' true
'AB*DEF ' .LIKE. 'A*BCDEF' true
'AB*DEF ' .LIKE. 'A\*CDEF' false
'AB*DEF ' .LIKE. 'AB\*DEF' true
'ABCDEF ' .LIKE. 'ABCDEF' true
4.1.3. Speciali Notes
When in the instruction of Procedure Division appears an expression,
it’s interpreted like a conditional expression or arithmetical.
On describing expressions as follows, these conventions are used:
aexp to indicate an expression arithmetical
dexp to indicate an expression decimal
avar to indicate a variable alpha
dvar to indicate a variable decimal
fvar to indicate an expression conditional.

When in an instruction appears an expression conditional, his value is


interpreted as TRUE or FALSE.
HBL defines as TRUE a value not null, and like FALSE a value null.
During the evaluation of an expression, the operators relational and
bolean (.LE.,.AND.,etch.) will operate on their operands to give a result
with value 1 if the relation or the condition is TRUE, or 0 if is
FALSE.
That is:

17 + 3 * ('ABCD' .EQ. 'ABC')

The result is 20 because is true that ‘ABCD’ is equal to ‘ABC’.

Because HBL uses the context of an expression to rule how his result
should be interpreted, the variables decimals or alphanumerical can be
also used like expression conditionals.
I.E. the instruction IF can easily test the status null/not null of the
variable, and use the result of this test.
For convention, the variables alphanumerical are considered NULL,
when they contain only blank (code ASCII=32).
Assuming that: the subroutine CHECK is responsible for control of
data fields, and is ensuring that their values are inside of a pre-
established interval.
Assuming also that CHECK has a variable settled to zero as first
argument, if the interval is not accessed, or is settle to 1 on the
contrary,
the following instruction will call the subroutine, and in base to the
error flag, will address the execution in a side of module that is
controlling the errors:
XCALL CHECK (FLAG, VAR1, VAR2, VAR3)
IF (FLAG) GOTO OOPS

To extending this feature to ‘avar’, will be possible evaluate a single


variable to test if his value is blank or not:

AVAR= ; Clear AVAR


IF(AVAR) GOTO OOPS ; Result false
4.1.4. Operator Division

The operator division in HBL divides in base of the type of data that
are manipulated.
Because of HBL does not allow the type decimal with fix dot,
when we divide two data decimal, the value of variable will be
truncated during every operation.
For example, 17 divided by 2 give as result 8; the fraction part (0.5) is
truncated.
0 !+ 3

K
4.2. Functions Intrinsic

HBL anticipate an assemble of functions defined internally and called


function intrinsic.
These functions can be used any time are permitted decimal constants.
The intrinsic functions must begin by dollar symbol ($).

4.2.1. $ERLIN
Returns the line’s number of the instruction that cause the error
trappable most recent.
The number of line of any instruction appears on program list made
by command “hbd-1”.

4.2.1. $ERNUM

Returns the code number of the most recent error that can be trapped.
If the program provides the trappable errors management (i.e. with
ONERROR), the value that is back by $ERNUM can help the program
to
differentiate various trappable errors, in the way that each error can be
treated appositively.

4.2.3. $LEN
Backs the area length of the memory referred to the argument
specified.
$LEN is used to develop subroutines to treat arguments with variable
length, because often is necessary to know the length of an argument in
subroutine to control the elaboration of his content.
For example, $LEN can help in a subroutine doing the grammatical

KFunctions Intrinsic;$ERLIN;$ERNUM;$LEN;$RDLEN;
analysis to an argument alpha, to decode a command line.

$LEN of an argument null give back -1.


The format of function $LEN is:
$LEN(variable)
Considering the following instructions of Data Division:

RECORD
AA, A10 ,'abcdefghij'
BB, D6 ,102507
CC, D1 ,4

The following are examples of $LEN:

Function Length

$LEN(AA) 10
$LEN(AA(5,7)) 3
$LEN(AA(5,6)) 2
$LEN(AA(BB(2,3),CC) 3

4.2.4. $RDLEN

Give back the length of the last record read, by using an instruction of
READ, READS, GET or GETS.

This function can be particularly useful with an instruction READS,


because the length of record read can change. Is useful, for example,
to determinate the number of characters read by the terminal to limit
input of a record.
4.2.5. Examples of Intrinsic Functions

The following are examples of some intrinsic function described in the


previous section:

Example #1:
LOOP,
DISPLAY(15, 'Insert next command: ')
READS(15, INPUT)
IF ($RDLEN) GOTO VRDL
WRITES(15, 'Input null ignored’ )
GOTO LOOP
VRDL, BUF(1,5) = $RDLEN , "ZZZZX'
DISPLAY(15, "The length is : ", BUF(1,5), 13, 10)
WRITES(15, INPUT)

Example #2:

SUBROUTINE ROTAT

;
; Rotates to left all characters of WHAT.
; Is used the function $LEN because there’s no way
; to know the length of WHAT before.
;
WHAT, A
RECORD
FIRST, A1
PROC
FIRST = WHAT(1,1)
WHAT(1, $LEN(WHAT)-1) =
WHAT(2,$LEN(WHAT))
WHAT($LEN(WHAT),$LEN(WHAT)) = FIRST
RETURN
END
0 !+ 3
K
4.3. Instruction of Assignment

The instruction of assignment changes the value of specified variable.


This instruction included many forms. Usually, an instruction of
assignment has the following format:

destination=source

The destination can be a simple variable, indexed or at intervals, the


value of which will be altered.

The source is an expression that will be destined as new value.


Every expression contained in source is evaluated before that the
designed value will be altered; then, there will be no conflict when the
same variable is present both as destination and as source part.
Here the instruction of assignment as example:

ALFA = ALFA * 3

Multiplies the actual value of ALPHA by 3; the result is later assigned


as new value of ALPHA.

KInstruction of Assignement ;
4.3.1. Assignment from Alpha to Alpha
Quando la destinazione é una variabile alfa e la sorgente é una
variabile o una costante alfa,
When the destination is a variable alpha and the source is a variable
or a constant alpha, the instruction of assignment copies the information
from an area of memory to another area.
I f the source is shorter than destination, the information of source is
loaded in destination by a justification from left and by characters blank
(That is the source is loaded starting from left and exceeding space
is filled by characters blank).
If the source is longer than destination, only the characters that stay
more in left side of source are copied in destination.
Assuming the following instruction of Data Division:

RECORD XYZ
ABC, A6 ,'ABCDE'
DEF, A2 ,'XY'
RESULT, A4

The following assignment will value:

Instruction New value of RESULT:

RESULT = DEF 'XY '


RESULT = ABC 'ABCD'
RESULT = XYZ(4,9) 'DEXY’
RESULT = '1234' '1234'
4.3.2. Assignment from Alpha to Decimal

When the destination is a decimal variable and the source is a variable


or a constant alpha, the instruction of assignment represents a
conversion to decimal.
The information alpha must be a representation of whole character
with sign.
This representation alpha is converted to decimal form and assigned to
the variable decimal.
If the number of significant digits in the converted value is less than
the
length of destination, the value is allocated by justifying from right
with zeros, (that is to align it to right, and fill the left by zeros).
If the value is bigger than the length of destination, only the value that
stay more to right are allocated.
Se, durante la conversione, viene incontrato un carattere diverso da
blank, segno (+ o -),
If during the conversion, is encountered a character different from
blank,
sign (+ or -), or a numerical digit, is given the error: “Wrong digit on
variable [#20]”.
The characters of sign can be found in any position in form alpha and
they are applied in the same order in which they are.
The blank characters are ignored.
Assuming the following instruction of Data Division:

RECORD
RESULT, D6
AFLD1, A7 ,'-1-2-3'
AFLD2, A10 ,'1234567890'

The following assignments have value:


Instruction New value of RESULT

RESULT = AFLD1 -000123


RESULT = AFLD1(1,4) 000012
RESULT = '123456789' 456789
RESULT = ' 3 5 8 ' 000358
RESULT = 'ABCDE' "Digit wrong"
4.3.3. Assignment from Decimal to Decimal

If the destination is a variable decimal and the source is an expression


arithmetical decimal,
the instruction assigns the value of the expression to variable
destination.
If the number of significant digit of value is littler of the destination
length, it is loaded with a justification to right by zeros.
If the number of significant digit is bigger of the destination length,
the digit more to left are deleted.

Considering RESULT with a field of 6 digit:

Instruction New value of RESULT

RESULT = 123 000123


RESULT = 1234567 234567

4.3.4Assignment from Decimal to Alpha

If the destination is a variable alpha and the source is an expression


decimal, the assignment represents an operation of formatting.
The value of the expression decimal is loaded in the memory area of
variable alpha as the regulation of format described.
There are two kind of assignment; the type used depends on the fact
that the format is or not explicitly specified as part of the instruction.

4.3.4.1. Formatting Implicit


If the source consists only of an expression arithmetical, the value is
transferred to destination by the following rules:

1. The digits of numbers are loaded to justifying from right by


blank;

2. If the value is negative, is inserted a sign – (minus) before the


most significant digit at left;

3. If the number of digits of value is bigger than the length of


destination, it will be transferred only the digits more at right;
If the value is negative, the sign minus is not inserted;

4. If the number of digits of value is negative, are transferred all


digits of value, but the sign minus isn’t inserted.
Assuming the following instruction of Data Division:

RECORD
RESULT, A6
DFLD1, D3 ,-23
DFLD2, D6 ,-123456

Observe the following assignment:

Instruction New value of RESULT

RESULT = DFLD1 ' -23'


RESULT = DFLD2 '123456' (w/out sign minus)
RESULT = 123456789 '456789'( only the more at right)
RESUT = DFLD1 * (-4) ' 92'
4.3.4.2. Formatting Explicit

If the source consists of an expression arithmetical followed by a


comma and a variable or constant alpha, the assignment contains a
specification of format explicit.
The loading of destination is explained by specification of format.
If the format is shorter than destination, the information to be
formatted is loaded by justifying from right by blank.
If the format is longer than destination, is filled only the portion more
at right of the information.
The specification of format is a sequence of characters that describe
how the destination will be seen.
Some characters of sequence have a meaning special:

X represents a single digit. It determinates the form digit of source that


will be inserted in the specified position of destination.
The digits are extracted from source starting from right and continuing
to left.
By the X more at right of format is received the digit more at right of
source.
If there is more X characters respect to the digits of source, the
positions
more at left of X will be loaded by zeros.
Z also represents a position of digits.
However, a Z differs from X if there is more Z than digits significant
to be transferred from source.
The position Z is loaded by a blank if there are not X or comma at the
left of format.
If a comma stay to left and not to right, the position Z is filled by one
zero.
It is also placed one zero, when X is in left side of Z.

(- minus), is inserted in the corresponding position of destination, if


used like the first or the last character of format. If the source is
positive is placed a blank.
Otherwise if the sign minus is used inside a format, is inserted a small
line in the corresponding position of destination.

(, comma), is inserted a decimal comma in the corresponding position


of destination. More over, any Z appearing at right side of comma is
treated like it’s a X.

(. dot) inserts a dot in the corresponding position of destination, but


only when one of the following conditions is valid:
1. There are remaining significant digits to be transferred;
2. There’s a X character at left of dot.
. Any other character that appears in the format string is directly
inserted in destination.
If ALPHA is a field alpha of 10 characters, the following example
shows
some ways to use the format characters:

Instruction New value of ALPHA

ALFA = 987 ,'XXXXXX-' ' 000987 '


ALFA = -987 ,'XXXXXX-' ' 000987-'
ALFA = 987 ,'XXX-XXX' ' 000-987'

ALFA = 987 ,'XXXXXX' ' 000987'


ALFA = 987 ,'ZZZZZZ' ' 987'
ALFA = -987 ,'-ZZZZZZ' ' - 987'

ALFA = 98765 ,'Z.ZZZ.ZZZ' ' 98.765'


ALFA = 9876 ,'VAL: Z,ZZ' ' VAL: 8,76'
ALFA = 95 ,'This puts a X in' 'uts a 5 in'
By assignment of binary variable to one decimal, is done the
conversion regularly, maintaining the consistence arithmetical.
When we assign:

4.3.5. Assignment from Binary to Decimal or Alpha to alpha,


we can consider the double transformation Binary->Decimal and
Decimal->Alpha.

4.3.6. Assignment from Decimal or Alpha to Binary


Similarly to the previous case, the conversion from decimal to binary,
is done regularly, maintaining the consistence arithmetical.
The assignment from alpha to Binary, can be seen as double
interchange
Alpha->Decimal and Decimal->Binary.

4.3.7. Control Check of Justifications


For default, the formatted information in an assignment from decimal
to alpha is loaded by a justification to right by blank;
However, sometime, the programmer can decide to load the
information
by justification at left instead that right.
In this case, the programmer can specify by which mode the
informations has to be loaded, including a control of justification in the
last part of assignment instruction. The syntax of those two controls is:

[LEFT <:dvar>]
and:
[RIGHT <:dvar>]

The squared brackets are part of this specification.


LEFT causes a justification at left and RIGHT to right.
The variable decimal “dvar” is optional, but, if present, is representing
the number of characters of formatted information that are loaded in
destination, with the exception of characters blank loaded.

Considering the following instructions of Data Division:


RECORD
ALFA, A10
VAR, D3

The following assignment is possible:

ALFA = 12345
ALFA = 12345 [RIGHT]
ALFA = 12345 [RIGHT:VAR]

Anyone of these transfers with implicit formatting assigns to ALPHA


the value “12345”

The first two instructions are not determinate the value to VAR, but
the third assigns to VAR the value 5, because the loaded value is
“12345”
ALFA = 12345 ,'ZZ.ZZZ,ZZ-'
ALFA = 12345 ,'ZZ.ZZZ,ZZ-' [RIGHT]
ALFA = 12345 ,'ZZ.ZZZ,ZZ-' [RIGHT:VAR]

Anyone of these transfers with explicit formatting assigns to ALPHA


the value “123,45”.
Only the third instruction assigns the value to VAR. Because the
formatted value that is loaded is”123,45”, to VAR is assigned the value
7.
Note that the following blank is included; only the blanks loaded are
not included in the calculation of VAR value.
ALFA = 12345 [LEFT]
ALFA = 12345 [LEFT:VAR]

These two instructions assigns to ALPHA the value “12345”.The


second instruction assigns also to VAR the value of 5, because the
formatted value that was loaded is “12345”.

ALFA = 12345 ,'ZZ.ZZZ,ZZ-' [LEFT]


ALFA = 12345 ,'ZZ.ZZZ,ZZ-' [LEFT:VAR]
Any instruction assigns to ALPHA the value “123,45”. The formatted
value loaded is “123,45”,and w/out the blank inserted, is long 6
characters.
By this way the second instruction assigns to VAR the value of 6.

4.3.8 Deleting of Variable

If there’s not source in an instruction of assignment, the instruction


will cancel the destination.

The destinations alpha are cancelled by blank characters, instead the


destinations decimal are deleted by the zero.

Example:

ALFA = '1234' ; assigns a value not blank


ALFA = ; assigns all blank
DECIMAL = 1234 ; assigns a value not null
DECIMAL = ; assigns a value null
0 !+ 3
K
4.4. Description of Instructions

The remaining of this chapter will explain the instructions of Procedure


Division that are permitted.

KDescription of instructions;
0 !+ 4
K
4.4.1. ACCEPT
The instruction ACCEPTS receives a character from the channel
specified and loads in the specified variable the read character or the
decimal value.

Sintassi:

ACCEPT (channel, variable [label])

Where:
Channel is an arithmetical expression specified by channel HBL from
which we obtain the character.

Variable is a variable alpha or decimal in which will be placed the


representation of character read.
I f the variable is of kind alpha, the character read will be placed in the
position more left of variable, the remaining positions will be not
altered

If we encounter an end-of-file end a label, in instruction ACCEPT, is


specified, the control of program is transferred immediately to the
instruction labeled.
If the label isn’t specified, is generated an error: “End file[#1]”. If the
specified variable is decimal, it will be assigned the decimal code of
character to it.
This value is long max 3 digits. For example, if we receive the
character “A”, to the variable decimal will be assigned the value 65.
(The table of assemble of characters ASCII in Appendix A, give the
decimal code for any character ASCII).
The value is placed with a justification at right with zeros. If is
encountered

KACCEPT;
an end-of-file, will be loaded his equivalent decimal [26 for control/Z
(systems MS-DOS), 4 for control/D (systems UNIX)].
Label is an optional label to which the control is transferred if the
variable is alpha and if is received a character of end-of-file.
The label has no meaning in ACCEPT with variable decimal.

Example:

Considering the following instructions of Data Division:


RECORD
AFLD, A5
DFLD1, D1
DFLD2, D5

The following instructions ACCEPT are possible:

ACCEPT(12, AFLD)

Receives the next character from channel 12.If the character is a signal
of end-of-file, the program terminate by a message error “End file
[#1]”.
Is modified only the character more at left of AFLD; The other 4
remain unaltered.

ACCEPT(12, AFLD, DONE)

Also this instruction receives the next character from channel 12.
If the character is a signal of end-of-file, the control is transferred to
the instruction labeled DONE.

ACCEPT(5, DFLD2, END)

Receives the next character from channel 5.The label END is ignored
because DFLD2 is a variable decimal; If the character is a signal of
end-of-file, no special treatment will happen. Note that to DFLD2 is
assigned the value that correspond to character ASCII received.

ACCEPT(3, DFLD1)

Receives the next character from channel 3.Because DFLD1 is long


only
1 character, in DFLD1 will be placed only the digit of lowest order in
the

Special Notes:
Because of Accept is an operation of input having only one character,
there will be no special treatment to terminate record (as mainly
happens in other operation, like READS).
The programmer has to put those characters by himself. ACCEPT is
often used to receive a character from a terminal device.
To conciliate the operating systems in which HBL runs, when the
operator
push the button RETURN, are generated the carriage return and the line
feed. The program should provide the control for both of them.
0 !+ 4
K
4.4.2. CALL

The instruction CALL is calling an internal subroutine. After back


from subroutine (by instruction RETURN), the execution continues with
the instruction that is following CALL.
A subroutine internal starts by the instruction of which label is equal to
the one of instruction CALL.
Are allowed two forms of instruction CALL. The first form transfers
unconditionally the control to a specified subroutine.
The second form transfers the control to one of various subroutines
possible, depending on the value of selected variable. This form is
called
“CALL calculated”

Syntax:

Form unconditional:
CALL label

Form calculated: !! NOT YET IMPLEMENTED!!


CALL(list), expression

Where:
Label is the label specified to which the execution control is transferred.

list is a list of label separated by a comma. If the value of expression is


1, will be selected the first label, if is 2, the second label, and so by
the way.
The execution control is transferred to selected label. A value
negative or null, or a value bigger than the number of label in the list,
will not cause any transfer, and the execution will continue immediately

KCALL;
with the instruction following the CALL.

Expression is an expression decimal, the value of which is used to


select a label from the list of label (as discussed above).
Discussion:
The subroutines internal are convenient when will implement some
functions used in many point of a single program. More, if a function
is used only in a particular program, generally is not to be worth to put
it in external subroutine.
The subroutines can be nestled internally other subroutines; However,
because for any CALL must be recorded the point to return, the depth
of nestling should be limited.
The excessive nestling in general indicates a poor implementation of
program, so that programmer should limit nestling to not more than 15
levels.
When is executed the instruction RETURN,the control backs to the
instruction after the most recent executed CALL.

Examples:

SELECT = 2
CALL(ZAPPER, ZINGER, ZANY), SELECT
. <------- point “A” of return
.
.
.
ZINGER, AGEDATE = DATE(TYPE)
.
.
.
CALL INNER
. <------- point “B” of return
.
.
.

RETURN (to point "A")


INNER, IF (DATE.GT.CUTOFF) OVER = 1
.
.
.
RETURN (to point "B")
0 !+ 4
K
4.4.3. CLEAR
The instruction CLEAR initializes one or more varriables, both with
characters blank (for variables alpha) and with zeros(for variables
decimal).

Syntax:

CLEAR var_1 [, var_2, ..., var_n]

where:
var_1
.
.
var-n are variables alpha or decimals. An instruction CLEAR can
include
different kind of variables.

Examples:
Assuming that Data Division has the following instructions:

AVAR, A1
DECVAR, 3D1

Then,

CLEAR AVAR

is working as:

AVAR = ' ' ;(blank)

KCLEAR;
end:

CLEAR DECVAR

works as:

DECVAR(1) = 0

Note that in the last example only the first element of array is
initialized.
0 !+ 4
K
4.4.4. CLOSE

The instruction close deactivates a channel of I/O. The buffer of I/O


associated is downloaded and the channel is marked as not used.
An instruction of I/O can’t refer to a channel after that it was
deactivated, w/out use instruction OPEN to re-activate it.

In the files opened in mode OUTPUT, the instruction CLOSE is


sending the I/O buffers to disk and saves the output files.
Syntax:

CLOSE channel

Where:
Channel is an expression arithmetical, his value specify the channel of
files
that will be closed.
Discussion:
Se il canale é aperto in modo output (O o U), tutti i dati contenuti nel
buffer di I/O saranno scritti prima che il buffer sia ceduto:
If the channel is open in mode output (O or U), every data contained
in buffer of I/O will be written before that the buffer will be given:
This ensure that all the information written by program are physically
transferred to the device.
The instruction CLOSE suppresses the deleting of output files.
Note that, when a program is ended, all files open will be closed.
If the channel is open in mode update (U or U:I), all the locked record
associated to the channel will be unlocked.

Examples:

KCLOSE;
OPEN(1, 0, 'TEST') ;creates the file TEST

WRITES(1, 'Record 1')


WRITES(1, 'Record 2')
CLOSE 1 ; closes permanently
OPEN(5, I, 'TEST') ;opens the file TEST for input
READS(5, TESTREC) ;reads the first record
CLOSE 5 ;and closes the file
OPEN(7, O, 'TEMP') ;opens the file TEMP
WRITE(7, TESTREC, 13) ;writes the 13th record
READ(7, TESTREC, 13) ;reading it
CLOSE 7 ;and closes the file TEMP w/out
delete it
0 !+ 4
K
4.4.5. DECR
The instruction DECR decrements of 1 the value of variable called.
Syntax:

DECR variable

Where:
Variable is a variable decimal the value of which must be decremented
of one. The value of variable can be positive or negative.

Example:
The instruction:

DECR DVAR(2,5)

has the same effect of:

DVAR(2,5) = DVAR(2,5) - 1

but is more fast and occupies less space of code.

KDECR;
0 !+ 4
K
4.4.6. DELETE
The instruction DELETE cancels the record most recent saved by a
file ISAM.
Syntax:

DELETE(channel, key)

Where:

Channel is an arithmetical expression which specifies the channel of file


containing the record to remove. The channel should be
already open in mode U:I. The operation most recent
should was a READ or a READS.

Key is the value of key that identifies the record that will be deleted.
If the parameter key is not equal to the record key, currently read, there
will be error of “key not same”(#53) and the record will
be cancelled.

Discussion:
The instruction of DELETE must be preceded by an operation of
READ or READS so that a selected record can be specified to
cancellation.
To the value of a single key can be referred more records different in
a file that allow the keys duplication;
Then, there’s no way to specify a member individual of an assemble of
duplicates; for this reason the program must use the instructions of
READ or READS, on to determinate which particular record he has to
cancel.
After that record was determinate, it can be cancelled by instruction
DELETE.

KDELETE;
EXAMPLE:

RECORD REC
DATA1, A30
KEY, A16
DATA2, A25
RECORD
IO, A20

PROC
OPEN(15, I, 'TT:')
DISPLAY(15, IO)
OPEN(1, SU, IO)
LOOP,
DISPLAY(15, 'key: ')
READS(15, IO, DONE)
READ(1, REC, IO)
DISPLAY(15, 'Data: ', REC, 13, 10
& , 'should I cancel this record? ')
READS(15,IO)
IF (IO.EQ.'S') DELETE(1, KEY)
GOTO LOOP
DONE,
CLOSE 1
STOP
END
0 !+ 4
K
4.4.7. DISPLAY
The instruction DISPLAY sends an output of characters to a device of
valid output or to a file, through the name of channel.
Because the output isn’t a record, the system of runtime doesn’t put a
terminator of record. If anyway this terminator is necessary, the
program must indicate it in instruction DISPLAY.

Syntax:

DISPLAY (channel, list)

Where:
Channel is a decimal expression whose value specifies the channel of
device of output or of file. The channel must be open in
mode OUTPUT.
List is a list of variables alpha or decimal whose values represent the
characters that will be sent, optionally inter-placed with functions screen
(will be showed next session).

All the elements of list are separated by a comma. The elements of list
are processed in the order in which they are specified.

Discussion:
I f the instruction DISPLAY contains elements of list type alpha, the
sequence of characters of those variables is transmitted directly.
For elements decimal of list, is transmitted the character ASCII
correspondent to decimal value. If the value is bigger than 256, the
character transmitted is the character associated to the rest of division
value for 256.
For example, if value is 321, will be transmitted the character ASCII
“A”

KDISPLAY;$SCR_POS;$P;$SCR_CLS;$C;$SCR_ATT;$A
(The decimal 65).
Instruction DISPLAY is used generally to control terminal screens.
The special functions (i.e. cancel screen CRT and addressing of cursor)
depend of the terminal that should be controlled;
for this reason they are made by transmitting sequences of functions
with multiple characters.
These sequences start by a guide character, that is telling to terminal
that the information following is a special function requested and not
the text to visualize.
Different kinds of terminals, to indicate similar functions, use different
initial characters, as also different sequences of characters.
However, many use the character ASCII ESC as initial character.
To determinate what are the correspondent sequences, we should refer
to spec. of programming given by the maker.

Examples:

DISPLAY(15, 'ENTER OPTION: ')

Transmits a string of characters “ENTER OPTION:” to channel 15.


No other characters are transmitted.

DISPLAY(12,13,10, The decimal 65 gives a ',65, 13, 10)

It transmits to channel 12 a carriage return (13), a line feed (10), the


message: “The decimal 65 gives a: “, and the capital letter “A”(65).
Another copy of carriage return/line feed (13,10) terminate the
transmission.

DISPLAY(CHNL, 13, 10, 7, 'Error: ', ERMSG(ERNUM), 13, 10)


If CHNL and ERNUM are variables decimal and ERMSG is an array
alpha of error messages, this instruction sends the error message
associated with ERNUM to channel CHNL.
The error message is preceded by a carriage return (13), a line feed
(10) and the character bell (7) is followed by one more carriage return
and line feed.
4.4.7.1. Definitions of Functions Screen
The functions screen discussed in this manual are based on standard
ANSI.
HBL permit to define files of configuration for particular terminals to
obtain the complete transportability of program in systems with many
kind of terminals.

$SCR_POS(<rig>,<col>) ------> abbreviated by: $P(<rig,<col>)


$SCR POS(<row>,<col>)------> abbreviated by: $P(<row,<col>)

( comment from translator:<rig> in Italian= riga, English= row)


( comment from translator:<col> in Italian=colonna, Eng.=column)
( comment from translator:<funz> in Ita.=funzione,Eng.=function)

Is positioning to <row>and <col> on screen, where <row>


and <col> are decimal expressions. Must be sure that:
1 <= row <= 60
1 <= col <= 132

$SCR_CLS(<func>) ------> abbreviated by: $C(<func>)

Cleans the screen following the definition of function


<func>, that is one of the following strings:

EOL from current position to next end line


EOS from c. pos. to next end screen

Manages functions of edit on video:

INSL inserts a line blank in current position


INSC inserts character blank in current position
DELL deletes a video line in which we are correctly
positioned, and compacts the remain till end screen
DELC deletes the character in which we are positioned, and
compacts the row till his end

$SCR_ATT(<list>) ------> abbreviated by: $A(<list>])

Modifies the attributes of visualization in base to parameters specified


in “list”, that can be symbolic or numerical, as the following table:
┌───────────────────────────┬──────────────┬──────────────┐
│ │ ATTIVAZIONE │DISATTIVAZIONE│
│ ATTRIBUTI │NOME COSTANTE│NOME COSTANTE│
├───────────────────────────┼──────────────┼──────────────┤
│ Pi∙ luminoso │LUM,BOLD 21 │NLUM,CLEAR 20│
│ Reverse con tag │REV 29 │NREV 30│
│ Blink con tag │BLI 31 │NBLI 32│
│ Reverse e Blink con tag │REB 33 │NREB 34│
├───────────────────────────┼──────────────┼──────────────┤
│ (Sottolineato N.D.) │UNDER 22 │CLEAR 20│
│ Blink │BLINK 23 │CLEAR 20│
│ Reverse │REVERSE 24 │CLEAR 20│
│ Salva attributi correnti │SAVE 25 │RESTORE 26│
└───────────────────────────┴──────────────┴──────────────┘

The attributes of first group (with tag) are available on a biggest number
of terminals, because provide to reserve a pos. of video (named tag) to
indicate
start and end of an attribute (see Ampex 210 and others).

The attributes of second group may not be present in some kind


of terminals.
In this case they will be visualized as: “more bright”. I.e. using Ampex
210, that has not attributes w/out stone and no colors, the function
$A(UNDER,BLINK,REVERSE) will visualize simply: “more bright”.
By this function we can manage also the colors, in terminals provided,
as the following table:

COLORS BACKGROUND CHARACTER

Black 10+BLACK
Red 10+RED RED
Green 10+GREEN GREEN
Brown 10+BROWN BROWN
Blue 10+BLUE BLUE
Viola 10+VIOLA VIOLA
Ciano 10+CIANO CIANO
White 10+WHITE WHITE

Where the color’s name must be defined in order, as constants numerical


from 1 to 7.
Examples:
DISPLAY(15,$C(EOS), $P(15, 30),"This is a test")
DISPLAY(15,$A(CLEAR, BOLD, BLINK),$P(1,1), "Selection...")
0 !+ 4
K
4.4.8. FIND
The instruction FIND executes an input casual, takes position in the
wished record of file ISAM opened in specified channel.

Syntax:

FIND(channel, area_data, key_id [, KRF=keyref])

where:
Channel is an expression decimal whose value specifies the channel of
file
needed. The channel should be already opened in mode INPUT (YES)
or UPDATE (ON)

area-data is the variable alpha in which will be stored the information,


if the next information will be a READ, FIND doesn’t
change the content of this variable. This argument is used
when we specify a key implicit of reference (KRF). (See
READ).

.
key-id indicates in which record will be read an instruction of
sequential reading (READS).In practice, it’s the value of
key field of record designed. If the key value is longer of
key field, will be used only the first part of key value. If
the key value has length less than key field, is named
“partial key”, and the system takes position on first record
whose key start by the specified value. If there are not
fields whose value starts by key values, will be positioned
in the first record with the highest key value and show
error “key not same[#53]”.

KFIND;
keyref is an expression decimal that specifies an explicit key of
reference.
The value zero specifies the primary key, value 1
specifies the first key alternative, etch.
If is not specified a reference key, for default is
considered primary key (KRF=0)

The instruction FIND is similar to instruction READ in the format and


function.
FIND, however, doesn’t delete a record from file; it init only a pointer
to record that will be read at next instruction of sequential reading
(READS).
See the section 4.4.21 for information on instruction READ).
0 !+ 4
K
4.4.9. FORMS

The instruction FORMS send special codes of control ASCII.


This instruction is used overall to control the form of alignment vertical
done on written line.
Syntax:

FORMS(channel, control)

Where:
channel is an expression arithmetical whose value specifies the channel
of device to which send the codes of control.
The channel should be already open in mode
OUTPUT.

control is an expression arithmetical whose value transmits the


following characters of control:
0 Form Feed
1-9999 the indicated number of pair of carriage
returns and line feed.

Discussion:

The values of control smaller than 0 doesn’t do action, instead,


numbers bigger of 9999 generate error of “Number too big [#15]”.
To understand the effect of the various control characters, consult the
manuals of devices to be controlled.

KFORMS;
Examples:

FORMS(3, 0) ;transmits a Form Feed to channel 3

FORMS(8, 15) ;trasmits 15 pair di CR/LF to channel 8


0 !+ 4
K
4.4.10. GET
The instruction GET does an input binary with casual access, transmitting the data
from specified channel to the assigned area data. No special meaning is attributed to
characters.
the record terminators are treated as ordinary data, and will not cause the end of
input operation.
Syntax:

GET(channel, area_data, recnum)

Where:
channel is an arithmetical expression that specifies the channel of source of binary
data.
the channel should be already open in mode INPUT or UPDATE.

area-data is the variable alpha that will receive the input characters. The length of
area-data determinates the number of characters that will be obtained
by GET.
If the file contains few characters from a record position called at the end, it will give
error”End file(#1)”.

recnum is an arithmetical expression that specifies which record should be read.


If the value is smaller than 1,will give error “Number record wrong”(#28).
The number of record is interpreted as the magnitude of area-data.
The offset of first character input is determinate by the following calculation:

(record - 1) * (length area_data) + 1

Discussion:
The instruction GET is one of the 4 instructions of I/O binary that support HBL.
The other 3 are GETS,PUT and PUTS.
These instructions don’t interpret the character during I/O.Any characters is assumed
to have value of 8 bit. During the process of I/O, the terminators record are not
automatically connected or disconnected.
The program maintains the control of file output content and can control any
characters of input files. If an instruction GET is referred to a channel opened to a

KGET;
sequential device (i.e. terminal or writing line), is given error of “Mode OPEN
wrong”(#21).

Examples:
Assuming the following instruction of Data Division:

RECORD
AREA1, A38
AREA2, A1967
AREA3, A5

The following instructions GET are possible:

GET(1, AREA1, 123)

Reads the 123rd record (that is the 123rd group of bytes), from 38 byte each one
from channel 1.
If in channel 1 are remaining less than 123 records (each 38 byte), the program will
end by error “(End file”(#1).

GET(CH, AREA2, RECNO)

Reads a record of 1967 byte whose number is given by RECNO,and the record is
read by channel named CH.If the record goes over the file end, is given an error.
0 !+ 4
K
4.4.11. GETS

Syntax:
The instruction GET does an input binary with sequential access.
No special meaning is attributed to characters.
The record terminators are treated as ordinary data.

GETS(channel, area_data, [,label])

Where:
channel is an arithmetical expression that specifies the channel of
source of input data. The channel should be already open
in mode INPUT.

area-data is the variable alpha that will receive the input characters.
The legth of area-data determinates how the characters will be received.
For example, an area data of 623 characters will read next 623
characters.
If the file contains few characters, is given error “End file(#1).

label is an optional label whose transfer the control if there’s error


“End file(#1).

Discussion:

The instruction GETS is one of the 4 instructions of I/O binary that


support HBL.The other 3 are GET,PUT and PUTS.
These instructions don’t interpret the character during I/O.Any
characters is assumed to have value of 8 bit. During the process of I/O,
the terminators record are not automatically connected or disconnected.
The program maintains the control of file output content and can

KGETS;
control any characters of input files.
When the channel is connected to terminal, the instruction GETS is
similar to READS, with this exception: when a character not terminator
overcome the area data receiving, the instruction READS produces the
character ASCII BELL to signal operator and ignore the character. The
instruction GETS instead, overcoming the length area data, backs
immediately and will not visualize any of the characters put in.

Examples:
Assuming the following instructions of Data Division:

RECORD
AREA1, A38
AREA2, A1967
AREA3, A5

Are possible the following instructions GET:

GETS(1, AREA1)

Reads the next 38 characters from channel 1.If on the channel are remaining less than
38 record, the program stops by error “End file (#1).

GET(CH, AREA2, YUK)

Reads the next 1967 characters of called channel CH. If remain less than 1967
characters, the control is transferred to an instruction labeled by YUK.

0 !+ 4
K
4.4.12. GOTO
The instruction GOTO transfers the control of execution to a specified label. The
form unconditioned specifies only one label; the form calculated, instead, specifies a
list of labels and selects the expression whose value indicate the wished label.

Syntax:

Form unconditioned:
GOTO label

Form calculated:
GOTO(lista_label), selettore

Where:
label is a label of some part of program. The control of execution is transferred
immediately to the called label.
list_label is a list of labels, each of them are separated by a comma. The first label
corresponds to 1, the second to 2, and so by the way.
selector is an expression decimal whose value selects the elements of list_label. If the
value is minor than 1 or bigger of the number of elements in the list,
no one element is selected and the instruction continues with the instruction that
follows GOTO.
If the selected value is included between one and the number of elements of list,
the corresponding element is selected, and the control is transferred immediately to the
label called.

KGOTO;GO;TO;
Examples:
Considering the following program:
RECORD
INPUT, A5
DECML, D5
PROC
OPEN(15, 0, 'TT:')
LOOP, DISPLAY(15, 'Number of label: ')
READS(15, INPUT)
DECML = INPUT
GOTO (Y01, Y02, Y03), DECML
WRITES(15, '... no branches selected )
GOTO LOOP

Y01, WRITES(15, '... from label #1')


GOTO LOOP

Y02, WRITES(15, '... from label #2')


GOTO LOOP

Y03, WRITES(15, '... from label #3')


END

If the value of DECML is 1, the control of program jumps to instruction labeled with
YO1;if is 2 or 3, the control is transferred respectively to labels YO2 and YO3. Any
other value cause the signal: “…no branches selected”.
0 !+ 4
K
4.4.13. IF

The instruction IF evaluates an expression conditional, and based on value TRUE or


FALSE, executes another instruction. There’s only one form of instruction IF.

Syntax:

IF ( condition ) instruction

Where:

condition is an expression conditional whose value controls if the instruction will be


executed: The value TRUE causes the execution of instruction, instead
a value FALSE will jumps the instruction and the execution continues
with instruction following IF.

instruction represents an instruction that will be executed if the condition is TRUE.

KIF;
0 !+ 4
K
4.4.14. INCR

The instruction INCR increments of one the value of variable called.

Syntax:

INCR variable

Where:

variable is a decimal variable whose value will be incremented of 1.The value of


variable can be positive or negative.

Discussion:

The instruction INCR is more fast of normal addition of 1 to a variable, and


occupies less space of code.

Examples:

INCR DVAR

INCR DVAR1(D3)

INCR V(D1, DD9)

KINCR;
0 !+ 4
K
4.4.15. LOCASE

The instruction LOCASE converts the capital characters in small characters. More to
convert the alphabet letters, the instruction converts also the special characters listed
below in section “Discussion”.

Syntax:

LOCASE variable

Where:
variable is a variable alpha containing the characters that must be converted.
The whole sequence of characters is analyzed and any character is converted in small,
if is alphabetical, or in one of the following special characters:

Discussion:

The following special characters are converted:

Capitals Small

@ (064) ` (096)
[ (091) { (123)
] (093) } (125)
\ (092) | (124)
^ (094) ~ (126)

The other special characters are left invariated.

Example:

Considering the following program:

RECORD
FLD1, A14
PROC
FLD1 = 'JUST A [DEMO].'

KLOCASE;
LOCASE FLD1(4,11)
LOCASE FLD1
STOP

The first instruction LOCASE converts the value to:

JUSt a {demO].

Last LOCASE converts the value to:

just a {demo} .
0 !+ 4
K
4.4.16. OFFERROR

The instruction OFFERROR cancels the trappable errors settled by execution of


preceding operation of ONERROR. The errors of runtime are considered fatal and will
cause immediately the termination of program till will be executed another instruction
of ONERROR.

Syntax:

OFFERROR

Examples:

ONERROR OOPS ; enable the management of


; “Wrong digit on variable”
NUMBER = INPUT ;
OFFERROR ; disable enable the management of
; “Wrong digit on variable”

KOFFERROR;
0 !+ 4
K
4.4.17. ONERROR

The instruction ONERROR reveals if there are one or more trappable errors and treats
the errors of runtime. The form allowed establishes a single point of control managed
specifying a single label to which transfer the control when found an error trappable
of runtime.

Syntax:

ONERROR label

Where:

label is a label to which transfer unconditionally the control if appears an error of


runtime
that is manageable.

Discussion:
When a program HBL inits an execution, all the runtime errors are considered fatal.
Than, if appear a runtime error, the program ends his execution and signals an error
message.
However, a sub-assemble of all the possible errors of runtime is considered
trappable.
(See in APPENDIX B the error list).
This sub-assemble contains all the conditions of error that program can solve w/out
stop the execution.
A program can recognize and treat any sub-assy of errors trappable defined by an
instruction of ONERROR.
When we do instruction of ONERROR, we cancel all the trappable errors of previous
execution of ONERROR;
Are defined only those created by the current execution of ONERROR.Those
trappable erors will remain till will be one of the following situations:
1. We execute an instruction of ONERROR;
2. We execute an instruction of ONERROR , causing the cancellation of
current management and creating a new management;
3. The program terminates the execution;
4.We execute an instruction of XCALL,that suspends the current

KONERROR;
operation of errors till that XCALL is ended. When the control
backs, the trappable errors are recovered.

When a trappable error of runtime happens, the runtime watches if the program has
defined his own management of error.
If not, the program will terminate whit an opportune message of error.
If the program has defined an error management, the operation that causes the error,
will not be completed and the control will be given immediately to the label
associated to error management.
After an error signal, the program can understand what’s the error by the intrinsic
function $ERNUM or asking for an XCALL to subroutine external ERROR.
The subroutine ERROR will back also the row number in which the error happened
(also the intrinsic function $ERLIN gives this information).

Examples:
Considering the following program:
RECORD
ALFA, A10
DECML, D5
ERRMSG, A40
PROC
OPEN(15, I, 'TT:')
LOOP,
DISPLAY(15, 'Insert number (1-7 ): ')
ONERROR EXIT ; for EOF, FINE
READS(15, ALFA) ;
ONERROR HBAD ; trap digit wrong
DECML = ALFA ;
OFFERROR ;
WRITES(15, '... Is valid.')
GOTO LOOP
HBAD,
OFFERROR
IF($ERNUM.NE.20)GOTO XHUH
WRITES(15, '... Not valid.')
GOTO LOOP
XHUH,
ERRMSG = $ERNUM,'Error n XX'
WRITES(15, ERRMSG)
GOTO LOOP
EXIT,
OFFERROR ;
IF($ERNUM.NE.1)GOTO XHUH ; Is not EOF
STOP
END

Note that in HBAD and XHUH, the instruction OFFERROR assures that the trappable
errors are deleted. If happens an error, the program ends.
0 !+ 4
K
4.4.18. OPEN

The instruction OPEN is the primary engine for the interface HBL and ambient, and
it’s the instruction of language HBL that more depends from system.The following
section describes the functions of this instruction.
Syntax:

OPEN(channel, io_mode, file_spec)

We refer to the following sub-section for an individual description of parameters.

4.4.18.1. channel
The channel is an expression decimal that identifies which channel HBL will be
open.
If the opening process succeeds, all the future requests of I/O will be referred to that
channel.
If during the opening process, there will be an error of “other channel in use”, the
channel specified is not assigned and stay available for use.
Are allowed the channels from 1 to 99, however, the max n. of channels that can
stay open depend of the particular operative system.

4.4.18.2. io_mode
io_mode is the mode of I/O by which the file will be open. The following modes
are possible:

I: (INPUT) permits the reading only from an existing file and accesses also blocked
records.
O: (OUTPUT) permits the generation of a writing file. If the file already exists, it
will be replaced only after the successful execution of instruction
CLOSE.
U : (UPDATE) permits the reading and writing of an existing file.The reading is
locking, that is if a program did executed the reading in mode U of the
same record, we have not the possibility to read it; in case of blocked
record, are possible two behaviours in function of assumed value of
DFLAG (see XCALL DFLAG):

-The instruction read does back error #40

KOPEN;
-The instruction doesn’t back till the record in the case is unlocked.
The record is automatically unlocked, by execution of one of following
instructions:
- WRITE of record
- READ of another record
- CLOSE channel
- UNLOCK channel
- STOP
U:R : (UPDATE, RELATIVE) permits the read-write, as in mode U,with the
possibility to append additional records to the file in queue.
SI : (SEQUENTIAL INPUT) this mode is permitted only in file ISAM and is
equivalent to mode I for file of direct access.

SU : (SEQUENTIAL UPDATE) this mode is permitted only in file ISAM and is


equivalent to mode U for file of direct access.

S : (Socket TCP/IP) this mode is permitted only on “Socket” and not on Files. The
address of sockets must be done in standard form URL:
"name_service://name_host[:number_gate]".The use of Socket is reserved to
procedures or subroutines of system dedicates to management of services
internet/intranet.

The instruction HBL OPEN was descripted in general form.Are admitted only
determinate instruction of I/O in function of mode of open as the following table (the
TT can be open indifferently in mode I or O):

┌────────────┬───┬───┬───┬───┬───┬───┬───┬───┐
│INSTRUCTION │ I │ O │ U │U:R│ SI│ SU│TT:│ S │
├────────────┼───┼───┼───┼───┼───┼───┼───┤───│
│ ACCEPT │ X │ │ │ │ │ │ X │ │
│ READ │ X │ │ X │ X │ X │ X │ │ │
│ READS │ X │ │ │ X │ X │ X │ X │ X │
│ GET │ X │ │ X │ X │ │ │ │ │
│ GETS │ X │ │ │ X │ │ │ X │ X │
│ DISPLAY │ │ X │ │ │ │ │ X │ │
│ WRITE │ │ X │ X │ X │ │ X │ │ │
│ WRITES │ │ X │ │ X │ │ │ X │ X │
│ PUT │ │ X │ X │ X │ │ │ │ │
│ PUTS │ │ X │ │ X │ │ │ │ X │
│ STORE │ │ │ │ │ │ X │ │ │
│ DELETE │ │ │ │ │ │ X │ │ │
└────────────┴───┴───┴───┴───┴───┴───┴───┴───┘
4.4.18.3. Specification of file
The file specification can be both a constant and a record name, or a field name.
It defines the file to which we’ll access during the operation of OPEN.
The form of specification of is consistent with the operating system and has
extention of default DDF.
Any other defaults are the same of usual strings of file analyzed grammatically in
the ambient. The spaces and tabs in specification will be ignored. Is possible utilize
the following notation on file name:
DIR:NOME.EXT
Where:
DIR is the name of symbolic variable defined in ambient of Operating
System.
NAME is the effective name of file, as what already discussed.

EXT is the extension of file. If we want open a file w/out extension,


occur specify only “.”.
If we want open a file ISAM, we can specify extension “.ISM”, despite
this will be not the effective extension of file ISAM, that
depends on the particular operating system.

4.4.18.4. Blocked records


In an ambient many-user, is necessary prevent that more user can modify the same
data in the same time; the mechanisms of blocking of record is used for this case.
When a user get a data for modify, other users can’t change that data till the first
user finishes the job. The records blocked are not necessary in a ambient single-user
and single-work..
The block mechanism used depends completely on the operative system.

4.4.18.5. File indexed many key (ISAM)


An important aspect of HBL is that HBL is enabled to create and maintain file
indexed many key.
Note that the characteristic specific of supports ISAM of HBL can depend on
operating system.HBL gives his structures ISAM, but interfaces directly with
structures ISAM that the system supports.
This interface direct reduces the dimension of support code in runtime HBL and
allow the execution inter-language of file ISAM.However, can be imposed some
extensions and restrictions on the characteristics of supports ISAM of HBL.
4.4.18.6. Alternative forms of instruction OPEN
Maintaining the philosophy,(as paraghraf 1.1), to give a program compatible with all
the ambients HBL, are allowed the following alternative forms of instruction OPEN:

1. The factor of block of file can be shown by decimal expression as fourth and last
argument of instruction OPEN.
If we use a decimal variable instead of a constant, the variable can’t have the
same name of one of options valid for OPEN. If the names of variables are the
same, will be executed the option instead of the action of block.

OPEN(2, I, FILNAM, 8)

2. When is created the allocation initial of block for the file, his magnitude can be
closed in squared brackets and situated in the file specification after file name and
before of any qualification.
If was specified the initial allocation in an ambient MS-DOS or UNIX, we have to
choose the system option #15.

OPEN(12, O, 'TEST.DAT[150]')

3. Any qualification of runtime not recognized will be ignored


These alternative forms permit to transport a program from one operative ambient to
another w/out to modify OPEN. In the actual implementation, these alternative forms
are ignored.

--------------------------------------------------------------------------------- END
0 !+ 4
K
4.4.19. PUT
The instruction PUT executes a binary output with casual access. The content of
choosen area data is sent to the specified channel. There is not record terminator.
Syntax:

PUT(canale, area_dati, recnum)

Where:

channel is an expression arithmetical whose value specifies the file channel of


destination. The channel must be already open in mode OUTPUT or
UPDATE.

area_data is a variable alpha whose content has to be sent. The length of variable
determinates the number of characters to transmit.
In other words, the variable A623 indicates a data area to send 623 characters. If the
channel is open in mode UPDATE, a trial to exceed the physic end file will cause the
error”number record wrong [#28]”.

recnum is an expression arithmetical that indicates what record must be written. A


value less than 1 causes error”number record wrong [#28]”. The
record number is interpreted depending on the area-data magnitude.
The offset of first character output is calculated as following:

(record - 1) * (length area_dati) + 1

Discussion:
The instruction PUT is one of four instructions HBL for I/O binary; The other 3 are:
GET,GETS,PUTS. These instructions don’t interpret the characters during I/O. In fact,
any character is considered a binary value of 8 bit. In I/O process, the terminators
record
are not inserted or disinherited automatically. The program maintains the control of
content output file and can control any character in input file.

Examples:
Assuming for valid the following instructions of Data Division:

KPUL;
RECORD
AREA1, A38
AREA2, A1967
AREA3, A5

The following are examples of instructions PUT:

PUT(12, AREA3, 157)

Sends the 157th group of 5 byte to channel 12.The record inits at 781st byte from
init file.

PUT(3, AREA2, RECNO)


Sends the RECNO’s group of 1967 byte to channel 3.
0 !+ 4
K
4.4.20. PUTS
The instruction PUTS executes an output binary with sequential access, sending the
content of chosen area data to specified channel. No terminator of record is affixed.

Syntax:

PUTS(channel, area_data)

Where:
channel is an expression arithmetical whose value specifies the channel of destination
file.
The channel must be open already in mode OUTPUT.

area_data is a variable alpha whose content has to be sent. The length of variable
determinates the number of characters to transmit.
In other words, the variable A623 indicates a data area to send 623 characters, and it
will make possible write 623 characters. If the output exceeds the physical max
capacity of disk, will be given error “disk space not enough [#24]”.

Discussion:

The instruction PUTS is one of four instructions HBL for I/O binary; The other 3
are: GET,GETS,PUT. These instructions don’t interpret the characters during I/O. In
fact,
any character is considered a binary value of 8 bit. In I/O process, the terminators
record
are not inserted or disinherited automatically.

KPUTS;
Examples:
Assuming for valid the following instructions of Data Division:

RECORD
AREA1, A38
AREA2, A1967
AREA3, A5

The following are an example of instructions PUTS:

PUTS(12, AREA3)
Sends the 5 byte contained in AREA3 to channel 12. Because the PUTS permits an
access sequential, the output starts at next character of channel; that is, the character
follows last information exchanged with the file.

PUTS(3, AREA2)

Sends a record of 1967 byte to channel 3.


0 !+ 4
K
4.4.21. READ
The instruction READ executes an input of casual access of record from a channel
selected in area data of call. This instruction can be used both for a file ISAM and
for one not ISAM..

Syntax:

Where:
channel is a decimal expression whose value specifies the channel of file to read. The
channel is to be already open in mode I,U,U:R,SI or SU.

area-data is a variable alpha that is receiving the input.

record_id indicates which record will be read. For a file not ISAM the record_id is
the position ordinal of record in file; the first one has number 1, the
second has 2 and so by the way.
For a file ISAM, record_id is the key field value of record to
designate the input.
If the key value is longer than key field of record, will be used only
the first part of key value to find again the record. If the key value is
shorter than key field, it is called key partial, and system searches the
first record whose key starts with specified value. If there are not key
fields initiating by the specified key value, will back the first record
with key value higher and it will give error of “key not same” (#53).

keyref is an optional expression decimal that specifies a implicit key or reference.


The value zero specifies the primary key, the value 1 specifies the
first alterative key and so by the way. If is not specified the reference key the
default is the primary key (KRF=0).

KREAD;
Discussion:
The instruction READ searches a specified record from a file,the instruction REDAS,
instead, searches next sequential record.

For file ISAM, the specified value of key indicates which record is to be searched
(see the below examples).
Per file non ISAM, l' ordinale specificato indica quale record deve essere cercato. Il
For file not ISAM, the ordinal specified indicates which record is to be searched .The
runtime assumes that the records contained in file have all the same length of area
data searched.
Basing on this length and on the ordinal number of record to be searched, the
runtime determinates the position in file of the first character of record.
After found the init of record, is executed a normal transferring of type READS. See
the instruction READS in section 4.4.22, for details about transferring.
If the READ is used with a open channel in mode UPDATE, is on a normal control
of block of records.
So that, if READ is referring to a blocked record from some other channel, will give
an error of “Record blocked”(#40). If the program does not manage the errors, it’s
considered fatal and the program ends.
The records blocked don’t exist in mono-use and in mono-work.

Examples:

READ(5, CUSMAS, '01355')


READ(5, CUSMAS, '01355', KRF=0)
READ(5, CUSMAS, KEY, KRF=1)

In addition of the above method above mentioned, there’s also an implicit method to
specify the reference key. If there aren’t specifications KFR, and if key field is a
variable, and the variable is inside of definition of record, that key record will be the
key ref.
For example, assuming the disposition of a file ISAM:

RECORD CUSTO
CUNUM, D5
CUNAM, A25
CUSTA, A2
, A40

Where CUNUM IS the primary key, CUNAM is the first alternative key and CUSTA
is the second alternative key.
The two following ensemble of code will be equivalent:

READ(3, CUSTO, 'NY', KRF=2)

CUSTA = 'NY'
READ(3, CUSTO, CUSTA)

Each assemble of code will find the first record whose the second alternative key is
‘NY’.
Note that if is not present any alternative key of reference,(that is not specified any
“KRF=”),and do not exist the condition for specify reference to an implicit key, then
the READ will access to the primary key of file.
0 !+ 4
K
4.4.22. READS e READB
The instruction of READS executes an input with sequential access on the records
from selected call area data. The instruction can be used both for file ISAM and not,
to search for next sequencial record.

Syntax:

READS(channel, area_dati [,label])


READB(channel, area_dati [,label])

Where:
channel is an expression arithmetical that indicates the file channel to read.

area_data is the variable alpha receiving the record.

label is an optional label in which is tranfered the control, if happens an error of “End
file”.

Discussion:
The instruction READS looks for next file record.For file not ISAM, with the term
“next” we refer to the record that follows phisically the read record or the most recent
written record by file. If READS is the first action of I/O of channel, the input starts
by the first character of file.
.
For file ISAM, the “next” is intended the record that is following logically the read
record most recently from file by a READ or a READS. The READS searches a
record ISAM with duplicated keys after that a READ did allocate and found the first
record of the assembly.
For file not ISAM, are transferred the characters to area_data till:

a) we encounter a record terminator;


b) we reach the phisical end of file;
c) we encounter an end-of – file;
d) the area data is full.

If we encountered an end-of-file or reach the max extension file, will give error
“End file [#1]”.

KREADS;READB
If the area_data is full before to encounter a record terminator, will signal “line too
long[#23]”and the input characters are ignored till we have another condition of
termination.
I f encountered a terminator of record before area_data is full; the space remaining
will be filled by blank.
To determinate the length of read record, including all characters that can be inserted
in the area_data, we can use the function intrinsic $RDLEN or the external subroutine
RSTAT.
A record terminator is a line feed or a formed or a vertical tab for all the file and
terminals.
For terminals also the character escape is considered a terminator standard. More
over, we can define till 10 characters terminators in external subroutine ACCHAR.
The record terminators end the operation of I/O and they, never, can’t be transferred
to area_data.
Note that, although they are not record terminators, the carriage return, the character
null and delete are ignored and they are not transferred in area data during the input.
For a file ISAM, being defined in phase of creation the length of each record, if the
record is bigger than area data, will be transferred only the portion more at left of the
record and will be not signal error.

If the record is smaller than area data, the record is allocated with a justification to
left by blank.
Se si usa la READS con un canale aperto in modo SU, i record vengono bloccati.
Così , se la READS si riferisce ad un record bloccato da qualche altro canale, si ha l'
errore "record bloccato [#40]";
If we use READS with a channel open in mode SU, the records are blocked. So
that, if READS is referred to a blocked record by some other channel, we get error of
“blocked rcord [#40]”,if the program doesn’t manage the errors, this one is considered
fatal end the program ends.
We can control the management of blocks using the XCALLDFLAG.
The instruction READB acts similarly to READS, but is permitted only on files
ISAM and allows to access to the record before the last read.
In this case, the condition of “end file” will happens if we try to read before the first
file record. The instruction can be used to read last file record ISAM, after is
happened the condition of “end file” by a FIND or by a READS.

Examples:

READS(12, RECRD)
It finds the next record of channel 12. If there’s no record in file or we encounter an
end-of-file, is generated the error “end file [#1]” and program stops.
More over if the length of read record is longer than the length of RECORD, is given
error of line too long [#23] and the program stops.

READS(12, RECRD, DONE)

It’s searching for next records. However, if there aren’t records present in file, the
control is transferred to the instruction labeled DONE.

READS(3, ISMREC, RETRY)

If in channel 3 is open a file ISAM in mode SU, the READS can be subjected to a
control of blocked records. In the previous case, the control is transferred to
instruction labeled with RETRY, when there are no more elements in file.

ONERROR HLAST
FIND(3, ISMREC, '~~~~~')
LOOP, READS(3, ISMREC)
GOTO LOOP
HLAST, OFFERROR
IF($ERNUM.EQ.53)GOTO LOOP ; Key not SAME
IF($ERNUM.NE.1)GOTO ERMES ; Other errors STOP
READB(3, ISMREC, EMPTY) ; Read backward

In this examples, we are positioned to last record of file ISAM, indicating, as key
with value high, presumable not existent;
if the key does exist , anyway, we run sequentially the file till encounter an error.
In the block of error control, we check if the error corresponds to “end file [#1]” and
Successively, we execute a reading backward to download last file record.
To be noted that, if the file ISAM is empty, the control will pas to instruction
labeled with EMPTY.
0 !+ 4
K
4.4.23. RECV
The instruction RECV receives a message sent by an instruction SEND previously
executed in the same or in other program. The instruction RECV can communicate
between programs
or between different terminals, or between programs concatenate executed after the
program that is sending the message.
Syntax:
RECV(message, label, [, id, length])

Where:
message is a variable alpha in which will be memorize the received message, with a
justification to left by blank. If the message received is longer than the area receiving,
only the portion of message more to left is received, the remain is ignored.
label is a label in which transfer the control if no message is available. The subroutine
external DFLAG can set the mode “wait for messag”.

id is a variable alpha optional that specifies the name of message (from 1 to 6


characters).
If id is omitted or specified as [self], the message ID is considered to be in the first 6
characters of name of receiving program (with a justification to left
with blank). If ID is included, also the parameter length must be
specified.

length is a variable decimal containing the length of received message.


the considered length is the one of received message, including also the part that can
be truncated.

Discussion:
When a message is sent by an instruction SEND, it is assigned to ID specified.
This message can be received only when the same ID is specified in instruction
RECV. If some message are put in suspend by the same ID, they are received by an
order first-in,first-out (FIFO).

If variable length has an initial value minor than 0, the instr. RECV acts in mode
not destructive; any message received is not deleted from queue of messages, so that
it can be received again.

KRECV;
If the value length is bigger or equal to zero, the message is deleted and cannot be
received again.

Examples:

RECV(MSG, NONE)

Asks to receive a message with an ID of “ABC”( if the name of program receiving is


ABC).If no message available, the control self transfer itself to instruction labeled
with NONE.
RECV(MSG, NONE, '[MINE]', LNG)

Requires receiving a message with ID “[MINE]”. If this is not present, the control
passes to NONE.
If it’s present, is received and his length is assigned to variable LNG. If the value of
LNG is initially negative, the message will not be removed from queue and other
instruction RECV with the same ID will receive the message.

RECV(MSG, NONE, '[SELF]', LNG)


Is the same of above, with th exception that the message ID is the name of program.
The specification of ID [SELF] permits to use the same queue receiving in several
programs, w/out specify different ID in any other program.
0 !+ 4
K
4.4.24. RETURN
The instruction RETURN does the control backs to instruction that follows the
instructions CALL or XCALL executes more recently.
Well-known as the return from a subroutine, this instruction signes the logic end of
subroutine. If is executed the RETURN w/out be present a CALL or XCALL, will be
given error “return without call (#2) and the program stops.

Syntax:

RETURN

Discussion:
The system is capable to remember the calls succeeding to subroutines, because they
can be nestled.
The execution of instruction RETURN, permits to back to the most recent call. In the
following example is represented a section of code of program and any line is
numbered. A trace of number of lines follows in the order in which they are executed.

Example:

1 CALL SUB1
2 CALL SUB2
3 STOP
4 SUB1, CALL SUB3
5 RETURN
6 SUB2, RETURN
7 SUB3, CALL SUB2
8 RETURN

Order of execution of lines of code

1 code of main
4 SUB1
7 SUB3
6 SUB2
8 SUB3
5 SUB1

KRETURN;
2 code of main
6 SUB2
3 code of main
0 !+ 4
K
4.4.25. SEND
The instruction SEND sends a message to program. The system saves the message
till it will be received by an instruction RECV in this or in another program.

Syntax:

SEND(message, id)

Where:
message is a variable alpha containing the message to be sent. The length max of
message depends on operative system in use.
id is a variable or a constant alpha which value contains the characters (from 1 to 6)
of name that identifies the message. Only an instruction RECV with
the same ID can receive the message. If the value of variable alpha is
longer of 6 characters, will be used the first 6 characters at left only.

Discussion:
There are two special interpretation of message ID:[SELF] and [INIT].
[SELF] makes the message ID be the name of sender program, this characteristic is
used when a program sends a message intending to receive it later.

The ID [SELF] also avoids the necessity to update the ID and assure that the sending
and receiving will function in the mode wanted. The ID [INIT] makes no messages
will be sent.
In fact, [INIT] deletes all messages pending from terminal associated to program.
Examples:

SEND("Will received this letter:", '[SELF]')


Sends a message that can be received later by use of sending program(or [SELF] as
ID receiving.

SEND('A message for text A.', MSGID)

Sends the indicated message and uses the content of MSGID as ID of message.

KSEND;
0 !+ 4
K
4.4.26. SLEEP

The instruction SLEEP suspends the execution of program for the number of
second’s indicated. After this time, the execution restarts from the instruction that
follow the SLEEP.

Syntax:

SLEEP interval

Where:

interval is an expression arithmetical whose value is the number of seconds in which


the program will be suspended. The interval must be included between 1 and 65535.
The values less than 1 will not suspend the program; the values bigger than 65535
will generate the error: “Number too big” (#15).

KSLEEP;
0 !+ 4
K
4.4.27. STOP

The instruction STOP terminates the program execution and passes the control to
another program or to monitor.
Syntax:

STOP [program]

Where:

program is an optional variable alpha that specifies the name of program to which
transfer the control; if omitted, the control backs to monitor.
The file indicated by program must be a file of executable code, not
necessarily a program HBL.

Discussion:

After instruction STOP, is not executed any instruction of program.

All the channels of I/O that were closed before instruction STOP are closed (in
mode equivalent to action CLOSE), with the exception of the channels open in mode
OUTPUT, whose file associated will be cancelled.

If the file of specified program can’t be found, there will be an error: “file not
found” (#18).

KSTOP;
0 !+ 4
K
4.4.28. STORE
The instruction STORE is used exclusively for file ISAM. It will make a record
added to file.

Syntax:

STORE(channel, area_data, key)

Where:
channel is an expression arithmetical that indicates the channel of destination file. The
channel must be already open in mode SU.

area_data is a alpha variable whose content represents the record that will be
memorized in file ISAM.

key is a variable alpha that specifies the primary key which the record will be
associated.
The value of key determinates the logic position in the file record ISAM and must be
equal to key field of record.

The field key of record is contained in area_data with position and length defined in
the creation of file ISAM. If the length of key value is different from
the length of defined key, we have error “key not same”(#53).

Discussion:

If the instruction STORE is used with a channel open in mode I or U, will be


error:” is not a file ISAM”(#56). If the channel is open in mode SI, will generate the
error:” Mode OPEN wrong” (#21).
If no space is available, we get error:” out of space for ISAM”(#112), but not in the
current implementations.

If the defined file does not permit the duplication of keys, and the record that we
want memorize has key identical to one of a record already present in file, will get
error of “duplication keys not permitted”(#54).

KSTORE;
If the length area_data is longer than defined length for record of file ISAM, will be
transferred to file only the portion more at left of record. If the length of area_data is
shorter, the record is sent to file and the remaining space is filled by blank.

examples:

STORE(3, ISMREC, '..DOT..')

This instruction memorizes the information contained in ISMREC and indicates that
“..DOT..” is the value of record key.
If the key field has a magnitude different from key value or is not equal to content of
key value, we’ll get error:” key not same” (#53).If in file ISAM there’s not space will
get error:
“Out of space for ISAM”(#112).
0 !+ 4
K
4.4.29. UNLOCK

The instruction UNLOCK frees all the blocked records associated to the called
channel.

Syntax:

UNLOCK channel

Where:

channel is an expression decimal that specifies a channel of file to be unlocked.


the channel must be already open in mode UPDATE or SU; if it was open in other
mode, UNLOCK will be ignored.

Discussion:

After executed the instruction UNLOCK, are accessible those data that previosly
were inaccessible for the block of record.
Note that UNLOCK is implicit as last action executed by instructions CLOSE,
DELETE, WRITE and as first action executed by instruction READ.

The instruction READS executes implicitly an UNLOCK only when advance to next
block of data file.

So that, further operations of REASD, can recuperate many records w/out have to
block them. This is done to minimize the inter action with the operating system, that
should be instead requested.
In an ambient mono-user, there’s not blocking of records and this instruction is
ignored.

KUNLOCK;
0 !+ 4
K
4.4.30. UPCASE

The instruction UPCASE converts the small characters to capital. More than
convert the alphabet letters, UPCASE alteres the special characters listed in
section Discussion.

Syntax:

UPCASE variable

Where:
variable is a variable alpha containing the characters that will be converted’
The whole sequence of characters is analyzed and any character
is converted to capital, if is alphabetical, or in one of the here
below listed characters:

Discussion:

Are also converted the following special characters:

Small Capital

` (096) @ (064)
{ (123) [ (091)
} 9125) ] (093)
| (124) \ (092)
~ (126) ^ (094)

examples:

Consider the program:

RECORD
FLD1, A14

KUPCASE;
PROC
FLD1 = 'just a {demo} .'
UPCASE FLD1(4,11)
UPCASE FLD1
STOP
END
Ad FLD1 is assigned initially the value:

just a {demo} .

The first UPCASE converts the value to:

jusT A [DEMo} .

The last UPCASE converts the value to:

JUST A [DEMO].
0 !+ 4
K
4.4.31. WRITE
The instruction WRITE executes a casual access output on the records
of specified channel. The instruction WRITE is used to rewrite the
records already present in file,both file ISAM and not ISAM.
Syntax:

WRITE(channel, area_data, record_id)

Where:
channel is an expression arithmetical whose value specifies the channel
of destination file.
The channel must be already open in mode OUTPUT,UPDATE or SU.

area_data is a variable alpha containing the information to be sent.

record_id indicates which particular record must be sent. For a file not
ISAM, the record_id is a decimal variable, whose value is
the ordinal number of desired record; the first record is
number 1, the second is number 2,and so, by the way.
For the ISAM file, the record_id is a variable alpha
containing the value of primary key, that determinates the
logic position of record in file ISAM.
If the length of key value is not same to the length of key
field, we get error:” key not same”(#53).
The key field is contained in area_data; his position and
length are defined when the file ISAM is created. If the
content of key field is not equal to the value of specifies
key, we get error "key not same" (#53).

Discussion:

KWRITE;
For a file ISAM is written a record got from last instruction READ or
READS. Note that
is not possible do other I/O operations between READ/READS and
WRITE.
If some other operation of I/O are done, is generated the error "key
not same" (#53).
If a key is not specified as to be modified when we create the ISAM
file,( is not possible to do different in the actual implementations),and
we try to modify this key during the WRITE, we get error: "Key not
same" (#53).
For file not ISAM, is written the record with the specified ordinal
nmber. The length of area data and the ordinal number of record
determinate the offset in file, where to start write. A number of record
minor than 1 or bigger of the number of records that can be stored
physically in file gives error: “Number record wrong” (#28).
After that is written the content of are_data in a file not ISAM,is put a
record terminator standard(generally a carriage return and a line feed).
These record terminators split the records adjacent in the file. When the
record will be read later, by instructions READ or READS,the
terminator record will complete the input, but will not be transferred to
receiving area data.
When the instruction is used in file open in mode UPDATE or SU, in
ambient many users, the written record is unlocked.

Examples:

WRITE(12, REC, 42)

This instruction tries to write the 42nd record in a file not ISAM. If
this record was not blocked before by channel 12, the WRITE tries to
lock it before to modify it. If the record is locked by other channel, we
get error. After that record is written, is unlocked.
WRITE(4, ISMREC, KEYVAL)

This instruction tries to rewrite a record on a file ISAM that was read
previously and whose value of key is same to value of KEYVAL. If
the value of key is not the same, we have an error. If the record is
rewrite, after is unlocked.
0 !+ 4
K
4.4.32. WRITES

The instruction WRITES executes an output with sequencial access to


records on specified channel. This instruction can be used only for file
not ISAM.

Syntax:

WRITES(channel, area_data)

Where:

channel is an expression decimal whose value specifies the channel of


destination file.
The channel must be already open in mode OUTPUT.

area_data is a variable alpha containing the information to be sent.

Discussion:

The instruction WRITES writes a record immediately after the most


recently read record or record written on output file.
The information written in area_data end by a standard record
terminator,(generally by a carriage return and a line feed). The
terminators are transferred to receiving area data.

Examples:

WRITES(2, RECA)

KWRITES;
This instruction writes a content of RECA on channel 2. If the disk is
full, we get error#22 and the program is terminated.
0 !+ 4
K
4.4.33. XCALL

The instruction XCALL transfers the control to a subroutine external


linked to main program module.
The external subroutines are both module of instructions HBL and
modules created by user, as explained in this manual.
These last kind of external subroutines are created as modules of
program that start by instruction SUBROUTINE.

Syntax:

XCALL subname [(arg_list)]

Where:
subname is the name of external subroutine to which transfer the
control;
are significant only the first 5 characters of name,
the remain characters are ignored.

arg_list is a list optional of arguments that can send information to ext.


subroutine. The number of arguments must be equal to
number arguments defined by program source of external
subroutine, as part of instructions SUBROUTINE. Each
argument can include any variable, or expression, or
constant HBL valid. If there’s more than 1 argument, they
are separated by a comma.
Note that the expressions and the constants are values that subroutine

KXCALL;
can’t modify; if it tries, is generated error “writing on
literal [#8].

Discussion:

Any time the control is transferred to external subroutine, it does not


return to program calling, till the subroutine executes the instruction
RETURN correspondent to XCALL.
Then the control re-starts from the instruction that is following the
instruction XCALL.
The management of ONERROR of calling program is disabled when
the subroutine does his process; once that the control returns, the
trappable errors are re-established.
EXAMPLES:
Calling Program:

RECORD
ARG1, A5
ARG2, D7
ARG3, A12
PROC
OPEN(15, I, 'TT:')
.
.
.
XCALL DISP(ARG2, ARG3)
.
.
.
STOP
END

Subroutine External:

SUBROUTINE DISP
VAR1, D
VAR2, A
RECORD
FIELD, A15
PROC
FIELD = VAR1, 'ZZZ.ZZZ.ZZZ,XX-'
DISPLAY(15, VAR2, 'results in ', FIELD, 13, 10)
RETURN
END
0 !+ 2
K
5. CAPITOLO V: INSTRUCTIONS OF DIRECTION TO
COMPILER

The instructions described in this chapter are not executable and are
only to direct the action of compiler HBL. Only the instruction PROC
is required in program HBL.The other is facultative.

KDIRECTION FOR COMPILER;


0 !+ 3
K
5.1. PROC

The instruction PROC marks the end of Data Division and beginning
of Procedure Division.
It specifies also, optionally, the value of default of factor of blocks for
an open file by program.

Syntax:
PROC [(factor)]

where:

factor is a constant decimal optional that represents the value of default


of factor of blocks for an open file by program.

To each file not ISAM open, is assigned an area buffer of I/O that
consists of blocks of 512 byte each.

This factor specifies the number of blocks that will be assigned to


buffer of file I/O.
The max factor is of 16 blocks. If the factor is omitted, is assigned a
block.
This value is ignored in the current implementations.

KPROC;
0 !+ 3
5.2. END
K

The instruction END marks the logic end of the whole program.

Syntax:

END

Discussion:

When we encounter the instruction END, the whole program is ended.

KEND;
0 !+ 2
K
6. CHAPTER VI: NOTE OF PROGRAMMING

By what we have seen in previous chapters, the language HBL


doesn’t allow the structured programming.
For that reason, occurs that the programmer adopt the opportune
practical regulations to avoid transform his program in the classic
“minestrone disc”.
Despite of the language doesn’t allow the structures, is needed to
formalize the analysis of program as the logic structures fundamental
listed in figure 1.
Complex programs can be overtake following the technique TOP-
DOWN, in which each block has a single in and a single out.
We have not to worry, in this phase of eventual redundancies done by
previous links. From fig.1, is derived that the FIRST LETTER of any
label can be:

L - Indicates a return for loop(WHILE/REPEAT/FOR)


I- Indicates beginning og generic block, that is out by X....
X- Indicates out from generic block
V- Indicates the label VERO, on IF..THEN..ELSE VERO =
TRUE
y- Label for selection from CASE(GOTO calculated)
H- Actions for conditions of error trappable.
S- Indicates beginning of subroutine internal (out=X…)
R- Re-entry after control error H*

The label ‘EXIT’ in a program means the point of single output of


each program or subroutine. The operations allowed after the label
EXIT, must be made for NOT generate ERRORS and/or more returns.

KNOTE OF PROGRAMMING;
Each program should contain a STANDARD HEAD in the way to be
self documental.
The use of graphic in comments is regulated by following normative:

a) To split the functional blocks (input/i-output) is used the line


continuous, starting from column 1:

;-----------------------------------------------------------
; Determination of tax unit
; category and area
;-----------------------------------------------------------
ICAIU, ............ ; Comment
............ ; Comment
XCAIU, ............ ; Comment
............ ; Comment
;-----------------------------------------------------------

b) Eventual sub-blocks, inside of main blocks, must be split, by TAB


identity:
;-----------------------------------------------------------
ICAIU, ............ ; Comment
............ ; Comment
;--------------------------------------------------
IDTEFA, ............ ; Comment
............ ; Comment
XDTEFA, ............ ; Comment
;--------------------------------------------------
XCAIU, ............ ; Comment
;-----------------------------------------------------------

c) The comment to an instruction must be inserted from column 41


(5tab)
And continue in next row, if necessary. The instructions longer are to
be commented in the next row:
IF(TBFAS.GT.5)IMPOU=IMPOU+100 ; Comment
.............................
IF(IMPOR(UN5).EQ.IMPMI(UN5))GOTO KCALC1
; Comment
..............................
RIPOS=RIPOS*1000 ; Determinates real import
; because RIPOS was
; rounded.
..............................
d) In queue to program, are to be inserted the subroutines internal
generic
(Used by any block of program), separating this are by double row
continue:
;
=====================================================
======
; DECODIFICA CODICI CATEGORIE: Input TBCCT, UTCON,
TBVFA()
; Ouptut TBCAT, TBIMU, TBDES
;
=====================================================
======
SDECAT, ............. ; Comment
............. ; Comment
XDECAT, ............. ; Comment
RET ;
;
=====================================================
======
; ................................
0 !+ 3
K
6.1. Classic Schemes Recurrent

In this paragraph will be shown typical situations of program and the


trace for a correct codification following the previous regulations.

6.1.1 CALL with many inputs and only one output


.
To optimize the use of subroutines, can be necessary that a block has
more than one entry point.
In this case, more than specify opportunely the possible inputs in the
comment of call, we add a numerical suffix to labels of input, leaving
zero for the common input.
The common output will have the same suffix of input label common.
EXAMPLE:

;
=====================================================
=====
; Management scroll in region video composed by NRIG
; ( > 1) starting from RIMIN. Uses the vector
; VRIGH(NRIG),already put.
; ENTRY POINT:
; 1 = scroll up 2 = scroll down
;
=====================================================
====
SCROL1, RITOD=RIMIN ; Row to delete
RITOI=RIMIN+NRIG-1 ; Row to insert
GOTO SCROL0 ; Do scroll
SCROL2, RITOD=RIMIN+NRIG-1 ; Row to delete

KClassic Schemes Recurrent;


RITOI=RIMIN ;
SCROL0, DISPLAY(99,$P(RITOD,1),$C(DELL)) ; Delete
DISPLAY(99,$P(RITOI,1),$C(INSL)) ; insert
DISPLAY(99,VRIGH(RITOI-RIMIN+1))
; Visualizes row inserted
XCROL0, DISPLAY(99.$P(RITOI,1)) ; Put cursor on
RETURN ; row just inserted
;
=====================================================
====

N.B. Eventual blocks sequential with many inputs, are same to structure
“CASE”.
6.1.2 Programs of printing type HEAD-BODY-TAIL

The programs, that print a tabulate, are generally assimilated to the


following structure BASE:

;----------------------------------------------------------
; Prints tabulate with head from ROWS row, body formatted
; by elements each of RIGBO rows (fixed), foot from RIGFO
; row and page from RIGBO rows net.
; (example : 66-RIGFO-margin-RIGBO)
;---------------------------------------------------------
...initialization, open,.....
initialization masck;
RIGST= ; Row Counter
READ first element ;
LSTAMP, IF(finished elements)GOTO XSTAMP ;
IF(RIGST)GOTO VSTAMP ; should be
:IF(ROWPRINT)GOTO VPRINT
. positioning and print head
RIGST=ROWS ; Declares printed rows
..eventual positioning on body
VSTAMP, ..Prints body ;
RIGST=RIGST+RIGBO ; Counter printed rows
IF(RIGST.GE.RIGLP)CALL SSTAFO
; Control paging
READ next element ;
GOTO LSTAMP ;
SSTAFO, ..eventual positioning in footer
..print footer ;
FORMS(15,0) ; Page jump
RIGST= ; Counter reset
RETURN ;
XSTAMP, IF(RIGST)CALL SSTAFO ; Print end
.. end file/printer ;
;-----------------------------------------------------------
In the case that each element of body has not fix length, occur preset
an opportune routine of pre-calculation of encumbrance (RIGBO):
...............................
RIGST= ; Rows counter
READ first element ;
CALL SSTAHE ; Head print
LSTAMP, .. Algorthm calculation RIGBO ;
RIGST=RIGST+RIGBO ; Pre-calculation RIGST
IF(RIGST.LT.RIGLP)GOTO VSTAMP ; Goto print body
CALL SSTAFO ; Print footer
CALL SSTAHE ; Print head
RIGST=RIGST+RIGBO ; Re-calculation position
VSTAMP, ..Print body ;
READ next element ;
IF(finiti elementi)GOTO XSTAMP;
GOTO LSTAMP ; ------------------------
SSTAHE, ..positioning and print
RIGST=RIGHE ; Declares rows printed
..eventual positioning on body
RETURN ; ------------------------
SSTAFO, ..eventual positioning on footer
..print footer ;
FORMS(15,0) ; Jump page
RIGST= ; Reset counter
RETURN ;
XSTAMP, IF(RIGST)CALL SSTAFO ; Print closing
.. closing file/printer
;----------------------------------------------------------
0 !+ 2
K
7. CHAPTER VII: COMPILATION AND DEBUG OF PROGRAMS

This chapter describes the compiler use, linker use and how to create
a library of external subroutines. In 7.4 will be explained the use of
debug symbolic.
The plate-form foreseen for develop is SCO UNIX, but is possible
execute the produced programs in one of plate form supported by RUN-
TIME.
To choose UNIX is due essentially because this operative system is
versatile for the software developers.

KCOMPILATION AND DEBUGGING OF PROGRAMS;


0 !+ 3
K
7.1. Compilation of a program or Subroutine

To compile one or more programs, we use the command:

hbc [-s] <lists files with extention .DBL o .dbl>

The command transforms each program sourcing from list in module


object, to link later with eventual subroutines external, to produce the
executable program.
Any generated file will have the same name of source, but with
extension
.HBO or hbo.
The option “-s” instructs the compiler to generate, at end
compilation, the map of memory used by program. A typical map of
memory as follows:

COMMON IDENTIF.: 25 127


GLOBAL IDENTIF.: 71 237
RECORD IDENTIF.: 29 399
CONSTANTS : 45 354
GLOBAL SECTION : 1
XCALL : 5
LABEL : 12
INSTRUCTIONS N: 88 size: 352
CODE : 1066
DATA : 1117
DESCRIPTORS N: 170 size: 1360

And we read as:

KCompilazione di un Programma o di una Subroutine;hbc;


-25 finders of variables type COMMON are utilized
(Fields and finders of record COMMON) that occupies 127 bytes
of memory.
- 71 finders of variables type GLOBAL are utilized (defined
internally to GLOBAL SECTION) that occupies 237 bytes of
memory.
-29 finders of variables type LOCAL are utilized (fields and
finders of local RECORDS) that occupies 399 bytes of memory.
-45 constant were utilized, that occupy, by their definition, 354
bytes of memory.
-Only one GLOBAL section was defined
-The program re-calls 5 different subroutines external
-12 labels for recall were utilized.

Those labels are not occupying memory in the program object


generated.
-The program is composed by 88 instructions of PROCEDURE
DIVISION that occupies, for their definition, 352 bytes of
memory.

-
-The code completed really occupies 1066 bytes of memory.

-The complete area data


(COMMON+GLOBAL+RECORD+CONSTANTS) occupies
1117 bytes of memory.

-The definition of all the 170 (25+71+29+45) descriptors of


variables and constants, that will be used by debug symbolic,
occupies 1360 bytes of memory.
This occupied memory will be released when will be not necessary
to execute the symbolic debug, by the command hbstrip.
0 !+ 3
K
7.2. Link of Modules Object

To construct the executable program, we use the command:

hbl [-d] nome_main <lista subrout.> <lista librerie>


hbl [-d] name_main <list subrout.> <list library>

The command accepts, as first argument, the name of main, then the
names of eventual subroutines external recalled and finally the list of
library from which get the subroutines reference d, but not previously
listed.

The extension of default for object modules is .HBO, while the


libraries have extension .OLB.

The option “-d” instructs a linker to remove the information


symbolic for debug, from object modules (see last row of map of
memory given by hbc).
That information can be removed, after link, by command “hbstrip”.

During the phase link, are resolved the reference to variables


COMMON or GLOBAL, and are controlled the length declared in
various modules.
If does exist incongruence, will be signaled error and the executable
program will not be generated.

If a module is specified in command line, but is present also in


library, will be included only the one indicated in command line.

If is Indicated a module in command line, that is not recalled by any


other,

KLink of Modules Object;hbl;


the module will be included anyway in the program, but there will be
an useless augment in the dimension of executable program.
The command line can continue in following rows, using the character
"\"
at end row, as convention of shell UNIX.

Once compiled correctly a program, we can execute it by the command:

hbr name_program
0 !+ 3
K
7.3. Construction of library of Subroutines

From what we have seen before, to avoid to write a command line


for links too mach long and to avoid to include useless modules,
it may be necessary define the subroutine’s library external,that will
be used by more programs.To do this we can utilize the command:

hblib <cmd> name_library <list subrout.>

where <cmd> can be:

-c to create a new library from list subroutines specified.We can


use the character"\" to continue the list on next rows.

-a to add subroutines to an existent library.

-l to have the list of subroutines included in an existent library.

The generation of library doesn’t comport controls in definition of


variables COMMON or GLOBAL. Only in phase of link, when will be
indicated the main of reference, we can proceed to those controls.

KConstruction of Library of Subroutines; hblib;


0 !+ 3
K
7.4. Debug of Programs

To easier the program errors finding, HBL allows the possibility to


execute the program in mode DEBUG. to do that, is enough execute
the command:

hbd name_program [options]

The debug uses exclusively the code present in executable program,


forgetting how this was generated.
This permit to do a program in mode DEBUG despite related sources
are not available.
If the table of symbols were taken out from executable program, in
anyway possible execute in mode debug the program, but the
information related to names of variables will be lost.

It’s possible specify, on command line, one of following options:

-l <name_file_trace>
The program is executed normally, but any instruction
executed is traced on indicated file, and permit, at end
execution, to analyze the route done by program.

-m <name_file_list>
This option doesn’t send the program to execution, but
reconstruct on file indicated the listing of program as to
proceeds from executable program.This command is
necessary, when we do the debug of a program, to have
available the opportune reference to insert the break-point in
the wanted points.

KDebug dei Programmi;hbd;


-s

This option, is not making program execution, but lists the


complete map of memory of all the modules and occupations. Is useful
to determinate the structure of executing program.

-t <name_file_log>
By this option, the program is executed normally, but all
characters keyed by keyboard are written on Indicated file.
This option is useful for debugging routines of management
of keyboard, to check eventual combination critical of
characters sequence.

If will not specified any option, the program is loaded, and before
to start execution, is visualized a window of commands.
The list of possible command is shown keying “H”, and they are:

[H] - Visualize list of admitted commands.

[S] - Executes step by step the program’s instructions.

[G] - Executes the program till eventual break-point.

[D] - Permits to modify immediately the content of a variable, by


the following syntax:
D <var>=<value>
or
D <n.descriptor>=<value>

[E] - Checks the content of a variable following this syntax:


E <var>
E <n.descriptor>
E <xcall>:<var>
E <xcall>:<n.descriptor>
where <xcall> Indicates the code progressive assigned to a
subroutine external got from list by command hbd-m

[SE B] - Inserts a break_point, as this syntax: [IF B]


SE B <istruzione> IF B <instruction>
SE B <xcall>:<istruzione>
IF<xcall>:<instruction>
where:
<instruction> is the row of instruction as per list
product of hdb -m
<xcall> is the code of subroutine as seen here above.

[C B] - Deletes a break_point set previously. Syntax:


C B <n.break>
where:
<n.break> is the number progressive assigned to
break_point as listed by command SH B.

[IF S] - Modifies the functionality of command [S]:


IF S I : executes step by step the instructions inside
each xcall encountered.
IF S O : considers the XCALL as an unique instruction,
w/out execute the single instructions inside.
[IF L] - defines the number of instructions to be executed for
step.Example:
SE L 5
at any command S, are executed 5 instructions.

[IF E] - Defines autobreak in case of trappable errors:


IF E ON : break at any back of ONERROR
IF E OFF: takes out the auto-break (default)

[IF V] - Defines a window in which inserts the content of


variables:
IF V ON : Activates window visual.variables
IF V OFF: Takes out window visual. variables

[I] - Inserts a variable in the window to visualize; the syntax is the


same of command E.

[T] - Takes out a variable from window of visualization. Syntax:


T <row>
where:

<row> is the progressive number of row of variable to


take out. Indicating 0, are taken out all the
variables listed.

[SH P] - Visualizes the name of program and the line to execute.

[SH V] - Visualizes the screen w/out windows of debug.

[Q] - Terminates the program of debug.

N.B.:
The visualization of windows of debug is possible only if the
ambient WINDOW was initialized, or if we have available a terminal
with emulator BWINDOW.
In all other cases, the debug operates in modality of line, maintaining
the operative ness by the relative commands.
0 !+ 2
APPENDIX A: SET OF CHARACTERS ASCII
K

SET OF CHARACTERS ASCII (1/2)

CTRL BINARY OCT DEC HEX BINARY OCT DEC


HEX

@ NUL 00000000 000 0 00 SP 00100000 040


32 20
A SOH 00000001 001 1 01 ! 00100001 041
33 21
B STX 00000010 002 2 02 " 00100010 042
34 22
C ETX 00000011 003 3 03 # 00100011 043
35 23
D EOT 00000100 004 4 04 $ 00100100 044
36 24
E ENQ 00000101 005 5 05 % 00100101 045
37 25
F ACK 00000110 006 6 06 & 00100110 046
38 26
G BEL 00000111 007 7 07 ' 00100111 047
39 27
H BS 00001000 010 8 08 ( 00101000 050
40 28
I HT 00001001 011 9 09 ) 00101001 051
41 29
J LF 00001010 012 10 0A * 00101010 052
42 2A
K VT 00001011 013 11 0B + 00101011 053
43 2B
L FF 00001100 014 12 0C , 00101100 054
44 2C
M CR 00001101 015 13 0D - 00101101 055
45 2D
N SO 00001110 016 14 0E . 00101110 056
46 2E
O SI 00001111 017 15 0F / 00101111 057
47 2F
P DLE 00010000 020 16 10 0 00110000 060
48 30
Q DC1 00010001 021 17 11 1 00110001 061
49 31
R DC2 00010010 022 18 12 2 00110010 062
50 32
S DC3 00010011 023 19 13 3 00110011 063

KSET OF CHARACTERS ASCII;


51 33
T DC4 00010100 024 20 14 4 00110100 064
52 34
U NAK 00010101 025 21 15 5 00110101 065
53 35
V SYN 00010110 026 22 16 6 00110110 066
54 36
W ETB 00010111 027 23 17 7 00110111 067
55 37
X CAN 00011000 030 24 18 8 00111000 070
56 38
Y EM 00011001 031 25 19 9 00111001 071
57 39
Z SUB 00011010 032 26 1A : 00111010 072
58 3A
[ ESC 00011011 033 27 1B ; 00111011 073
59 3B
\ FS 00011100 034 28 1C < 00111100 074
60 3C
] GS 00011101 035 29 1D = 00111101 075
61 3D
^ RS 00011110 036 30 1E > 00111110 076
62 3E
_ US 00011111 037 31 1F ? 00111111 077
63 3F

LEGEND:

NUL Null Car VT Vert.Tab. SYN Synchronism


SOH StartHEAD FF Feed Forw. ETB End Trans.Block
STX Start text CR Carr.ge Ret. CAN Cancel
ETX End text SO Shift out EM END Media
EOT End Transmis. SI Shift in SUBSubstitution
ENQ Enquiring DLE DataLink esc ESC Escape
ACK Acknow. DC1 Dev Ctrl 1 XON FS FileSeparat
BEL Bell DC2 Dev Ctrl 2 GS GroupSeparat
BS Back Space DC3 Dev Ctrl 3 XOFF
RSRecordSeparator
HT Horiz.Tab. DC4 Dev Ctrl 4 US UnitSeparator
LF Line forward NAK Not Acknowl. SP Space
SET OF CHARACTERS ASCII (2/2)

BINARY OCT DEC HEX BINARY OCT DEC HEX

@ 01000000 100 64 40 ` 01100000 140 96 60


A 01000001 101 65 41 a 01100001 141 97 61
B 01000010 102 66 42 b 01100010 142 98 62
C 01000011 103 67 43 c 01100011 143 99 63
D 01000100 104 68 44 d 01100100 144 100 64
E 01000101 105 69 45 e 01100101 145 101 65
F 01000110 106 70 46 f 01100110 146 102 66
G 01000111 107 71 47 g 01100111 147 103 67
H 01001000 110 72 48 h 01101000 150 104 68
I 01001001 111 73 49 i 01101001 151 105 69
J 01001010 112 74 4A j 01101010 152 106 6A
K 01001011 113 75 4B k 01101011 153 107 6B
L 01001100 114 76 4C l 01101100 154 108 6C
M 01001101 115 77 4D m 01101101 155 109 6D
N 01001110 116 78 4E n 01101110 156 110 6E
O 01001111 117 79 4F o 01101111 157 111 6F
P 01010000 120 70 50 p 01110000 160 112 70
Q 01010001 121 81 51 q 01110001 161 113 71
R 01010010 122 82 52 r 00110010 162 114 72
S 01010011 123 83 53 s 01110011 163 115 73
T 01010100 124 84 54 t 01110100 164 116 74
U 01010101 125 85 55 u 01110101 165 117 75
V 01010110 126 86 56 v 01110110 166 118 76
W 01010111 127 87 57 w 01110111 167 119 77
X 01011000 130 88 58 x 01111000 170 120 78
Y 01011001 131 89 59 y 01111001 171 121 79
Z 01011010 132 90 5A z 01111010 172 122 7A
[ 01011011 133 91 5B { 01111011 173 123 7B
\ 01011100 134 92 5C | 01111100 174 124 7C
] 01011101 135 93 5D } 01111101 175 125 7D
^ 01011110 136 94 5E ~ 01111110 176 126 7E
_ 01011111 137 95 5F DEL 01111111 177 127 7F

LEGENDA:

DEL Cancels to left (delete)


0 !+ 2
K
APPENDIX B: LIST OF ERRORS OF RUN-TIME

Here as following are listed the possible errors in runtime,


error’s code and the explanation of case in which the error can happen.
The errors trappable by program are indicated by [T].

- End file [#1] [T]


When try to read a record over the end file.

- RETURN without CALL [#2]


Found an instruction of RETURN w/out make CALL or XCALL.

- DBL Stack overflow [#4]


FATAL error. Can be if:
-subroutines are re-called with recurrence, without use RETURN.
-we execute a calculation of expression extremely complex.

- XCALL recurrent [#5]


Can be if, inside an external subroutine, we execute an XCALL to
the same subroutine.

- Number argument XCALL wrong [#6]


We get when the number of arguments passed to subroutine
excedes the max provided by the same subroutine.

- Indexing wrong [#7]


An index of variable indexed is minor or equal to 0 or,in interval
variable, the second index is inferior of the first.

- Writing on literal [#8]

KLIST OF ERRORS OF RUN-TIME;


We get when on a subroutine external we try to write on an
argument passed as constant or as expression.
The error happens also when the subroutine external tries to access
to argument that was not passed by calling program.

- Memory not available [#9]


Only in systems not with virtual memory, and is caused by
insufficient physical memory in system.

- Number of channel not valid[#10]


The specified value as channel is out of range 1-99

- Channel not open [#11]


An instruction of I/O is referring to a channel not open.

- Input on device only for writing [#12] [T]


We did try an operation of open in mode input on device only for
writing (i.e. printer)

- Number too big [#15] [T]


We get if:
-An instruction INCR exceeds the dimension declared of variable
(i.e. UD2,D2,99,INCR UD2 generates error).
-A too big value was passed for intrinsic function or for an
XCALL of system.

- Channel already used [#16]


An instruction OPEN specifies a channel number already open.

- Bad file specification [#17]


We did indicate in an instruction of OPEN or in XCALL of
system a file name not permitted by operating system.
- File not found [#18] [T]
The name of specified in instruction of OPEN,STOP,XCALL of
system does not exists.

- Device not available [#19] [T]


An instruction of open is referring to a device that operating
system considers as unreachable (doesn’t exist the related driver).

- Digit wrong on variable [#20] [T]


During an assignment from alpha to numerical, the variable alpha
contains characters different from “0-9”,”+”,”-“, blank.

- Mode OPEN wrong [#21] [T]


An instruction of I/O is not compatible with the mode of open
done.
See table of compatibility on instruction OPEN.
- Error of Input/Output [#22] [T]
We get error “hardware” during an operation of I/O.
Errors of this kind can be caused by:

- Insufficient disk memory.


- Denied access to a file.
-The involved device indicates error hardware (bad block etc.)

- Line too long [#23] [T]


A READ or READS tries to read a record with a field that is not
enough to contain all.

- Space for file not available [#24] [T]


Only when an instruction of OPEN in mode OUTPUT Indicates a
pre-allocation of file, in operating systems that allowed it, and the
requested space isn’t available.

- Number record wrong [#28] [T]


A READ, GET, WRITE o PUT is referring to a record number
minor than 1 or bigger of dimension max of file.

- Compilator incompatible [#29]


We try to execute a program compiled with a version not
compatible with the actual runtime.

- Division per zero [#30] [T]


In an expression the divisor has assumed the value 0.

- Length of argument not valid [#31]


An argument passed to XCALL of system is too short to contain
data output.
- File already existent [#32] [T]
We try to create a file already existent, when the flags of system
are not permitting it.(See XCALL FLAGS).

- Record blocked [#40] [T]


We try to read a blocked record by another process and the flags
of system are set to give error in case of record blocked.(See
XCALL DFLAG),

- Wrong Key[#52] [T]


In an I/O operation on ISAM, was specified a key field not
enough to contain the information relative.
- Key not same [#53] [T]
We get on I/O o file ISAM when:
-In READ the specified key was not found identical: the READ
backs anyway the record more near to the indicated key.
-In a DELETE or WRITE, the key is not the same of last
operation of READ or READS.
-Before of DELETE or WRITE, was executed an instruction of
UNLOCK that released last read record.
- In a STORE, the content of record, does not coincides with the
key content, as indicated in phase of generation.

- Duplication keys not permitted [#54] [T]


We try to do a STORE by a key already existent in the file and
that was declared NOT DUPLICABLE

- No ISAM present
We are using a RUN-TIME that not allows the management of
ISAM files.

- It is not a file ISAM [#56] [T]


We done an OPEN in mode SI or SU on file NOT ISAM. The
error may be caused by a corruption of the same file also.

- OPEN error [#95] [T]


The operating system backs an error code unknown after
instruction OPEN.

- Received a signal of interrupt [#98] [T]


We had key by keyboard the key “interrupt” (CTRL C) and we
did reset the flag of system n.8 (See XCALL FLAGS).

- Command not supported [#101]


A particular instruction HBL is not supported cause of particular
operating system.

- Error internal runtime [#104]


A situation not foreseen is happening during the run of program.

- Lunghezza record errata [#109]


During the execution of XCALL SORT, was read a record of
length bigger than declared.
- Too many files open [#117]
Over the max number of file that operating system permits.

- Violation of access [#200]


We try to access to an area of memory out of area data of
program.

- Wait for variable alphab. or decimale [#202]


In a XCALL of system, we do aspect a variable and not a
constant.

-Waiting for decimal [#211]


An argument of XCALL of system must be decimal.

- Waiting for sign '=‘ [#213]


An expression passed to XCALL of system, must contain the
sign”=”.

- Name file not valid [#219]


In a XCALL SORT, was passed a file name illegal for the
operating system.

- Option not valid [#221]"


It was specified an option not valid in one instruction of OPEN.

- It is not a file HBR [#230]


We try to execute a file that is not in format HBR.

- library subroutine not found[#248]


Was executed an XCALL of system to one subroutine no more
supported.

- 300-OPEN failure [#300]


Error unknown, on OPEN of file.

- Program not executed [#306] [T]


We try to lunch a XCALL SPAWN to a program not executable.

- Too many process opened [#308]


We try to execute a SPAWN or HPEXE over the max number of
possible processes.

You might also like