Program structure for bulk-copy-out operations

Most applications use a program structure similar to the following pseudocode to perform a bulk-copy-out operation:

ct_con_props to set connection properties
 ct_connect to open the connection
 blk_alloc to allocate a CS_BLKDESC
 blk_init to initiate the bulk copy
 for each column of interest
          (optional: blk_describe to get a description of
                the column)
          blk_bind to either bind the column to a program
                variable or to indicate that blk_textxfer will
                be used to transfer data for the column.
 endfor
while there’s data to transfer
          call blk_rowxfer_mult to transfer the row data
          pull data from program variables to a permanent
                location, if desired.
          if data is being transferred via blk_textxfer
                for each column to transfer
                   while there’s data for this column
                      blk_textxfer to tranfer a chunk of data
                   endwhile
                endfor
          endif
 endwhile
 blk_done(CS_BLK_ALL)
 blk_drop to deallocate the CS_BLKDESC