CNTQRY command (X'2006')

The distributed data management (DDM) architecture CNTQRY command continues a query by resuming the return of the result set data that was generated by a previous OPNQRY call.

Format

Read syntax diagramSkip visual syntax diagramDSSHDRLLCPMAXBLKEXTPCBNAMEQRYBLKSZQRYROWSET

Parameters

DSSHDR
The 6-byte header that contains information about the data stream structure (DSS).
LL
The length specified as a 2-byte binary integer. This length includes LL and CP.
CP
X'2006', the 2-byte codepoint of the CNTQRY command.
MAXBLKEXT
An optional parameter that specifies the maximum number of extra blocks per result set that the requester is capable of receiving as reply data in the response to the CNTQRY command. The number is specified as a 2-byte binary number. A value of 0 indicates that the requester is not capable of receiving extra query blocks of answer set data. A value of -1 indicates that the requester is capable of receiving the entire result set. The codepoint for MAXBLKEXT is X'2141'.
PCBNAME

A required parameter that specifies the PCB name that uniquely identifies the query made by a DL/I call. The PCB name is specified as a character string. The value is initially sent with the original OPNQRY command. The same value must subsequently be sent in commands such as CNTQRY, CLSQRY, and RLSE for proper correlation with the original OPNQRY call. The codepoint for the PCBNAME parameter is X'C907'.

QRYBLKSZ
A required parameter that specifies the size of query blocks that is ideal for the source application program. Query blocks are used by the target server to return answer set data. The target server can override this parameter as needed. The query block size is specified as a 4-byte unsigned binary number. The minimum size for a query block is 0.5 KB. The maximum size is 10 MB. The codepoint for QRYBLKSIZ is X'2114'.
QRYROWSET
An optional parameter that specifies the number of rows of data to return in one network reply. The number of rows is specified as a 4-byte binary number. The minimum value for QRYROWSET is 0. The maximum value is 32 767. The code point for the QRYROWSET parameter is X'2156'.

The JDBC driver uses the following calculation to determine how many records can be placed into the buffer that ODBM returns from the IMS DB through the DRDA protocol. Here is a brief description of the variables used in the formula:

IOAREALENGTH: By leveraging the database metadata available in the catalog, the length for a given path (record) call can be determined. This is the sum of the maximum possible length for all segments in the path call. For example, if you specify SELECT * FROM SEGMA, SEGMB where SEGMB is a child of SEGMA, then the length of the path call (record) being returned is the length of SEGMA + the length of SEGMB. This length is referred to as IOAREALENGTH.

MAXRETURNDATA: ODBM has its own buffer that is used to collect data prior to sending it back to the user. This buffer is referred to as MAXRETURNDATA and is set it to 1MB.

MAXROWDATA: For each record that gets returned, there is some additional overhead that uses the amount of usable buffer space for actual record data. The formula accounts for this additional overhead. 44 bytes will be used for the keyfeedback of each row as well as bytes used to describe the SSAList (equivalent of the WHERE clause from the SQL statement). The amount of space required per row of data is referred to as MAXROWDATA.

Formula used to calculate QRYROWSET:


IOAREALENGTH = LENGTH_OF_YOUR_PATHCALL 
MAXRETURNDATA = 1MB 
MAXROWDATA = 44 + (NUM_OF_SEGMENT_LEVELS_IN_SSALIST * 256) + IOAREALENGTH 
QRYROWSET = MAXRETURNDATA / MAXROWDATA

Usage

The DDM command CNTQRY (continue a query) to resume the return of result set data generated by a previous OPNQRY call.

Chained command objects

No command objects are chained to the CNTQRY command.

Reply data objects

The following reply data objects can be returned in response to the CNTQRY command:

QRYDTA (X'241B')
Query answer set data.

Error reply messages

If errors occur during the processing of the CNTQRY command, the IMS target DDM server can return to the source DDM server the following error reply messages:

Table 1. Possible error reply messages for the CNTQRY command
Codepoint of reply message Name of reply message Meaning of reply message
X'121C' CMDATHRM Not authorized to command
X'1232' AGNPRMRM Permanent agent error
X'1233' RSCLMTRM Resource limits reached
X'1245' PRCCNVRM Conversational protocol error
X'124C' SYNTAXRM Data stream syntax error
X'1250' CMDNSPRM Command not supported
X'1251' PRMNSPRM Parameter not supported
X'1252' VALNSPRM Parameter value not supported
X'1254' CMDCHKRM Command check reply message
X'125F' TRGNSPRM Target not supported
X'2204' RDBNACRM Database not accessed
X'220B' ENDQRYRM End of query
X'220D' ABNUOWRM Abnormal end of unit of work condition
X'2213' SQLERRRM SQL error condition
X'2218' RDBUPDRM Database update reply message.