*1041-E Data item has zero size, or group not yet completed. Value of 0 assumed. * 27-S Number too large Rebuild complete with errors 01 ADDR. 05 ADDRS. 10 ADDR-LINE PIC X(20) OCCURS 6 INDEXED ADDR-IDX. 78 FIND-STRT VALUE LENGTH OF ADDR-LINE. 78 FIND-LEN VALUE LENGTH OF ADDRS - LENGTH OF ADDR-LINE. 01 ANOTHER-RECORD.
Problem:
*1041-E Data item has zero size, or group not yet completed. Value of 0 assumed.
* 27-S Number too large
Rebuild complete with errors
01 ADDR.
05 ADDRS.
10 ADDR-LINE PIC X(20) OCCURS 6 INDEXED ADDR-IDX.
78 FIND-STRT VALUE LENGTH OF ADDR-LINE.
78 FIND-LEN VALUE LENGTH OF ADDRS - LENGTH OF ADDR-LINE.
01 ANOTHER-RECORD.
Resolution:
The 1041-E Data item has zero size, or group item is not yet completed, value of 0 assumed, and the 27-S Number too large error are not an indication of a compiler error, but the expected behavior of a COBOL compiler.
This problem arises because in Cobol the extent of an 01 level item is only delimited by the next 01 level item, or by the end of the storage section (working- , local- etc.) in which it is declared. This is a language feature unique to COBOL.
A 78 level item will not delimit an 01 definition and the constant value calculations will fail as the preceding 01 item is not complete.
A 77 level item is basically a 01 level item that cannot have any subordinate items. Therefore, a 77 item would delimit any preceding 01 level item, meaning that susequent references to the length of that 01 level item would be correct.
Moving the 78 level items to the end of the section following a 77 level item would assure that all 01 level items are complete and the constant calculations would succeed.