The SQLCA can accommodate only 70 characters of error information in the error message field. Generally, this is not enough for a useful error message. See SQL INCLUDE files for additional information on this required file.
In Microsoft SQL Server environments, the external variable F-ERRMSG is set to the full text of the error message returned to accommodate error messages longer than 70 characters.
F-ERRMSG is an external variable of USAGE POINTER that must be manipulated in order to see its contents. The following code demonstrates how to see the contents of the error message string:
01 f-errmsg usage pointer external. 01 my-errmsg pic x(512). .... 0000-START. EXEC SQL WHENEVER SQLERROR GO TO ERROR-EXIT END-EXEC. .... ERROR-EXIT. EXEC SQL WHENEVER SQLERROR CONTINUE END-EXEC. DISPLAY "SQL ERROR: SQLCODE " SQLCODE DISPLAY " SQLSTATE " SQLSTATE DISPLAY SQLERRMC call "c$memcpy" using my-errmsg, by value f-errmsg, 512. display my-errmsg ACCEPT OMITTED STOP RUN.
where
f-errmsg is an external variable that contains the full text of the error message.
my-errmsg is the full text of the error message, which in this case can contain up to 512 bytes.
See the ACUCOBOL-GT Reference Manual for information on C$MEMCPY and USAGE POINTER.