SQLDA Structure For COBOL

The SQLDA structure is provided in the copybook sqlda.cpy. Include this copybook in all COBOL programs that make use of dynamic SQL.

 01 SQLDA sync.
     05 SQLDAID               PIC X(8)  VALUE "SQLDA  ".
     05 SQLDABC               PIC S9(9) COMP-5 value 0.
     05 SQLN                  PIC S9(4) COMP-5 value 0.
     05 SQLD                  PIC S9(4) COMP-5 value 0.
     05 SQLVAR OCCURS 0 TO 1489 TIMES DEPENDING ON SQLD.
         10 SQLTYPE            PIC S9(4) COMP-5.
         10 SQLLEN             PIC S9(4) COMP-5.
         10 SQLDATA            USAGE POINTER.
         10 SQLIND             USAGE POINTER.
         10 SQLNAME.
             15 SQLNAMEL        PIC S9(4) COMP-5.
             15 SQLNAMEC        PIC X(30).

If you are using the Precompiler directive SQLDA-VER = 0, you must copy the file sqlda.old to sqlda.cpy. The structure of this SQLDA is below:

01 SQLDA.
  03 SQLDAID    PIC X(8).
  03 SQLDABC    PIC S9(9) COMP.
  03 SQLN    PIC S9(4) COMP.
  03 SQLD    PIC S9(4) COMP.
  03 SQLVAR OCCURS 300.
    05 SQLTYPE  PIC S9(4) COMP.
    05 SQLLEN  PIC S9(4) COMP.
    05 SQLDATA  PIC X(4).
    05 SQLIND  PIC X(4).
    05 SQLNAME  PIC X(30).