Created On:  27 March 2012

Problem:

Although EXEC SQL INCLUDE SQLCA END-EXEC statement is present in the source code and mode=ANSI is set among the other COBSQL directives, the precompilation process flags the "SQLWARNING" keyword below with "Must include SQLCA when mode=ANSI and WHENEVER SQLWARNING used":

 EXEC SQL
   WHENEVER SQLWARNING
     CONTINUE
 END-EXEC.

Resolution:

The problem occurs due to the CP preprocessor that will by default expand any copybook definitions to ensure that a single source file gets passed to the precompiler. This includes the "EXEC SQL INCLUDE SQLCA END-EXEC" statement. This means that when the processed source gets passed to Pro*COBOL, it sees the expanded SQLCA. As results, Pro*COBOL reports the error. To prevent CP from expanding the SQLCA copybook, specify the SY option between P(CP) and ENDP.
Incident #2544813