The SQLDA in MODELRSP

MODELRSP shows you how to create a SQLDA definition to send along with data to the client application using a DB2 output pipe. (The SQLDA definition in the RSP provides the data structure information sent along with the data to the client.)

If you have not worked with a SQLDA definition, review Appendix G, “The SQLDA.”

NoteIf the client application you are using expects data structure information to be transmitted with the data, use the DB2 format even if the data source is not DB2. For client application software, such as PowerBuilder, check data structure requirements in the vendor documentation.

Relating the standard SQLDA fields to the example from MODELRSP that follows, you can see the first SQLVAR definition is named MS-COL01. It is a fixed-character datatype that can contain nulls (value 453) and is defined for the first column of EMPLOYEE-DATA (FIXED-CHAR) that the sample RSP is sending to the client. MODELRSP includes one SQLVAR definition for each of the 11 columns of data it sends.

******************************************************************
 *  DESCRIPTION OF THE MODEL SQLDA                                *
 ******************************************************************
 01 MODEL-SQLDA.
 	03  MS-SQLDAID                 PIC X(08)  VALUE 'SQLDA   '.
 	03  MS-SQLDABC                PIC S9(8)  COMP VALUE 500.
 	03  MS-SQLN                   PIC S9(4)  COMP VALUE 11.
 	03  MS-SQLD                   PIC S9(4)  COMP VALUE 11.
 	03  MS-COL01.
 *      - 1ST   COLUMN DATATYPE = FIXED CHAR (LENGTH 1 - 256)
 		05  MS-COL01-SQLTYPE       PIC S9(4)  COMP VALUE 453.
 		05  MS-COL01-SQLLEN        PIC S9(4)  COMP VALUE 5.
 		05  MS-COL01-SQLDATA       USAGE IS POINTER.
 		05  MS-COL01-SQLIND        USAGE IS POINTER VALUE NULL.
 		05  MS-COL01-SQLNAMEL      PIC S9(4)  COMP VALUE 10.
 		05  MS-COL01-SQLNAME       PIC X(30) VALUE 'FIXED_CHAR'.
 						:
 						: