Skip to main content

Hi, our company works with Visual cobol and COBSQL preprocessor for Informix.

We are testing to change to Visual cobol and openESQL and we have found that if a cursor  is named with a host variable  the program gives and compilation error.

we has discover that If we change de cursor to a "prepare" compilation is ok, but in our instalation there are a lot of programs with this kind of declarations, and having to change it is a problem

There are some way to avoid the compilation error without change the code of the program? something like a compilation directive, and OpenESQL Preprocessor Options, an upgrade of the openSQL...?

This is an example of code:

declaration of the host variable to name the cursor

           exec sql begin declare section end-exec

                 01  sql-cursor        pic x(30).

           exec sql end declare   section end-exec.

Declaration of the cursor

            if conditionA

                move 'cursorA'            to  sql-cursor 

             else

               move 'cursorB'            to  sql-cursor 

            end-if

exec sql
     declare :sql-cursor cursor for ..............

end-exec.

exec sql
open :sql-cursor
end-exec.

exec sql
fetch :sql-cursor
into :.......

end-exec.

 exec sql close :sql-cursor       end-exec.

Hi, our company works with Visual cobol and COBSQL preprocessor for Informix.

We are testing to change to Visual cobol and openESQL and we have found that if a cursor  is named with a host variable  the program gives and compilation error.

we has discover that If we change de cursor to a "prepare" compilation is ok, but in our instalation there are a lot of programs with this kind of declarations, and having to change it is a problem

There are some way to avoid the compilation error without change the code of the program? something like a compilation directive, and OpenESQL Preprocessor Options, an upgrade of the openSQL...?

This is an example of code:

declaration of the host variable to name the cursor

           exec sql begin declare section end-exec

                 01  sql-cursor        pic x(30).

           exec sql end declare   section end-exec.

Declaration of the cursor

            if conditionA

                move 'cursorA'            to  sql-cursor 

             else

               move 'cursorB'            to  sql-cursor 

            end-if

exec sql
     declare :sql-cursor cursor for ..............

end-exec.

exec sql
open :sql-cursor
end-exec.

exec sql
fetch :sql-cursor
into :.......

end-exec.

 exec sql close :sql-cursor       end-exec.

Hi,

This is not currently possible with OpenESQL as the OpenESQL precompiler depends on knowing the cursor name in the SQL statements at code generation/compile time and not at run-time. I think your use of dynamic SQL statements with PREPARE is probably the best approach.


Hi, our company works with Visual cobol and COBSQL preprocessor for Informix.

We are testing to change to Visual cobol and openESQL and we have found that if a cursor  is named with a host variable  the program gives and compilation error.

we has discover that If we change de cursor to a "prepare" compilation is ok, but in our instalation there are a lot of programs with this kind of declarations, and having to change it is a problem

There are some way to avoid the compilation error without change the code of the program? something like a compilation directive, and OpenESQL Preprocessor Options, an upgrade of the openSQL...?

This is an example of code:

declaration of the host variable to name the cursor

           exec sql begin declare section end-exec

                 01  sql-cursor        pic x(30).

           exec sql end declare   section end-exec.

Declaration of the cursor

            if conditionA

                move 'cursorA'            to  sql-cursor 

             else

               move 'cursorB'            to  sql-cursor 

            end-if

exec sql
     declare :sql-cursor cursor for ..............

end-exec.

exec sql
open :sql-cursor
end-exec.

exec sql
fetch :sql-cursor
into :.......

end-exec.

 exec sql close :sql-cursor       end-exec.

use sql-cursor without the ":", then this is not a name of a table!

but i use not a preprocessor, but test it!