I’ve noticed some strange behavior with the attached sample program compiled as follows.
cobc testreplace.cob -x -T TESTREPLACE.TXT -Xref --save-temps
As shown in the listing, the REPLACE CDF statement does not modify some but it modifiy other lines.
This is likely an issue specific to the listing itself.
The " .i " file (saved with--save-tempsoption) is correct.
Compilation completes without errors, and the program runs correctly.
It seems that REPLACE does not consider the text enclosed within the two quotation marks or parentesis.
Even when using reference modification in last MOVE , the replacement takes place, but the closing parenthesis is lost.
Is this behavior correct ?
Are the results in the postprocessed listing different from the preprocessed (--save-temps generates that as .i) file?
Which GnuCOBOL version did you use (if 3.2, I think we had fixes in with the listing and the REPLACE code).
Diff:
Diff:
Diff:
Diff:
Diff:
The
gc99fed2.ilisting obtained using the--save-tempsoption is correct; allREPLACEsubstitutions were performed properly.However, the listing obtained using the
-Toption shows discrepancies, as the value that was supposed to be replaced remains in certain cases.I noticed that the replacement does not occur if the value was enclosed in double quotes or within parentheses.
Even when using reference modification in last MOVE , the replacement takes place, but the closing parenthesis is lost.
I am attaching a new version of the
.COBprogram, the.TXTlisting file, and the.ifile to the first post of this ticket.I am using the compiler included with the SuperBOL installation, which is as follows:
Last edit: Eugenio Di Lorenzo 2026-10-05
Diff: