Regarding the first sample, we already have a fix for that.
It's in version 0.33 (and probably CVS)
The only thing you should do is to put
relax-level-hierarchy: yes
in your ibm.conf or mvs.conf, etc and use this as a dialect, i.e.
cob -x -std=ibm test.cbl
Regarding second example, it's incorrect and Microfocus also pointing that
out:
G:\skatests\cobol>cobol ztest9.cbl;
MERANT Micro Focus Net Express V3
Version 3.1.11 Copyright (C) 1984-2000 MERANT International Ltd.
URN AXCGG/AA0/00000
9 05 D PIC X.
*
225-S******* **
** Level hierarchy wrong
* Checking complete - errors found
It also does not compile on Mainframe:
SKASHYR 7> cob2 test9.cbl
PP 5655-G53 IBM Enterprise COBOL for z/OS 3.3.1 in progress ...
LineID Message code Message text
8 IGYDS1052-E Group item "C" contained the "PICTURE" clause. The
clause was discarded.
13 IGYPS0009-E "STOP" should not begin in area "A". It was
processed as
if found in area "B".
Messages Total Informational Warning Error Severe
Terminating
Printed: 2 2
End of compilation 1, program PROG, highest severity 8.
Return code 8
Regards,
Sergey
----- Original Message -----
From: "Robert Sherry" <address@hidden>
To: <address@hidden>
Sent: Tuesday, February 21, 2006 4:18 PM
Subject: [open-cobol-list] Should These Examples Compile?
> Please consider the following COBOL program:
>
> IDENTIFICATION DIVISION.
> PROGRAM-ID. prog.
> DATA DIVISION.
> WORKING-STORAGE SECTION.
> 01 A.
> 05 B.
> 10 C PIC X.
> 04 D.
> 05 E PIC X.
> PROCEDURE DIVISION.
> STOP RUN.
>
> Please consider the record A which contains the data items B and D. I
> claim that B and D should be treated as being at the "same level".
> Therefore, I believe this code should compile. It does compile with
> the Micro Focus COBOL compiler as well as the IBM Mainframe compiler.
> However, it does not compile with the latest version of the Open Source
> COBOL Compiler. This program does not compile with the latest version
of the
> Open Source COBOL Compiler. However, it does compile with the Micro Focus
> COBOL compiler as well as the IBM Mainframe compiler.
>
> In addition, the following program also does not compile with the Open
> Source compiler, but does with the IBM and Micro Focus compiler.
> IDENTIFICATION DIVISION.
> PROGRAM-ID. prog.
> DATA DIVISION.
> WORKING-STORAGE SECTION.
> 01 A.
> 05 B PIC X.
> 03 C PIC X.
> 05 D PIC X.
> PROCEDURE DIVISION.
> STOP RUN.
>
> We have a fix for this in cobc/field.c and I would be happy to post the fix
> either to the group or add the fix to official CVS tree.
>
> Bob Sherry