What is DB2 Sqlca?

2020-01-21

What is DB2 Sqlca?

SQLCA. SQLCA is a SQL communication area through which DB2 passes the feedback of SQL execution to the program. It tells the program whether an execution was successful or not. There are a number of predefined variables under SQLCA like SQLCODE which contains the error code.

What is Sqlerrd in DB2?

sqlerrd[0] SQLERR(1) INTEGER. For a sensitive static cursor, contains the number of rows in a result table when the cursor position is after the last row (that is, when SQLCODE is equal to +100). On successful return from an SQL procedure, contains the return status value from the SQL procedure.

What is Dsntiar in DB2?

The assembler subroutine DSNTIAR helps you to obtain a formatted form of the SQLCA and a text message that is based on the SQLCODE field of the SQLCA. DSNTIAR can run either above or below the 16-MB line of virtual storage.

What is the use of Sqlca?

The main purpose of SQLCA is to inform the COBOL program about the status and other details of the most recently executed SQL query. The SQLCA has a total length of 136 bytes and it is composed of various fields like SQLCODE, SQLERRD, SQLWARN, etc.

What are the fields in Sqlca?

SQLCA fields:

Name Data Type
SQLCAID CHAR(8)
SQLCABC INTEGER
SQLCODE INTEGER
SQLERRML SMALLINT

What are the main fields in Sqlca?

SQLCA Fields

  • sqlcaid – An 8-byte character field that contains the string SQLCA as an identification of the SQLCA structure.
  • sqlcabc – A 32-bit integer that contains the length of the SQLCA structure (136 bytes).
  • sqlcode – A 32-bit integer that specifies the error code when the database detects an error on a request.

What is Dsntiar in Cobol?

The DSNTIAR is an inbuilt utility which is provided by IBM to be used in a COBOL-DB2 program. This utility displays the error code and its description in the logs in a well formatted manner, which saves time. The DSNTIAR utility can be called using SQLCA as below.