SQLDA Usage_Dynamic SQL

SQLDA USE in Dynamic SQL:

Db2 uses the SQL Descriptor Area(SQLDA) to communicate the dynamic SQL information to the application program.

It contains the various information like type of SQL, length, pointer to the actual data & number of columns etc. which are very useful for better coding.

To get this information into SQLDA after preparing the dynamic Query it should be described.

 

Below are the different SQLDA fields and sample sqlda structure

  • SQLDAID – Contains an eye catcher of “SQLDA” for use in storage dumps.
  • * If there is any CCSID override, it should contain the value ‘SQLDA+’
  • SQLDABC – Contains the length of the SQLDA, equal to SQLN*44+16
  • SQLN – Contains the total number of occurrences of SQLVAR
  • SQLD – Indicates the number of columns described by occurrences of SQLVAR
  • SQLVAR – Contains the information of each SQl statement, it is defined as an array.
  • SQLVAR contains data type of the column, length, pointer to the actual data and name of that SQL.

Ex:

 

To get basic details on Dynamic Queries please refer http://www.techtricky.com/dynamic-sql-in-db2-cobol/

Comment if you have any concerns on this topic.

Leave a Reply

Your email address will not be published. Required fields are marked *

Bitnami