Core-to-Core Blocking Part

<core-to-core blocking part>

── ( ──<core-to-core record size>─┬──────────────────────────────┬─ ) ─┤
                                  └─ , ──<core-to-core blocking>─┘

<core-to-core record size>

──<arithmetic expression>──────────────────────────────────────────────┤

<core-to-core blocking>

──<arithmetic expression>──────────────────────────────────────────────┤

To specify a record size smaller than the default size, a value can be provided for core-to-core record size. This value is in terms of characters. By supplying a value for core-to-core blocking, the file can be blocked into more records than the default number, which is one.

With formatted I/O, if the format requires more records than indicated by the core-to-core blocking value, a run-time error is given. Also, the format can require more characters than the core-to-core file part contains; this situation also results in a run-time error. In such cases, the number of characters indicated in the core-to-core blocking part (this number is computed by multiplying the core-to-core record size by the core-to-core blocking) can appear to be large enough to satisfy the format, but the core-to-core blocking part can indicate more characters than the core-to-core file part actually contains. The core-to-core file part, the core-to-core blocking part, and the format must be compatible or run-time errors occur.

For example, the following statements result in errors:

BEGIN
   ARRAY A[0:9];
   REAL B,C;
   READ (A(80),<T50,A6,I10>,B,C);     % Example 1
   WRITE(A(15,3),<X5,I15>,1,2,3);     % Example 2
   WRITE(A(20,2),<X5,I15>,1,2,3);     % Example 3
   B := "  ITEM";
   WRITE(A(15,4),<".",X2,A6,I2,X4>,B,1,B,2,B,3,B,4);    % Example 4
END.

The statement labeled “Example 1” in the preceding program results in a run-time error (format error 217), because the format requires 65 characters, but the file part (array A) contains only 60 characters.

The statement labeled “Example 2” results in a run-time error (format error 117), because the format requires 20-character records, but 15-character records were specified in the blocking part.

The statement labeled “Example 3” results in a run-time error (format error 120), because the three list elements require three repetitions of the format. Thus, three records are required, but only two records were specified in the blocking part.

The statement labeled “Example 4” fills array A with the following EBCDIC data (“!” denotes the end of the data):

.   ITEM 1  .   ITEM 2  .   ITEM 3  .   ITEM 4    !