Previous Topic: Including TablesNext Topic: Referring to Host Variables


Defining Bulk Structures

A bulk structure is a group element or a record which contains a subordinate array for holding multiple occurrences of input or output values. Bulk structures are used in bulk SELECT, INSERT, and FETCH statements for retrieving or storing multiple rows of data.

Format of a Bulk Structure

A bulk structure consists of three levels:

All data descriptions used by CA ADS are defined within the dictionary.

Bulk Structure Example

The following is an example of a valid bulk structure definition using IDD syntax:

ADD ELEMENT EMP-ID PIC 999.
ADD ELEMENT EMP-NAME PIC X(30).
ADD ELEMENT DEPT-NAME PIC X(30).
ADD ELEMENT BULK-ROW SUB ELEMENTS ARE
    (EMP-ID EMP-NAME DEPT-NAME).
ADD ELEMENT BULK-DATA SUB ELEMENT
    BULK-ROW OCCURS 20.

Referring to a Bulk Structure

When referring to a bulk structure in a SELECT, FETCH, or INSERT statement, the name of the highest level is used:

EXEC SQL
  FETCH EMPCURS BULK :BULK-DATA
END-EXEC.

Restrictions

The following restrictions apply to bulk structures defined for use with CA ADS: