procedure set up directory (str); string str;
This procedure has been provided for users requiring to set up directories on private library tapes. All details on how to use this procedure are provided in Chapter 13 of the Atlas Algol System Manual. The form of the directory is as follows:-
WORD 0 First free block on tape : Tape number when last used 1 ≠0 for being used when in store : Position of next class name relative to this one. 2 Length of this class name : First letter of class name. 3 4 . . . Last letter of class name : Library item 0 in this class Library item 1 in this class etc.
procedure break output (n); value n; integer n;
This procedure when called will break the output on stream n. If large quantities of output on one stream are required by a user it is important that this procedure is used. No output is actually sent to a peripheral until either a complete output stream has been produced or a break in the output stream is made. Consequently, for large amounts of output, if break output is not used then the output disc area will have to carry a large number of blocks of the uncompleted output causing inefficiencies in the system. Also, if a machine failure occurs, the whole of the output may be lost unless break output is used.
The procedure break output should be used about every 1000 lines.
procedure procedure random; procedure initialise generator (left, right); value left, right; integer left, right; procedure extract generator (left,right); integer left, right;
These three procedures have been implemented to produce, from successive calls of random a sequence of Pseudo Random Numbers chosen from a population having a rectangular distribution and the range 0 to 1. The procedures ensure that different samples are available for re-runs of any given job and also for repeating any particular sequence of Pseudo Random Numbers.
A generator word G for defining the start of the sequence of Pseudo Random Numbers is initialised by a call of initialise generator. The two arguments left and right may be any integer in the range 0 to 524287. They provide respectively the left and right 19 bits of the central 38 bits of the generator word G.
The generator word is reset as follows:
G(new) = ([G(old)*8111**3] modulo 2**39)* 2 ** -39
Each call of random will reset the generator word G and extract the next Pseudo Random Number from G.
If the components of the generator word G are required to be saved at any time then a call of extract generator will store the 38 relevant bits in left and right. Using these values as arguments to initialise generator will cause the sequence to be continued from the point left off.
An example of using these procedures would be:-
JOB I0000 HOPGOOD RANDOM OUTPUT 0 LINEPRINTER 200 LINES COMPUTING 30 SECONDS DISC 99 R502 ALGOLIB COMPILER ALGOL INPUT INTERNAL ICT WITH ICT I/O PROCEDURES; begin
library ICT14; integer i, j ,k; initialise generator (349525, 74762); for i := 1 step 1 until 100 do
begin print (random, 1, 8); newline (1); end; extract generator (j,k); print (j, 5, 0); print (k, 6, 0); end; ***Z
This contains the definitions or the standard Algol functions with abs replaced by ABS, sin replaced by SIN etc. These procedures are used with programs written for entry 20 or the ICL 1900 compiler. More details are given in the section (ix) or Chapter 4.3 or the Atlas Algol System manual.
procedure ham (DIRECTORY BLOCK, NAME, NUMBER, TITLE); value DIRECTORY BLOCK, NUMBER; integer DIRECTORY BLOCK, NUMBER; string NAME, TITLE;
This outputs the library item stored on tape 99. The directory block is at block DIRECTORY BLOCK and the name or the library item is NAME. Its position is NUMBER. The library item is output on cards on stream 5. Each Algol symbol takes up one column between columns 1 and 72. Then follows the first six letters or TITLE in columns 73 to 78. The last two columns are used to serialise the cards from 0 upwards.
Full details or the way the Algol symbols are punched are given in Chapter 16 of the Atlas Algol System manual.
procedure dump tape positions;
This procedure can be used with the procedure dump program. It prints out the positions or the magnetic tapes when the procedure is called. The information for each tape is printed out a line at a time in ascending order or tape number. For each tape, the block position on the tape is output followed by the word position. Both are printed in octal.
procedure whats on my library tape (DIRECTORY, STREAM, PACKUP, DIRECTORYNEW, STREAMNEW); value DIRECTORY, STREAM, DIRECTORYNEW, STREAMNEW; integer DIRECTORY, STREAM, DIRECTORYNEW, STREAMNEW; Boolean PACKUP;
The design of the Algol library tape system is extremely simple. If a library item increases in size then, on redefinition, the whole item is moved to the next free blocks and a gap is left in the position where it was originally. If this happens several times then it could cause much longer searches of the magnetic tape than are necessary. The aim of the above procedure is to give the user a map showing where his library items occur and to remove the gaps if he so desires.
To list the positions and size of library items on the library only the first 3 arguments are relevant. The two remaining arguments can be set arbitrarily. The Boolean argument PACKUP must be set to false indicating that only a listing is required. The procedure will list all library items on the tape numbered STREAM which has its directory in block DIRECTORY (The directory block is normally the first block on the magnetic tape unless it has been repositioned by the user).
For example:
JOB I0000 BLOGGS LIST LIBRARY ITEMS DISC 99 R502 ALGOLIB TAPE 1 N0000MYTAPE*INHIBIT COMPILER ALGOL INPUT INTERNAL ICT WITH ICT I/O PROCEDURES; begin
library ICT18; whats on my library tape(1,1,false,O,O); end ***Z
The output would be something like:
NEXT AVAILABLE BLOCK IS 370 NAME NUMBER SIZE WHERE 30 ABC 1 173 100 5 90 3 27 DEF 19 20 350 GHI GAPS ARE AS FOLLOWS WHERE SIZE 93 7 273 77 YOUR PERCENTAGE OF GAPS IS 22
This indicates a library tape which has library names defined as ABC, DEF, GHI. The possible library names are ABC0 to ABC30, DEF0 to DEF27, GHI0 onwards. Of these only ABC1, ABC5, DEF19 have been defined. In the example, one large gap containing no current information occurs at block 273 for 77 blocks and a smaller gap at block 93 for 7 blocks. The unused blocks amount to 22% of the total space.
These gaps are causing much longer searches down the magnetic tape than are necessary and should probably be removed. The long gaps will cause the EXECUTION time associated with the job to increase and the job to run inefficiently.
This same procedure, when PACKUP is true, can be used to pack up the library tape by removing the gaps. In this case the new library tape is defined as being the tape numbered STREAMNEW and the directory will be put in block DIRECTORYNEW. It is recommended that a different tape from the old library tape is used for the new library tape. If the old library tape is used (STREAM = NEWSTREAM) then any computer failure could cause the total loss of all information from the old tape. The only way this could be safeguarded against while using the same tape would be to define the new directory position further down the tape than the next available block on the old library tape. If a packed up library tape is required then, in the Job Description, a COMMON tape must be defined as a temporary working space for the procedure and be called tape 90.
The library tape given in the first example could be packed up by following program:
JOB I000 BLOGGS PACK UP LIBRARY TAPE DISC 99 R502 ALGOLIB TAPE 1 N0000MYTAPE*INHIBIT TAPE 2 N0001MYOTHERTAPE*PERMIT TAPE COMMON 90 COMPILER ALGOL INPUT INTERNAL ICT WITH ICT I/O PROCEDURES; begin
library ICT18; whats on my library tape (1,1,true,1,2); end ***Z
This defines the new packed up version of the library tape on tape 2 with directory in block 1.
All printing done by this procedure uses the ICT I/O procedures so that these are obligatory in the PROCESSOR command. Two serendipital properties of this procedure are:-
procedure erase(STREAM,DIRECTORY,NAME,NUMBER); value STREAM,DIRECTORY,NUMBER; integer STREAM, DIRECTORY, NUMBER; string NAME;
The removal of library items from a library tape when they become obsolete will result in efficient use of library tapes and is to be encouraged. This is particularly important in the case of library tapes on the disc where space is at a premium.
The above procedure erase, will change the directory entry for the library item having name, NAME, and position, NUMBER, to free. The blocks, that the library item was using, will now be designated as free and will constitute a gap on the library tape (see ICT18). This gap could subsequently be removed from the library tape by using ICT18.
In the first example in the description of ICT18, the library item ABC5 could be deleted by calling:-
erase(1,1, 'ABC' ,5);
If erase was called before packing up the library tape (see second example of ICT18) then the area occupied by ABC5 would also be removed.
Possible diagnostics output by the procedure are:-
This library item contains the set of KDF9 procedures for outputting Algol arrays to magnetic tape and reading them back into store. Each array stored on magnetic tape is given a name by the user and this can be used to find the array when required. If all arrays stored on the tape have unique names then the array name can be presented to the read procedure and this will search the tape until a match is found with the name of an array on the magnetic tape. Alternatively if information is to be stored and retrieved in a serial fashion then the names can be ignored (all arrays can be given the same name) and the position of the tape will define which array is to be read into store. The procedures are as follows:-
procedure write binary(D, A, S); value D; integer D; real array A; string S;
All elements of array A are output to the magnetic tape numbered D in the Job Description and the array is given the name S on the magnetic tape. If this is the first use of the magnetic tape then it will be rewound before writing takes place. All information further down the magnetic tape than the last write binary order is assumed unobtainable. Thus it is not possible to overwrite information in the middle of the currently used region. All additions to the magnetic tape should therefore be at the end of the currently useful information on the magnetic tape.
procedure read binary(D, A, S); value D; integer D; real array A; string S;
This procedure will examine the next array past the current position of the magnetic tape D and check to see if its name coincides with S. If it does not agree, the magnetic tape is rewound and each array is examined in turn starting from the front of the magnetic tape until a match is found. Once a match is found, that array is read down into the array A. It is wise to keep the dimensions and limits of arrays the same in the read and write orders.
procedure rewind(D); value D; integer D;
The magnetic tape D is rewound to its starting position.
procedure skip(D,N); value D, N; integer D, N;
The magnetic tape D will be repositioned by moving the tape over the next N arrays. A negative value of N is allowed to move the tape backwards.
procedure data skip(D); value D; integer D;
The magnetic tape D is repositioned at the end of the currently available information on the tape. The tape would then be positioned ready for adding new information to the tape.
Boolean procedure BTC(D); value D; integer D;
BTC is true if tape D is at its initial position, otherwise false.