Skip to main content

I am using Server Express 5.1.11 on Red Hat Linux. I have successfully configured and executed COBSQL with Pro*COBOL and the CP preprocessor. All of the copy files within the program are copied to the main program before passing it to Pro*COBOL as expected. However, copy files within the scope of an EXEC SQL - END-EXEC construct seem to be ignored. For example:

EXEC SQL
    SELECT
        COPY "my_fields".
    INTO
        COPY "my_host_variables".
    FROM MT_TABLE
END-EXEC.

My expectation is that the contents of my_fields and my_host_variables would have been copied into the SQL statement by CP, but this did not happen. Any ideas? Is my expectation incorrect?


#Pro*COBOLCOBSQLCP

I am using Server Express 5.1.11 on Red Hat Linux. I have successfully configured and executed COBSQL with Pro*COBOL and the CP preprocessor. All of the copy files within the program are copied to the main program before passing it to Pro*COBOL as expected. However, copy files within the scope of an EXEC SQL - END-EXEC construct seem to be ignored. For example:

EXEC SQL
    SELECT
        COPY "my_fields".
    INTO
        COPY "my_host_variables".
    FROM MT_TABLE
END-EXEC.

My expectation is that the contents of my_fields and my_host_variables would have been copied into the SQL statement by CP, but this did not happen. Any ideas? Is my expectation incorrect?


#Pro*COBOLCOBSQLCP

I believe that CP will ignore copy statements within EXEC SQL blocks but you should be able to nest an exec sql include statement there.

Try something like the following:

EXEC SQL

   SELECT

       exec sql include "my_fields" end-exec

   INTO

       exec sql include "my_host_variables" end-exec

   FROM MT_TABLE

END-EXEC.