mridoni / gixsql

GixSQL is an ESQL preprocessor and a series of runtime libraries to enable GnuCOBOL to access PostgreSQL, ODBC, MySQL, Oracle and SQLite databases.
GNU General Public License v3.0
16 stars 8 forks source link

COPY REPLACING not working with GixSQL #187

Open Leroy-Guillaume opened 5 months ago

Leroy-Guillaume commented 5 months ago

Description: The COPY REPLACING directive in COBOL does not seem to work when using the GixSQL precompiler to compile a COBOL program, whereas it works perfectly with GNUCOBOL (cobc).

Steps to Reproduce:

  1. Create a COBOL program zreplacing.cbl with the following content:

    identification division.
    program-id. zreplacing.
    environment division.
    data division.
    working-storage section.
    copy "ztest.tag" replacing ==(tag)== by ==wss==.
    
    procedure division.
        display "Hello, world!".
        goback.
        stop run.
  2. Create the copybook ztest.tag with the following content:

    1 (tag)-test.
        3 (tag)-firsttest pic 9(7).
        3 (tag)-secondtest pic 9(7).
  3. Compile the program using GixSQL:

    gixsql zreplacing.cbl zreplacing.cob

Expected Behavior: The program should be precompiled without errors, similar to how it compiles with GNUCOBOL (cobc).

Actual Behavior: The compilation fails with the following error:

zreplacing.cbl(6): error: syntax error, unexpected WORD

Additional Information: The program compiles and runs perfectly when using GNUCOBOL with the following command:

cobc -m zreplacing.cbl
  1. Modify the COBOL program to remove the REPLACING clause:

    identification division.
    program-id. zreplacing.
    environment division.
    data division.
    working-storage section.
    copy "ztest.tag". *>replacing ==(tag)== by ==wss==.
    
    procedure division.
        display "Hello, world!".
        goback.
        stop run.
  2. Compile the modified program using GixSQL:

    gixsql zreplacing.cbl zreplacing.cob

Expected Behavior: The program should be precompiled without errors.

Actual Behavior: The precompilation works without any errors.

Environment:

The issue seems to be specific to the COPY REPLACING directive when using GixSQL.

Please provide guidance on how to resolve this issue or if a fix can be implemented in future versions.

Thank you for your assistance.