Highlighted
Absent Member.
Absent Member.
343 views

[archive] Syntax error using "INDEXED BY"

[Migrated content. Thread originally posted on 14 January 2008]

I had a syntax error crop up in a program I was compiling.

The statement definition read:

05 LOCN OCCURS 16 TIMES PIC X(6) INDEXED BY LCNT.

This produces a syntax error.

When I changed it to read:

05 LOCN OCCURS 16 TIMES INDEXED BY LCNT PIC X(6).

it was accepted without any problems.

From reading the Reference Manual, it appeared that either format was acceptable, but this does not appear to be the case.

Can anyone enlighten me as to why this difference should occur, given that the program containing the erroneous version has been in use prior to 30 July 2007 when I joined the organisation to program in ACUCOBOL to maintain and develop their various systems.

Many thanks for your assistance.

Geoffrey
0 Likes
1 Reply
Highlighted
Absent Member.
Absent Member.

RE: [archive] Syntax error using "INDEXED BY"

If the previous COBOL programs were compiling 05 LOCN OCCURS 16 TIMES PIC X(6) INDEXED BY LCNT before you arrived it is possible that they were being compiled using a compiler option (there are several compiler options; such as -cv or -cp) that allow the ACUCOBOL-GT compiler to recognize COBOL syntax that other compilers recognize.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.