TypeCobol
TypeCobol copied to clipboard
Bug in REPLACE/REPLACING directives with multiple operations
Describe the bug According to some results with IBM compiler, when a token is replaced by one replace operation, other following operations of the same directive should not be considered for this token (i.e. a word can be replaced zero or one time at most).
To Reproduce (Type)Cobol code that cause the bug : (if any)
IDENTIFICATION DIVISION.
PROGRAM-ID. MyPgm.
data division.
working-storage section.
01 group1.
REPLACE ==(01)== BY ==(01)==
== 01 == BY == 05 ==.
01 var1 PIC X(01).
END PROGRAM MyPgm.
On IBM compiler the resulting var1
has a X(01)
picture definition, however our parser will have a X(05)
picture definition.
This test is already in our code, see PgmCopyReplacing.cbl
Expected behavior The second replace operation should have no effect on the picture string.
- check Cobol specs to explain this behavior
- check for every 4 types of replace operations
- for example test CopyReplace4Colon seems to contradict this behavior...