Interpreting compile errors in applications that use SQL

Sometimes you will encounter compile errors. Use the following information to interpret these errors.

If you separate the precompile and compile steps, and the source program refers to externally described files, the referred-to files must not be changed between precompile and compile steps. Otherwise, results that are not predictable might occur because the changes to the field definitions are not changed in the temporary source member.

Examples of externally described files are:

  • COPY DDS in COBOL
  • %INCLUDE in PL/I
  • #pragma mapinc and #include in C or C++
  • Externally-described files and externally-described data structures in RPG

When the SQL precompiler does not recognize host variables or host structures, messages SQL0312 and SQL5011 are written to the listing. These messages return a detailed reason why the variable was not able to be used. If the information in the message does not resolve the problem, you can try compiling the source. The compiler will not recognize the EXEC SQL statements; ignore these errors. Verify that the compiler interprets the host variable declaration as defined by the SQL precompiler for that language.