DB Access Class Library for COBOL V1.0 API Reference - Microsoft(R) Windows(R) - - Microsoft(R) Windows NT(R) - - Microsoft(R) Windows(R) 2000 -
Contents Index PreviousNext

UpChapter 4 Examples of Using the DB Access Class Library
Up4.1 Use a Recordset

4.1.3 Create a bind table to handle data in the recordset


Create a bind table to handle data in the recordset.

A bind table is an object of a COBOL variable.
A bind table is needed to manipulate data using a recordset or dynamic parameters. Associating a bind table and a recordset makes data manipulation possible.

Create a bind table associated with the recordset "RECORDSET-A " explained in Data Reference Example and Data Update Example.


  1. Define the class name.

    Define the class name of the bind table as "BINDTBL." The class name is an optional name.

     REPOSITORY.
         CLASS    BINDTBL AS "*COB-BINDTABLE".
  2. Define variables.

    Define the variables to use in the program.

     WORKING-STORAGE SECTION.
    *Define an object variable
     01  BIND-A        USAGE OBJECT REFERENCE BINDTBL.
    *Variable for setting a count of the number of items to register in the bind table
     01  FLD-NUM      PIC S9(9) COMP-5.
    *Variables for handling data in the recordset
     01  BIND-NO      PIC S9(9) COMP-5.
     01  BIND-NAME    PIC X(50).
     01  BIND-ADDRESS PIC X(100). 
  3. Load the variables with values.

    Load the variables with information needed to create a bind table.
    The argument that is specified when issuing a NEW method to create a bind table must be greater than or equal to a count of the number of fields in the recordset.

          MOVE  3  TO  FLD-NUM. iNumber of items to be registered in the bind tablej
  4. Create an object of the bind table.

    Using a NEW method, create an object of the bind table as "BIND-A."

          INVOKE BINDTBL "NEW" USING FLD-NUM RETURNING  BIND-A.
  5. Register the variables in the bind table.

    Using a REGISTER method, register the variables registered in step 2 above in the bind table.
    The order in which the variables are registered must match that of fields in the recordset.

          INVOKE BIND-A "REGISTER" USING BIND-NO.
          INVOKE BIND-A "REGISTER" USING BIND-NAME.
          INVOKE BIND-A "REGISTER" USING BIND-ADDRESS.

Contents Index PreviousNext

All Rights Reserved, Copyright (C) FUJITSU LIMITED 1998-2000