e.g. record r1, r2(f) record array r3(1:m, 1:n)(f)

Records and record arrays may also be declared as own. Elements of such tables are referenced by concatenating the record name and element name using the ISO break character (_):

e.g. r1_i
    r3(p, q)_s

These compound names are acceptable in any circumstance where a simple name of the same type may be used.

Operations on complete records are restricted to record assignment including the assignment of a zero (null) record.

e.g. r2(p, q) = r1
    r2 = 0

Routines and functions As in ALGOL, a routine is a named block with (optional) parameters. The IMP routine heading:

{routine [type] fn} name ([formal parameter list])

replaces the begin. The types of routine and function [RT] allowed and their corresponding exit instructions are:

routine integerfn realfn stringfn
return result = I   result = E   result = S

As with data, a routine name must be declared before being called. This is accomplished by giving a specification of the form:

[RT] spec name ([formal parameter list])

It is possible to dispense with the specification if the routine is given before any reference is made to it.

The call statement is:

name ([actual parameter list])

The possible formal parameters and the corresponding actual parameters are as follows:

Formal Actual
[type] name The name of an entity of the corresponding type
[type] array name The name of an entity of the corresponding type
record name An expression (I, E or S) of the corresponding type.
record array name An expression (I, E or S) of the corresponding type.
routine A routine name
[type] fn A function of corresponding type

The names associated with the formal parameter have the force of declarations within the routine body, but, in the case of RT parameter, a specification is also required before the formal parameter routine can be called.

An integer, real or string formal parameter is assigned at the time of call the value of actual parameter (call by value). A ... name formal parameter is assigned the address of the actual parameter as evaluated at time of call (call by reference not call by substitution).

Pre-declared routines The user's program is conceptually enclosed in a further block containing the specification and bodies of some fifty routines and functions. These routines cover mathematical and trigonometric functions, input/output and other utility routines. Naturally, in a system programming language, one does not preload routines which are not used and this is discussed further in the section on the compiler.

Input and output This is provided by pre-declared routines—special statements are avoided. The basic routines are as follows:

select input (I) Arrange for subsequent input (output) to come from (go to) logical stream I. Mappings between logical streams and files can be made by program or (in foreground mode) by console command or (in batch mode) via the job control language. select output (I) print symbol (I) transfer symbols to (and from) the current output (input) streams converting to and from the ISO internal code. The control characters, line feed and form feed, are handled by these routines. read symbol (i) print string (S) Outputs the string expression. next symbol This integer function gives the next symbol on the input stream without advancing the input pointer.

A considerable number of other routines are available for input/output of decimal and hexadecimal numbers, card images and strings. These are all written in IMP and use the basic routines described above. The compiler recognises all the basic routines and compiles a call on an Input Output Control Procedure (IOCP). Many system programs have specialised I/O requirements. The IMP programmer has all the IMP I/O routines available to him in any situation if he supplies a suitably modified version of IOCP. The EMAS Supervisor handles its output in this manner.

Segmentation Routines can be compiled separately provided the routine heading is prefaced by external. For a program or external routine to access an independently compiled routine, a modified specification is required of the form:

external [RT] spec ([formal parameter list])

Communication between separately compiled entities is usually via the parameter list. However, external variables may be declared:

e.g. external integer i
     external real array a(1:100)

These static variables may be accessed by a number of independently compiled routines. It is possible to overlay external routines although on the EMAS System overlays are neither necessary nor desirable.

Pointer variables Pointer variables may be declared as follows:

[type] name record name
[type] array name record array name

They hold the address of the entity at which they point exactly as for formal parameters of name variety. Assignment of addresses to pointer variables takes the form

p == v

where p is a pointer variable and v any normal variable of corresponding type. Pointer variables are often used in conjunction with mapping functions.

Store mapping System programmers sometimes require closer control over storage than is provided by simple static and dynamic variables. A mapping function is defined by:

[type] map name ([formal parameter list])

and is similar to a normal function except that its result is