The text read off it
[page 33]
The net effect will be that space in storage is reserved for the actual data to be used and the actual result to be obtained. The values themselves will be obtained at object time when the program encounters the DO MINIMUM.ROUTINE command.
The reader will have noted that this DO MINIMUM.ROUTINE command, like the BEGIN SECTION command, contains USING and GIVING clauses. These clauses name the values to be used in the MINIMUM.ROUTINE procedure and the result to be produced. When the system encounters this command at object time, it will act as follows:
First, it will examine the field specified by the first data-name (D). It will obtain the value found there and move it to the first field named in the BEGIN SECTION command—i.e., field A. It will then obtain the value in field E and move it to field B. Similarly, it will move the value found in field F to field C. This process of data substitution follows the rule that items of data named in a DO command will be placed in the parameter fields named in the BEGIN SECTION command in the order in which they are named.
Once the actual data has been placed in the parameter fields, the MINIMUM.ROUTINE procedure will be carried out, using the data which has now been placed in the parameter fields. If fields D, E, and F had originally contained values of 11, 7, and 8, respectively, field A will now have a value of 11, field B a value of 7, and field C a value of 8. The procedure will then operate as follows: (1) The system will examine fields A and B, obtain the values they contain, and compare them. Since in this case the value of B is smaller, it will be moved to the field called MINIMUM. (2) The system will then examine field C and the MINIMUM field, note the values contained in them, and compare them. In this case, the value in the MINIMUM field is the lower. Thus, since the condition IF C IS LESS THAN MINIMUM has not been met, the instruction MOVE C TO MINIMUM will be ignored. (The lowest of the three values, of course, is already stored in the MINIMUM field.) (3) The system will then note the name of any field specified in the GIVING clause of the DO command. In this case, there is such a name, and it is different from the function-name given in the BEGIN SECTION command. In such a case, the value in the latter will be moved to the former. Thus, the value 7 will now be placed in the MINIMUM.2 field. (4) The command END MINIMUM.ROUTINE defines the end of the procedure, and the system will then return to the command following the DO instruction.
The reader will see, thus, that the effect of the USING and GIVING clauses in the DO command is to cause a series of data movements. Prior to the execution of the procedure, data named in the USING clause of the DO command will be moved to the parameter fields named in the USING clause of the BEGIN SECTION command. After the procedure has been carried out, the results will be moved from the function fields named in the GIVING clause of the BEGIN SECTION command to the data fields named in the GIVING clause of the DO command.
It is not necessary to employ the USING clause each time a DO command is written, if the programmer wishes to use the values already placed in the parameter fields. However, since the procedure will operate with whatever values are found in the parameter fields, the programmer must be sure that no unintended values are left there. In some cases, it may be useful to place “high values,” “low values,” blanks, or zeros, in a field; the figurative constants, thus, can be used as data-names.
Similarly, the GIVING clause need not be written in a DO command if the programmer intends to refer to the result (or results) as placed in the function field (or fields) named originally in the BEGIN SECTION command.
As the reader has seen, the use of the BEGIN SECTION and DO commands makes it possible to set up basic procedures and to use them with many different kinds of
