This code compiles, but I find it strange that no errors are reported.
Pardon my lack of knowledge if this is legal anyway.
Tested on Windows 10, GNU COBOL Version 3.2.1
Nope, totally valid the empty names are accepted as FILLER
The 01 well clearly would be not used but the 03 occurs is fine as it
can be accessed by the 01 or 04.
Otherwise the compiler is not a mind reader so all is valid Cobol.
Vince
On 21/11/2021 21:58, Emmad wrote:
This code compiles, but I find it strange that no errors are reported.
Pardon my lack of knowledge if this is legal anyway.
Tested on Windows 10, GNU COBOL Version 3.2.1
*> cobc r.cbl -free -Wall -x -o r.EXE
*> cobc r.cbl -free -Wall -x -o r.EXE
IDENTIFICATION DIVISION.
PROGRAM-ID. strange.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A PIC X.
01 PIC X VALUE "1". <-- Maybe a warning is due since it is level 01 and no name is provided
01 B.
03 OCCURS 2. <-- Maybe a warning is due - No name is provided
04 X PIC X.
PROCEDURE DIVISION.
DISPLAY 'OK'.
STOP RUN.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This code compiles, but I find it strange that no errors are reported.
Pardon my lack of knowledge if this is legal anyway.
Tested on Windows 10, GNU COBOL Version 3.2.1
*> cobc r.cbl -free -Wall -x -o r.EXE
*> cobc r.cbl -free -Wall -x -o r.EXE
Totally valid, likely since COBOL85 (from the VAX COBOL 74 manual it seems that this wasn't allowed).
No name for a data item is the same as writing
FILLER
.Nope, totally valid the empty names are accepted as FILLER
The 01 well clearly would be not used but the 03 occurs is fine as it
can be accessed by the 01 or 04.
Otherwise the compiler is not a mind reader so all is valid Cobol.
Vince
On 21/11/2021 21:58, Emmad wrote:
Great, thanks for the quick reply.