HP COBOL and ACUCOBOL-GT treat the indexes of external tables slightly differently. In ACUCOBOL-GT, indexes attached to an external table are also external. As a result, all programs that share an external table must also have matching indexes for the table. (Note that the 1985 ANSI standard leaves the handling of INDEXED BY data items up to the implementor.)
The incompatibility exhibits itself at runtime. HP COBOL programs that are compiled with ACUCOBOL-GT using the -Cp option and share an external table but that do not have identical indexes for that table get following run-time error:
Mismatched EXTERNAL data item: data_item_name
The problem is illustrated by the following example. If the called program defines
01 main-01 external. 03 item-01 pic x occurs 20 indexed by idx1. 01 redef1 redefines main-01. 03 item-01 pic x occurs 20 indexed by idx2.
and the calling program defines
01 main-01 external. 03 item-01 pic x occurs 20 indexed by idx1.
then the Mismatched EXTERNAL data item error is raised at runtime. Although redef1 is a REDEFINES of main-01, idx2 is still a new data item and it must be present in all of the programs that share main-01 or the index must be eliminated. Note that if a SEARCH statement references redef1, idx2 must be present.
The following code does not raise the error. The called program defines:
01 main-01 external. 03 item-01 pic x occurs 20 indexed by idx1. 01 redef1 redefines main-01. 03 item-01 pic x occurs 20 indexed by idx2.
and the calling program defines:
01 main-01 external. 03 item-01 pic x occurs 20 indexed by idx1, idx2.