VIII. Running Programs
Reading edition
The Algol program is punched on cards in the hardware representation described in Appendix B. The format is essentially free field: spaces have no significance except within escape symbols and string quotes. Only the first 72 columns, however, are interpreted by the compiler. The remaining columns may be used for identification purposes. Care must be taken when a string is continued onto the next card, as the continuation will begin in column 1. The program listing will have the same format as the cards.
20
In the following discussion the symbol Ø signifies the letter O where necessary for emphasis, and the symbol Δ signifies a 7-9 punch in card column 1.
ALGOL Control System
The compiler operates under the ALGOL Control System. This system is a subordinate control routine of the Master Control System of the CO-OP Monitor Programming System. ALGOL is quite similar to the subordinate control routine COOP.
ALGOL is called with an MCS (Master Control System) card having ALGOL punched beginning in column 2. Other details of this card are available in descriptions of the CO-OP Monitor. It should be noted in selecting a standard recovery procedure that the concept of COMMON is not used in Algol.
Following the MCS card will be a control card giving instructions to the control routine ALGOL. It will name one of the following routines: ALGO, ALDAP, EXECUTE, BINARY, FORTRAN, REWIND or DEFINE. These will be discussed below.
EOP Card
The EOP (end-of-program) card has the characters 'EØP' punched in columns 10-14.
In the ALGO mode, one EOP card must be used to terminate the program.
In the ALDAP mode, one EOP card must be used to terminate each Algol program or Algol procedure being compiled separately.
21
Compile and Execute: ALGO
The ALGO mode of running an Algol program is the simplest and the fastest. It will be the more suitable for a large number of programs. Unless the programmer has special reasons for using the ALDAP mode, the ALGO mode is recommended.
The Algol program must be self-contained except for standard procedures and library procedures on the library-systems tape. The job deck must have the following cards in the specified order:
1. MCS control card.
The subordinate control routine name must be ALGØL.
2. ALGOL control card.
This will appear as
ΔALGØ. or ΔALGØ,t. where t is an integer specifying a time limit in minutes for compilation and execution.
(The period is required on every control card.)
3. LIB cards.
If necessary. One LIB card is required for each non-standard library procedure called in the program, namely those declared external. The format of a LIB card is as follows: the characters LIB punched in columns 10-12 and the name of a library entry point beginning in column 20. There may be no more than 20 LIB cards.
4. PROGRAM card.
If desired. This may be used to identify the program. Its format is described in the next paragraph.
5. Algol program deck.
6. EOP card.
7. Data.
If required.
22
PROGRAM Card
The PROGRAM card is optional. It is useful for identification purposes, and in the ALDAP mode it serves to name the program entry point.
The format of the card is free field. The characters PRØGRAM must appear followed by the program name, which must be alphanumeric.
Compile/Execute: ALDAP
The ALDAP mode is used to compile an Algol program or procedure to a relocatable binary or a CODAP format. Execution is optional. For compilation only, the program deck may consist of any mixture of Algol programs and procedures, any number of which may be in CODAP. If execution is desired, part or all of the program deck may have been previously compiled, so that the deck may have Algol, CODAP and relocatable binary cards.
ALDAP Control Statement
The format of the ALDAP statement is:
ΔALDAP,L,B,n.
where
L is a program listing key,
B is a punched card output key,
n is a logical unit number.
A period may terminate the statement at any point, with remaining fields treated as zero.
If the program listing key (L) is a 1, an assembled listing of the CODAP object code will be produced on the standard output medium. If the key is zero or blank, no such listing will be produced. A listing 23 of the Algol program and any diagnostics will always be produced on the standard output medium.
If the punched card output key (B) is a 1, a relocatable binary deck will be produced on the standard punch medium. If the key is a 2, a CODAP symbolic deck will be produced on the standard punch medium. If the key is a 3, both a symbolic deck and a relocatable binary deck will be produced on the standard punch medium, with the symbolic deck appearing first. If the key is zero or blank, no deck will be produced.
The logical unit number (n) specifies the unit which is to be the load-and-go tape if it is one of the integers 1-49 or 56. If n is some other integer or blank, no load-and-go tape will be written. The load-and-go tape is required when execution of the program is to follow.
Examples:
(a) ΔALDAP, 1, 1, 56.
This statement will cause the Algol/CODAP deck to be compiled, an assembled listing to be produced on the standard output medium, a relocatable binary deck to be produced on the standard punch medium, and a load-and-go tape written on logical unit 56.
(b) ΔALDAP, 1.
This statement will cause the Algol/CODAP deck to be compiled, and an assembled listing to be produced on the standard output medium.
Job Deck: ALDAP Compilation/Execution
For compilation only of an Algol/CODAP program deck, the job deck should contain the following cards in the specified order:
24
1. MCS control card.
With ALGØL as the subordinate control routine name.
2. ALGOL control card.
With the appropriate ALDAP control statement.
3. PROGRAM card.
If desired.
4. Program deck.
Any mixture of Algol and CODAP programs and procedures, with all their subroutines except the standard procedures and those on the library-systems tape. Each Algol program or procedure must be terminated by an EOP card.
5. FINIS card.
This card contains the characters FINIS punched in columns 10-14. It signals the end of all compilations.
For compilation and execution of an Algol/CODAP program deck, a load-and-go tape must be requested in the ALDAP control statement. If no relocatable binary cards follow the last subprogram to be compiled, then the program deck must be terminated by an EOP card which is in addition to the EOP card or END card (the latter for a CODAP subprogram) which terminates the last program or procedure. The FINIS card then follows this additional EOP card. An EOP card always causes a TRA card image to be written on the load-and-go tape.
The control statements EXECUTE, BINARY, FORTRAN, REWIND and DEFINE may be used as described in the “CO-OP Monitor Programmer’s Guide”. BINARY is useful for loading a relocatable binary deck onto the load-and-go tape prior to compilation of an Algol calling program, where the subprogram in relocatable form might have the same name as a library routine. If the Algol program preceded the relocatable deck, the library routine would be fetched by the loader and an error indication given.
25
The CO-OP control statements LOAD and EXECUTER are not used by ALGOL.
Examples
Each of the following examples describes a job deck which illustrates a different way of compiling and executing the same Algol program. The program calls a library procedure with entry point named BESSEL, and the program contains at least one other procedure. On the MCS card only the first field is indicated, as the others may vary from one installation to another.
Example 1
This job uses the ALGØ mode.
ΔALGØL, ... .
ΔALGØ.
LIB BESSEL
PRØGRAM SAMPLE
Algol Program (with external declaration of BESSEL)
'EØP'
Data
Example 2
This job uses the ALDAP mode, compiling the entire program at once. The ALDAP control statement calls for an assembled listing, a binary deck, and a load-and-go tape on logical unit 56. The execute card gives a two minute time limit on the execution.
26
ΔALGØL, ... .
ΔALDAP,1,1,56.
PRØGRAM SAMPLE
Algol Program (with external declaration of BESSEL)
'EØP'
'EØP'
FINIS
ΔEXECUTE,2.
Data
Example 3
This job consists simply of the execution of the relocatable program deck obtained in example 2.
ΔALGØL, ... .
ΔEXECUTE,2.
Relocatable Deck
Data
Example 4
This example is similar to example 2. Here the main program and one of its procedures are to be compiled separately.
27
ΔALGØL, ... .
ΔALDAP,1,1,56.
PRØGRAM SAMPLE
Algol Program (with external declaration of both BESSEL and the procedure being compiled separately)
'EØP'
Algol Procedure
'EØP'
'EØP'
FINIS
ΔEXECUTE,2.
Data
Example 5
In this example the procedure which was compiled separately in example 4 is being compiled by itself, i.e., the calling program is not in the deck at all. Of course there is no execution in this case. Note that no load-and-go tape is requested and only one EOP card is used. There cannot be a PROGRAM card.
ΔALGØL, ... .
ΔALDAP,1,1.
Algol Procedure
'EØP'
FINIS
28
Example 6
Here the procedure compiled by itself in example 5 appears in the program deck in relocatable binary form, while the calling program is in the Algol language.
ΔALGØL, ... .
ΔALDAP,1,1,56.
PRØGRAM SAMPLE
Algol Program (with external declaration of both BESSEL and the procedure in relocatable form)
'EØP'
FINIS
ΔEXECUTE,2.
Relocatable Deck
Data
The relocatable deck here must be terminated by two TRA cards. One of these is generated by the compiler when it processes the EOP card which must terminate the procedure for compilation, as in example 5. The second TRA card can be obtained by using a second EOP card, as in example 2. Alternatively, the second TRA card can be added to the relocatable deck before execution. Note that this second TRA card must not be used when the relocatable deck is loaded by a BINARY control statement. This is illustrated in the next example.
Example 7
In this case the previously compiled procedure has the same name as a routine on the library-systems tape.
29
ΔALGØL, ... .
ΔBINARY,56.
Relocatable Deck (terminated by one TRA card)
ΔALDAP,1,1,56.
PRØGRAM SAMPLE
Algol Program (with external declaration of both BESSEL and the procedure in relocatable form)
'EØP'
'EØP'
FINIS
ΔEXECUTE, 2.
Data
The logical unit number on the BINARY control statement must agree with that which specifies the load-and-go tape in the ALDAP control statement.
30