The text read off it
[page 34]
data. If the procedure is properly specified by the use of a BEGIN SECTION command, the programmer may use this procedure for any number of subsequent operations, using data from different fields. The MINIMUM.ROUTINE procedure used in this example might be used in such different ways as the following:
DO MINIMUM.ROUTINE USING CALCULATED.PRICE,
MARKET.PRICE, HIGH.VALUES GIVING PRICE.
DO MINIMUM.ROUTINE USING RAIL.EXPRESS, AIR.FREIGHT,
PARCEL.POST GIVING SHIPPING.RATE.
DO MINIMUM.ROUTINE USING FLAT.RATE, QUANTITY.RATE,
HIGH.VALUES GIVING RATE.
Note the use of the figurative constant HIGH.VALUES as a data-name in two of these examples. In these cases the figurative constant would cause the highest values in the machine’s collating sequence to be placed in the indicated parameter field. Since the programmer is concerned with choosing the lower of two values, this procedure assures that no unwanted lower value is found in the third parameter field.
Use of Functions in Procedure Statements
The reader has now seen how the same procedure may be used to obtain different results by processing different data obtained from different fields. The result (i.e., the function) will always be located in a specified field, and thus it may be obtained for use in other procedures. In other words, the function-names of the BEGIN SECTION command may be used like any other data-names, once the procedure has been performed.
However, a still shorter method is available. Instead of having to write a DO command which orders a procedure to be carried out, the programmer may write the name of a function directly in a procedure statement, together with the names of the data items to be substituted for the parameters, and the system will carry out the BEGIN SECTION procedure just as if the DO command had been written. In order to achieve this result, the programmer must specify the data to be used by placing the data-names in double parentheses immediately after the function-name. These names must be separated by single commas.
When this technique is used, the function-name itself must be specified. Since no DO command is used, there is no way of directing that the function be moved from the function field to another field; thus, it can be obtained only from the former.
Referring once again to the example of the MINIMUM.ROUTINE and to the three examples above, the programmer could write such statements as the following:
MOVE MINIMUM ((CALCULATED.PRICE, MARKET.PRICE.
HIGH.VALUES)) TO PRICE.LIST.
SET SHIPPING.COST = MINIMUM ((RAIL.EXPRESS, AIR.FREIGHT,
PARCEL.POST)) * QUANTITY.
SET RATE.FACTOR = MINIMUM ((FLAT.RATE, QUANTITY.RATE,
HIGH.VALUES)) * 1.15.
All function-names and all parameter-names used in the program must be written in the data description, as explained in Chapter 4. In particular, they must be identified by the type codes FUNCT or PARAM, as appropriate, and they must be described in accordance with the rules governing data description entries.
