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
Copy and variable management on generation time #1438
Describe the bug
The TypeCobol generator is renumbering the variables in data sections.
For instance:
01 MyDataStructure
05 MyData PIC X.
Is transformed into:
01 MyDataStructure
02 MyData PIC X.
Variables in COPY are not renumbered. If a COPY instruction which has a 05 level variable as first variable is put under a 05 level variable in the source, the compilation will result in the following result and will be wrong:
To Reproduce
(Type)Cobol code that cause the bug : (if any)
IDENTIFICATION DIVISION.
PROGRAM-ID. Callee.
DATA DIVISION.
working-storage section.
01 CopyInsideTypeDef TYPEDEF STRICT PUBLIC.
COPY YCONVEA.
05 MyVar1 PIC X.
COPY YCONVEA.
PROCEDURE DIVISION.
END PROGRAM Callee.
On compilation time, the PIC X clause from MyVar1 will be discarded so it will be a data structure.
Expected behavior
The data structure should be preserved as is. Either renumber the values in the clause COPY or don't renumber the level numbers before a clause COPY.
Describe the bug The TypeCobol generator is renumbering the variables in data sections. For instance:
Is transformed into:
Variables in COPY are not renumbered. If a COPY instruction which has a 05 level variable as first variable is put under a 05 level variable in the source, the compilation will result in the following result and will be wrong:
To Reproduce (Type)Cobol code that cause the bug : (if any)
On compilation time, the PIC X clause from MyVar1 will be discarded so it will be a data structure.
Expected behavior The data structure should be preserved as is. Either renumber the values in the clause COPY or don't renumber the level numbers before a clause COPY.