TypeCobolTeam / TypeCobol

TypeCobol is an Incremental Cobol parser for IBM Enterprise Cobol 6 for zOS syntax. TypeCobol is also an extension of Cobol 85 language which can then be converted to Cobol85.
Other
78 stars 26 forks source link

Adjust FILLER should take in account OCCURS #2648

Closed efr15 closed 2 months ago

efr15 commented 2 months ago

Describe the bug When a REDEFINES has an OCCURS clause the adjusted size for FILLER is not correct

To Reproduce

       IDENTIFICATION DIVISION.
       PROGRAM-ID. TCOMFL06.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 group1.
          05 target-zone PIC X(1000).
          05 redef  REDEFINES target-zone OCCURS 10.
             10 var PIC X(20).
       PROCEDURE DIVISION.
            GOBACK
            .
       END PROGRAM TCOMFL06.

When applying the refactoring on this document, FILLER is inserted with size = 800.

Expected behavior Size should be 80 Warning: a FILLER can also have an OCCURS clause

Technical AdjustFillerVisitorshould consider possible OCCURS when determining the adjusted size.

How to test automatically LSR tests.

fm-117 commented 2 months ago

OCCURS on REDEFINES is forbidden. IBM compiler returns An"OCCURS"clause was found in the definition of a level-1 item. The"OCCURS"clause was discarded. however our parser does not have this check (yet).

fm-117 commented 2 months ago

My bad the error is caused by the level of the OCCURS but OCCURS on REDEFINES of level > 1 seems to be allowed. Reopening and changing the source.