Some languages, such as ALGOL, allow formal array parameters that do not specify the lower bounds for array dimensions. Such array parameters are referred to in this guide as unbounded array parameters. Array parameters that explicitly specify the lower bounds are referred to as simple array parameters.
Be aware that parameter mismatch errors can result from passing an actual array with an unspecified lower bound to a formal array with a specified lower bound, or vice versa. For example, WFL STRING parameters are passed as unbounded real arrays. If a WFL program passes a string parameter to an ALGOL program, the ALGOL program must declare the formal parameter as unbounded; otherwise, a PARAMETER MISMATCH error occurs at run time.
The following is an example of an ALGOL program that is passed a string parameter from a WFL job.
100 PROCEDURE OUTER(ARR); 110 REAL ARRAY ARR[*]; 120 BEGIN 130 FILE TERM(KIND=REMOTE); 140 INTEGER ARR_SIZE; 150 POINTER P; 160 P:= ARR; 170 ARR_SIZE:= SIZE(ARR) * 6; 180 WRITE(TERM,*//,P FOR ARR_SIZE); 190 END.
In the preceding program, the SIZE function at line 170 returns the size of the array parameter in words. This value is multiplied by 6 to give the length of the array parameter in characters.
COBOL74 and COBOL85 are somewhat more forgiving than ALGOL in their handling of array parameters. Formal array parameters in COBOL74 or COBOL85 programs can receive either simple or unbounded actual parameters. Consider the following COBOL74 or COBOL85 program:
100 IDENTIFICATION DIVISION. 110 ENVIRONMENT DIVISION. 120 DATA DIVISION. 130 WORKING-STORAGE SECTION. 140 01 PARAM PIC X(12) DISPLAY. 150 PROCEDURE DIVISION USING PARAM. 160 START-HERE SECTION. 170 P1. 180 DISPLAY PARAM. 190 200 STOP RUN.
The preceding COBOL74 program is initiated twice by the following ALGOL program. The first time, the ALGOL program passes an unbounded array parameter. The second time, the ALGOL program passes a simple array parameter. In each case, the actual parameter is received by the formal parameter PARAM in the COBOL74 program. The COBOL74 program runs normally and displays the same output in each case.
100 BEGIN 110 REAL ARRAY ARRIN[0:12]; 120 TASK T; 130 PROCEDURE EX1(ARRACT); 140 REAL ARRAY ARRACT[*]; 150 EXTERNAL; 160 PROCEDURE EX2(ARRACT); 170 REAL ARRAY ARRACT[0]; 180 EXTERNAL; 190 REPLACE ARRIN BY “HI THERE”; 200 REPLACE T.NAME BY “(JASMITH)OBJECT/TEST/COBOL/TASK.”; 210 CALL EX1 (ARRIN) [T]; 220 CALL EX2 (ARRIN) [T]; 230 END.
Note that the preceding comments about COBOL74 and COBOL85 hold true only for tasking parameters. COBOL74 and COBOL85 programs display less flexible behavior when they are invoked as libraries. In this case, the programmer must know in advance whether the actual array parameter is simple or unbounded. If the actual parameter is unbounded, the programmer must use a LOWER-BOUNDS clause in the formal array declaration, or else declare an extra BINARY parameter to receive the lower bound. Of these two techniques, the LOWER-BOUNDS clause is equally compatible with tasking or library calls, whereas the extra BINARY parameter works only for library calls.
If a program has a single parameter that is a single-dimensional unbounded array, and no parameter is passed when the program is initiated, a one word array is supplied containing nulls, 4”000000000000”. An example ALGOL program heading would be
$ SET LEVEL 2 PROCEDURE P(A); ARRAY A[*]; BEGIN
For further information about unbounded array parameters to library procedures, refer to Using Libraries.

