John,
Confirmed. It seems to treat the out-of-sequence level number as just the next
logical level down (i.e., treats level 12 just like level 15 after the
preceding level 10). For this example code:
ID DIVISION.
PROGRAM-ID. TESTWSDF.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A.
10 B.
15 C1 PIC X(1).
15 C2 PIC X(1).
12 D.
15 E1 PIC X(1).
15 E2 PIC X(1).
10 F PIC X(1).
PROCEDURE DIVISION.
DISPLAY 'VARIABLES IN D ARE ' D.
GOBACK.
Compiler at V4.1 generates no errors and this DMAP, note that C1, C2 and D are
at the same logical level:
Source Hierarchy and Base
Hex-Displacement Asmblr Data Data Def
LineID Data Name Locator Blk
Structure Definition Data Type Attributes
3 PROGRAM-ID
TESTWSDF----------------------------------------------------------------------------------------------------*
7 1 A . . . . . . . . . . . . . . . . . . . . . . BLW=00000 000
DS 0CL5 Group
8 2 B . . . . . . . . . . . . . . . . . . . . . BLW=00000 000 0
000 000 DS 0CL4 Group
9 3 C1. . . . . . . . . . . . . . . . . . . . BLW=00000 000 0
000 000 DS 1C Display
10 3 C2. . . . . . . . . . . . . . . . . . . . BLW=00000 001 0
000 001 DS 1C Display
11 3 D . . . . . . . . . . . . . . . . . . . . BLW=00000 002 0
000 002 DS 0CL2 Group
12 4 E1. . . . . . . . . . . . . . . . . . . BLW=00000 002 0
000 002 DS 1C Display
13 4 E2. . . . . . . . . . . . . . . . . . . BLW=00000 003 0
000 003 DS 1C Display
14 2 F . . . . . . . . . . . . . . . . . . . . . BLW=00000 004 0
000 004 DS 1C Display
HTH
Peter.
-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf
Of John McKown
Sent: Monday, September 28, 2015 3:11 PM
To: [email protected]
Subject: Error? COBOL level number "mistake" accepted by IBM compiler
OK, just for "fun", I have downloaded a lot of the company's COBOL source
to my Linux workstation. I am compiling it with GNU COBOL. The results are
amazing clean. Well, that is, not many errors. However I have run into one
which is really confusing me. It is in a data definition. To boil it down
to a basic level, consider the following, which is accepted by 3.4.1
01 A
10 B
15 C1
15 C2
12 D
15 E1
15 E2
10 F
The GNU COBOL compiler chokes on the "12 D", emitting the error message:
Warning: No previous data item of level 18
This message seem correct to me.
Unfortunately the compile listing on z/OS does not have a DMAP (or whatever
it's called now). But I am thinking that the IBM compiler has inserted a
FILLER type entry to make the above look like:
01 A
10 B
12 FILLER
15 C1
15 C2
12 D
15 E1
15 E2
10 F
Does anybody know, for certain sure, what the IBM compiler is doing with
this. It really seems, to me, that it should be flagging the original code
as being in error, as the GNU compiler does.
--
Schrodinger's backup: The condition of any backup is unknown until a
restore is attempted.
Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.
He's about as useful as a wax frying pan.
10 to the 12th power microphones = 1 Megaphone
Maranatha! <><
John McKown
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
This message and any attachments are intended only for the use of the addressee
and may contain information that is privileged and confidential. If the reader
of the message is not the intended recipient or an authorized representative of
the intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication
in error, please notify us immediately by e-mail and delete the message and any
attachments from your system.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN