DB2Factory.com 

Batch 

API Declarations.


The communication between the calling program and the generated COBOL/SQL program uses the data structure in the COBOL copybook "XNCAB3.CPY". 

*
*
* (c) Copyright The Object Group, Inc. 1993
* All rights reserved
*
*
    05    ls-action-block.
       07 ls-action-code      pic x.
       07 ls-row-len          pic 9(5).
       07 ls-key-loc          pic 9(5).
       07 ls-key-len          pic 9(5).
       07 ls-row-count        pic 9(5).
       07 ls-que-count        pic 9(5).
       07 ls-buf-count        pic 9(5).
       07 ls-ts-queue-name    pic x(8).
       07 ls-buffer-address   pic 9(5).
       07 ls-db2-ret          pic 9(5).
       07 ls-cics-ret         pic 9(5).
       07 ls-bypass-txlog     pic x.
       07 tsrmc-operator-id   pic x(15).
       07 LS-SAVEBYTE         PIC X(10).
    05    ls-db2-return-area  pic x(32000).

The following is a detailed explanation of each field in the BATCH communication buffer:

action-code - valid values are 'F' 'S' 'U' 'I' 'D' - Specified by the calling program, these values stand for Fetch, Select, Insert, Update, and Delete. The value you move to this field will determine the action taken by the COBOL/SQL program. A return code of 9998 in field db2-ret indicates an invalid sql-action was detected. This field is case sensitive.

row-len -  This value is returned to the calling program from the COBOL/SQL program. It is the length of one row in the result set.

key-loc - Displacement of the key attributes into the result set row. This is usually the first byte in the row.

key-len - Length of the key attributes into the result set row. 

req-row-count - Requested row count. This field contains a display integer value from  1 to 99999. In the case of a FETCH action, this will be the number of rows to fetch. In the case of Insert, Update, or Delete - this field contains the number pf rows in the buffer to process.

buf-count - This field is populated by the COBOL/SQL program and passed back to the calling application. It contains the number of rows processed. In the case of a Fetch, this is the number of rows returned in the db2-data-area. In the case of an Insert, Update, or Delete - this is the number of rows processed.

cics-ret - This field is populated by the COBOL/SQL program and passed back to the calling application. It contains the CICS return code, if any, from the CICS environment.

db2-ret - This field is passed back to the calling program and contains the DB2 return code.

que-count - When a result set spans more than 30k, the first buffer is passed directly back to the calling program. The balance of the 30k buffers are written to a queue file named in the attribute 'que-name'. These buffers must be programmatically read from the queue file until eof. See the demo source code for an example of how to do this.

queue-name - This eight byte field contains the name of the file that contains the balance of the buffer data beyone the first 30k. In a non-cics environment, this field defaults to "programname.que'. In a CICS environment, this is a unique temp storage queue id.

buffer-address    - not used
ls-bypass-txlog   - not used   
LS-SAVEBYTE       - not used

tsrmc-operator-id - This field contains the 15 bytes that will be put into the created and revised timestamps on an Insert, or Update. Although it is recommended that you use an IP address, any value will work as long as it makes sense to you and your application.