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

variable commented out in nested sub program #131

Closed processor286 closed 1 year ago

processor286 commented 2 years ago

Following program runs if compiled with cobc:

       identification division.
       program-id. t1.
       data division.
       working-storage section.
       01 block1.
               03 mypic1 pic x(10).
       01.
               03 mypic2 pic x(10).

       procedure division.
       a-main section.
               display 'hello world'.
               call 't2'
               stop run.
       identification division.
       program-id. t2
                   common.
       data division.
       working-storage section.
       01 block1.
               03 mypic1 pic x(10).
       01.
               03 mypic2 pic x(10).
       procedure division.
       a-main section.
               move 'FOO' to mypic2
               display 'sub program!'
               display mypic2
               goback.
       end program t2.
       end program t1.

But when preprocessed:

cobc t4.cbl
t4.cbl:24: error: PICTURE clause required for 'FILLER'
t4.cbl: in section 'a-main':
t4.cbl:28: error: 'mypic2' is not defined
t4.cbl:39: error: syntax error, unexpected GO, expecting FUNCTION-ID or PROGRAM-ID

Because the preprocessor has for some reason commented out a variable: gixpp -v -d -C -e -i t4.cob -o t4.cbl

       identification division.
       program-id. t1.
       data division.
       working-storage section.
       01 block1.
               03 mypic1 pic x(10).
       01.
               03 mypic2 pic x(10).
GIXSQL*
GIXSQL*   ESQL CURSOR INIT FLAGS (START)
GIXSQL*   ESQL CURSOR INIT FLAGS (END)
       procedure division.
       a-main section.
               display 'hello world'.
               call 't2'
               stop run.
       identification division.
       program-id. t2
                   common.
       data division.
       working-storage section.
       01 block1.
               03 mypic1 pic x(10).
       01.
GIXSQL*        03 mypic2 pic x(10).
       procedure division.
       a-main section.
               move 'FOO' to mypic2
               display 'sub program!'
               display mypic2
               goback.
       end program t2.
       end program t1.

GIXSQL*
GIXSQL*   ESQL CURSOR DECLARATIONS (START)
GIXSQL     GO TO GIX-SKIP-CRSR-INIT.
GIXSQL GIX-SKIP-CRSR-INIT.
GIXSQL*
GIXSQL*   ESQL CURSOR DECLARATIONS (END)
mridoni commented 2 years ago

Same problem as #130, I am afraid...

mridoni commented 1 year ago

Closing, since this has the same cause (and is basically a duplicate of) #130