1 | Query option requested | Input | Char(10) |
2 | User file control block | I/O | Char(*) |
3 | Query definition template | I/O | Char(*) |
4 | Literal values | I/O | Char(*) |
5 | Access plan control block | I/O | Char(48) |
6 | Error code | I/O | Char(*) |
The Query (QQQQRY) API gets a set of database records that satisfies a database query request. Using this API you can do all the things you could do with the Open Query File (OPNQRYF) command. You can also perform subqueries, perform unions, and use SQL host variables.
The QQQQRY API can be used to do any combination of the following database functions:
You can use this API to run a query, create an access plan, or get information from the query definition template (QDT). When you run the query, the API uses the information you provide with the query definition template to extract information and data from the database. Creating an access plan makes it possible to run the query with better performance. Checking the query definition template allows you to validate the values in this query definition template.
The format definition is part of the query definition template and can be created and saved with extracted information by the Retrieve Database File Description (QDBRTVFD) API. When you are finished using the QQQQRY API, you should close the file (using the Close File (CLOF) command) to free up resources.
Another part of the query definition template is the access plan for the query. Using this API with the Create Query Access Plan (CRTQAP) value of the query option requested parameter, you can build an access plan to more efficiently run a query more than once. You can then use the access plan control block parameter to point to the access plan. This greatly improves the time it takes to perform subsequent runs of this query using this API and the RUNQRY option. Every time a query is run, the system first checks to see if an access plan has been specified. If one has, that is what is used to get the data requested by the query. If no access plan has been specified, a new one is built dynamically.
One of three options to be used:
One or more selected options for input and output of the specified query. This parameter need only be used along with the RUNQRY query option. See User File Control Block (QDBUFCB_T) Structure for a list of available options.
The information required to create objects that are used to query a database. It contains feedback information from the creation of objects. If a pointer to the access plan is specified, the corresponding query definition templates must also be specified.
This parameter is used to put into effect SQL host variables. When SQL host variables are used, this is a list of constant values used to run a query. If this parameter is to be ignored, a null pointer can be specified for the parameter. Once the literal value is specified on a call, it must always be specified.
A string of bytes that point to the access plan control block and give the size the access plan requires. This parameter must be specified for the RUNQRY query option when you want to specify an access plan and for the CRTQAP query option. The format for this parameter is:
PTR(SPP) | A space pointer that indicates the area of storage that contains the access plan. This area must begin on a 16-byte boundary and be all zeros. |
Bin(4) | The size of storage needed to contain the access plan. |
Char(28) | Reserved. |
The structure in which to return error information. For the format of the structure, see Error Code Parameter.
The QQQQRY API uses information in four structures to carry out a query. All structures are used together to perform the function you have selected using the query option requested parameter. The names of these structures are:
QDBQH_T | Query definition template |
Qdb_Qddfmt_t | Format definition template |
QDBUFCB_T | User file control block |
QQQVALS_T | Values for query variable fields |
The following sections show you in a general way how this information is structured.
The query definition template provides information about the query that is to be performed. QDBQH_T Format shows the general layout of this format.
Notice the box marked with a (1) in QDBQH_T Format. The topic Format Definition Template (Qdb_Qddfmt_t) provides the layout of the entire record format specification.
The offsets and descriptions of all the fields contained in this structure are shown in the following tables. You can see this source in member QQQQRY in the QSYSINC library.
This is the first structure and is located at offset zero. (Ref #1.)
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | BIN(4) | qdbqfilo | Offset to file, library, format, and member specifications. | |
4 | 4 | BIN(4) | qdbqfldo | Offset to the record specifications. 0 indicates that the record specifications should be taken from the file format. 0 is not valid if there are multiple files in the file specification and this is not a group-by query. | |
8 | 8 | BIN(4) | qdbqjoio | Offset to join specifications. 0 indicates that this is not a join query. | |
12 | C | BIN(4) | qdbqselo | Offset to the record selection specifications. 0 indicates that no record selection is to occur. | |
16 | 10 | BIN(4) | qdbqkeyo | Offset to the order by specifications. 0 indicates that the records are returned in the file's access path order. If this is a join, the access path order of the first file in the file array is used. -1 indicates that the result records are returned in no guaranteed order; running the same query twice may produce a different result order. | |
20 | 14 | BIN(4) | qdbqgrpo | Offset to the group-by-selection specifications. 0 indicates that no group by is to occur. | |
24 | 18 | CHAR(4) | qdbqdt_1 | Reserved. | |
28 | 1C | BIN(4) | qdbqgpso | Offset to the group by selection specifications. 0 indicates that no group by selection is to occur. If field qdbqgrpo is 0, this offset is ignored. | |
32 | 20 | CHAR(1) | qdbqfin | Query completion indicator.
|
|
33 | 21 | CHAR(1) | qdbqtem | Query temporary result indicator.
|
|
34 | 22 | CHAR(2) | qdbqattr | Query attributes. | |
34 | 22 | 0 | BIT(1) | qdbqnst | Status messages. Status messages are never sent
for batch jobs.
|
34 | 22 | 1 | BIT(1) | qdbqdist | Distinct records.
|
34 | 22 | 2 | BIT(1) | qdbqpgmd | Program-defined files.
|
34 | 22 | 3 | BIT(1) | qdbqterr | Tolerate decimal data errors.
|
34 | 22 | 4 | BIT(1) | qdbqdt_2 | Reserved. |
34 | 22 | 5 | BIT(1) | qdbqintd | Integer division.
|
34 | 22 | 6 | BIT(1) | qdbqdt_3 | Reserved. |
34 | 22 | 7 | BIT(1) | qdbqchgx | Changed files exception.
|
35 | 23 | 0 | BIT(1) | qdbqsaap | Precision reduction (SAA(R))
|
35 | 23 | 1 | BIT(1) | qdbqddmx | Distributed data management (DDM) files
exception.
|
35 | 23 | 2 | BIT(1) | qdbqraut | Resolve authority.
|
35 | 23 | 3 | BIT(1) | qdbqsqlb | SQL definition of binary.
|
35 | 23 | 4 | BIT(1) | qdbqaltc | Alternate computation.
|
35 | 23 | 5 | BIT(1) | qdbqsubq | The query definition template contains at least one subquery. This does not span across unions. |
35 | 23 | 6 | BIT(1) | qdbqsubx | Subcharacters exception. This field specifies
what to do if, during CCSID compatibility processing, a conversion occurs on
the data such that information may be lost or misinterpreted.
|
35 | 23 | 7 | BIT(1) | qdbqdt_4 | Reserved. |
36 | 24 | BIN(2) | qdbqkunum | The NODUPKEY number of key fields. The database does not return any records with duplicate keys and determines this by using this number of key fields as a comparison length. -1 indicates that all the key fields are used as a comparison length. This field is not applicable if field qdbqkeyo is -1. | |
38 | 26 | BIN(4) | qdbqnumrcd | This field is no longer supported. Its value will be ignored. | |
42 | 2A | BIN(4) | qdbqnxqo | Offset to next query definition template. This value is 0 if this is the only query definition template or if this is the last query definition template. | |
46 | 2E | BIN(4) | qdbqtoso | Offset to the set operation specifications. The set operation specifications can only be specified on the last query definition template. 0 indicates that no set operation is to occur. If only one query definition query template is specified, this offset is ignored. | |
50 | 32 | CHAR(4) | qdbqdt_5 | Reserved. | |
54 | 36 | BIN(4) | qdbqqdto | Offset to the query definition template table containing offsets to all query definition templates between unions. | |
58 | 3A | CHAR(8) | qdbqdt_6 | Reserved. (Ref #2.) | |
66 | 42 | CHAR(1) | qdbqdfmt | Date format used as the preferred format for
validity checking a date string or when mapping a character field to a date.
When the value of this field is X'FE', the preferred format is obtained from the job attributes, which have the value X'17', X'18', X'19', or X'1A'. (Ref #3.) |
|
67 | 43 | CHAR(1) | qdbqdsep | Date separator used as the preferred format for
validity checking a date string or when mapping a character field to a date. It
is only set when field qdbqdfmt is X'FE', X'17', X'18', X'19', or X'1A'.
When the value of this field is X'00', the preferred separator is obtained from the job attributes, which are one of the previously defined values except X'00' and X'EE'. When the value of this field is X'EE', the implied separator for the format is used. (Ref #4.) |
|
68 | 44 | CHAR(1) | qdbqtfmt | The time format used as the preferred format when
validity checking a time string or when mapping a character field to a time.
When the value of this field is X'FE', the preferred format is obtained from the job attributes, which will have the value X'1B'. (Ref #5.) |
|
69 | 45 | CHAR(1) | qdbqtsep | The time separator used as the preferred
separator when validity checking a time string or when mapping a character
field to a time. It is only set when field qdbqtfmt is X'FE' or X'1B'.
When the value of this field is X'00', the preferred separator is obtained from the job attributes, which are one of the values previously defined except X'00' and X'EE'. When the value of this field is X'EE', the implied separator for the format is used. |
|
70 | 46 | BIN(2) | qdbqcsdc | The coded character set identifier (CCSID) constant tag. If nonzero, this specifies the CCSID with which the literals in the query definition template should be tagged. If this field specifies a single-byte character set (SBCS) CCSID and a literal has double-byte character set (DBCS) data, the associated mixed CCSID of the SBCS CCSID is used for the literal. Conversely, if the literal is SBCS and this field specifies a mixed or DBCS CCSID, the associated SBCS CCSID is used for the literal. | |
72 | 48 | CHAR(2) | qdbqdt_7 | More flags. | |
72 | 48 | 0 | BIT(1) | qdbqvlit | Variable length literal.
|
72 | 48 | 1 | BIT(5) | qdbqdt_8 | Reserved. (Ref #6.) |
72 | 48 | 6 | BIT(1) | qdbqopta | Optimize all indexes over the query files.
|
72 | 48 | 7 | BIT(1) | qdbqmapbd | Reserved. |
73 | 49 | 0 | BIT(7) | qdbqdt_9 | Reserved. |
73 | 49 | 7 | BIT(1) |
qdbq_force _temp |
Force query records to a temporary result. Note
that this is only honored if set on for the last, outermost (that is,
non-subquery) QDT of a union. It is ignored for all other QDTs of the query.
|
74 | 4A | CHAR(2) | QDBQDT_10 | Reserved. | |
76 | 4C | qdbqfbk | Query feedback. The following information is returned on successful completion of the query. | ||
76 | 4C | CHAR(2) | qdbqqtyp_t | Query status indicators. | |
76 | 4C | 0 | BIT(1) | qdbqtemp | Temporary result.
|
76 | 4C | 1 | BIT(1) | qdbqcomp | Selection completion.
If selection is complete, the open feedback area contains the number of selected records. If selection is not complete, record selection may be performed while reading the records and the open feedback may indicate more records than are ultimately selected. |
76 | 4C | 2 | BIT(1) | qdbqdt_11 | Reserved. |
76 | 4C | 3 | BIT(1) | qdbqacpi | Access plan indicator.
|
76 | 4C | 4 | BIT(1) | qdbqsreg | This field is set on if the query definition template contains special registers CURRENT USER, CURRENT SERVER, or CURRENT TIMEZONE. |
76 | 4C | 5 | BIT(1) | qdbqsubw | Subcharacters warning. This field specifies
whether during CCSID compatibility processing, subcharacters are used in the
query.
|
76 | 4C | 6 | BIT(1) | qdbqsqlt | SQL tables.
|
76 | 4C | 7 | BIT(1) | qdbqlblst | The library list was used to determine the referenced table. This is possible due to the use of the Override with Database File (OVRDBF) command. |
77 | 4D | 0 | BIT(1) | qdbqcurdt | The query definition template contains CURRENT DATE, CURRENT TIME, or CURRENT TIMESTAMP. |
77 | 4D | 1 | BIT(7) | qdbqdt_12 | Reserved. |
78 | 4E | CHAR(28) | qdbqdt_13 | Length of query definition structure. | |
78 | 4E | BIN(4) | qdbqdtln | Length of query definition. | |
82 | 52 | CHAR(24) | qdbqdt_14 | Reserved. | |
106 | 6A | CHAR(1) | qdbqdofmt | Date format for output date fields.
If the data type Qddfftyp is unknown (X'FFFF') and this field is X'FF', the format and separator are taken from those specified with the based-on field. If the data type Qddfftyp is date (X'000B'), the format and separator are taken from the extension of record formats Qddfdttf and Qddfdtts. However, if Qddfdttf is X'FF', the format and separator are taken from qdbqdofmt and qdbqdosep. If either of these fields are not valid, it is an error. When the value of qdbqdofmt is X'FE', the format is obtained from the job attributes, which will have the value X'17', X'18', X'19', or X'1A'. Qddfftyp, Qddfdttf, and Qddfdtts are part of the QDBRTVFD include. |
|
107 | 6B | CHAR(1) | qdbqdosep | Date separator used as the output separator for
fields. It is only set when qdbqdofmt is X'FE', X'17', X'18', X'19', or X'1A'.
When the value of this field is X'00', the separator is obtained from the job attributes (any of the preceding values except X'00' and X'EE'). When the value of this field is X'EE', the implied separator for the format is used. |
|
108 | 6C | CHAR(1) | qdbqtofmt | Time format for output time fields.
If the data type Qddfftyp is unknown (X'FFFF') and this field is X'FF', the format and separator are taken from those specified with the based-on field. If the data type Qddfftyp is time (X'000C'), the format and separator are taken from the extension of record formats Qddfdttf and Qddfdtts. However, if Qddfdttf is X'FF', the format and separator are taken from qdbqtofmt and qdbqtosep. If either of these fields are not valid, it is an error. When the value of qdbqtofmt is X'FE', the format is obtained from the job attributes, which have the value X'1B'. Qddfftyp, Qddfdttf, and Qddfdtts are part of the QDBRTVFD include. |
|
109 | 6D | CHAR(1) | qdbqtosep | Time separator used as the output separator for
fields. It is only set when qdbqtofmt is X'FE' or X'1B'.
When the value of this field is X'00', the separator is obtained from the job attributes (any of the above values except X'00' and X'EE'). When the value of this field is X'EE', the implied separator for the format is used. |
|
110 | 6E | CHAR(1) | qdbqtsofmt | Timestamp format for output timestamp fields.
If the data type Qddfftyp is unknown (X'FFFF') and this field is X'FF', the format and separator are taken from those specified with the based-on field. If the data type Qddfftyp is timestamp (X'000D'), the format and separator are taken from the extension of record formats Qddfdttf and Qddfdtts. However, if Qddfdttf is X'FF', the format and separator are taken from qdbqtsofmt and qdbqtsosep. If qdbqtsofmt contains a format that is not valid, it is an error. Qddfftyp, Qddfdttf, and Qddfdtts are part of the QDBRTVFD include. |
|
111 | 6F | CHAR(1) | qdbqdt_15 | Reserved. | |
112 | 70 | BIN(4) | qdbq_optmrows | Optimization option. This field tells the optimizer that the user does not intend to retrieve more than n records from the query result. n can be any integer as long as it fits in a BIN(4) type. If the optimizer optimizes for n records, this could improve performance. Specifying a number does not mean the user cannot retrieve more than n records. It just tells the optimizer to optimize for only n records. For more information about the OPTIMIZE clause, see the DB2 UDB for iSeries SQL Reference topic. | |
116 | 74 | CHAR(12) | qdbqdt_16 | Reserved. | |
128 | 80 | BIN(4) | qdbq_jrefo | Offset to JREF Join specification. | |
132 | 84 | CHAR(44) | qdbqdt_65 | Reserved. | |
176 | B0 | CHAR(2) |
qdbq_posnopts _t |
The ORed byte containing an indicator for every scrolling option that is used for this query. Scrolling option of next is always assumed. | |
176 | B0 | 0 | BIT(1) |
qdbq_posnopts _prior |
Scrolling to previous record is used. |
176 | B0 | 1 | BIT(1) |
qdbq_posnopts _first |
Scrolling to first record is used. |
176 | B0 | 2 | BIT(1) |
qdbq_posnopts _last |
Scrolling to last record is used. |
176 | B0 | 3 | BIT(1) |
qdbq_posnopts _before |
Scrolling to before the first record is used. |
176 | B0 | 4 | BIT(1) |
qdbq_posnopts _after |
Scrolling to after the last record is used. |
176 | B0 | 5 | BIT(1) |
qdbq_posnopts _current |
Retrieval of the current record is used. |
176 | B0 | 6 | BIT(1) |
qdbq_posnopts _relative |
Scrolling to a record relative to the current record is used. |
176 | B0 | 7 | BIT(9) | qdbqdt_17 | Reserved. |
178 | B2 | CHAR(1) | qdbq_ext_bits | Miscellaneous bits in the query definition header. | |
178 | B2 | 0 | BIT(1) | qdbq_ctlblk | An indicator that the caller will be control record blocking; therefore, ignore SEQONLY() overrides. |
178 | B2 | 1 | BIT(1) | qdbq_norolb | Rollback HOLD can leave the position of this cursor as unknown. |
178 | B2 | 2 | BIT(1) |
qdbq_stream _cursor |
The user of this query attempts to read records from this query as fast as possible. |
178 | B2 | 3 | BIT(4) | qdbqdt_54 | Reserved. |
178 | B2 | 7 | BIT(1) | qdbqdt_18 | Reserved. |
179 | B3 | CHAR(1) | qdbq_ext_bits2 | Miscellaneous bits in the query definition header. | |
179 | B3 | 0 | BIT(2) | qdbqdt_57 | Reserved. |
179 | B3 | 2 | BIT(1) |
qdbq_trust _posn |
Trust scrolling option
|
179 | B3 | 3 | BIT(5) | qdbqdt_58 | Reserved. |
180 | B4 | CHAR(1) | qdbq_ext_bits3 | Miscellaneous bits in the query definition header. | |
180 | B4 | 0 | BIT(1) | qdbqdt_62 | Reserved. |
180 | B4 | 1 | BIT(1) | qdbq_searched_ update | Indicator if this is a searched UPDATE QDT. |
180 | B4 | 2 | BIT(1) | qdbq_searched_ delete | Indicator if this is a searched DELETE QDT. |
180 | B4 | 3 | BIT(2) | qdbqdt_63 | Reserved. |
180 | B4 | 5 | BIT(1) | qdbq_drvtbl | Indicates that this QDT is part of a derived table QDT. |
180 | B4 | 6 | BIT(2) | qdbqdt_64 | Reserved. |
181 | B5 | CHAR(15) | qdbqdt_19 | Reserved. | |
196 | C4 | CHAR(10) | qdbpopnid | Optional OPENID to identify this query. *FILE indicates the name of first or only file specified in the file specification. You can also specify a name to associate with opened query file. | |
206 | CE | BIN(4) | qdbspcsize | API users specify size for space containing all API query definition templates. (Ref #7.) | |
210 | D2 | BIN(4) | qdbqnlss | Displacement to QQQNLSS_T structure (Sequence, Tables, Names, and Parameters (QQQNLSS_T)) used for sort sequence information. This is an offset from the beginning of the query definition template. 0 indicates no QQQNLSS_T structure was passed. For nonviews, if this is a union or subquery, this field is ignored unless it is the first query definition template (for unions), or the outermost query definition template (for subqueries). | |
214 | D6 | BIN(2) | qdbqsrts | Sort sequence indicator. Possible values for this
field follow. When you use value 2 or 3, you must
include the QQQNLSS_T structure (Sequence, Tables, Names,
and Parameters (QQQNLSS_T)) at offset qdbqnlss.
|
|
216 | D8 | CHAR(5) | qdbqdt_53 | Reserved. | |
221 | DD | CHAR(1) | qdbqic | Whether query allows index creation.
|
|
222 | DE | CHAR(178) | qdbqdt_20 | Reserved. |
Sequence, tables, names, and parameters structure. The displacement to this structure from the beginning of structure QDBQH_T is an entry in the table at variable qdbqnlss.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | CHAR(42) | qqqstb1 | Sequence table name, library name, and language identifier. | |
0 | 0 | CHAR(10) | qqqresv2 | Reserved. | |
10 | A | CHAR(20) | qqsrtseq | Sort sequence. | |
10 | A | CHAR(10) | qqqstbnm | Table name. Possible special values are:
|
|
20 | 14 | CHAR(10) | qqqstbnl | Library name. Possible special values are:
|
|
30 | 1E | CHAR(10) | qqqlangid | Language identifier. Possible values are:
|
|
40 | 28 | CHAR(2) | qqqresv3 | Reserved. | |
42 | 2A | CHAR(38) | qqqstb2 | Reserved. | |
42 | 2A | CHAR(2) | qqqresv4 | Reserved. | |
44 | 2C | CHAR(10) | qqqtbnm | Reserved. | |
54 | 36 | CHAR(10) | qqqlbnm | Reserved. | |
64 | 40 | CHAR(14) | qqqresv5 | Reserved. | |
78 | 4E | BIN(2) | qqqtbl_ccsid | Sequence table CCSID. This field is only used when either qqqtbl is specified or qqqstboff is set for a DBCS sort sequence table. | |
80 | 50 | CHAR(10) | qqqstbe1 | User-specified DBCS sort sequence information. | |
80 | 50 | CHAR(1) | qqqstbtyp | Type of DBCS sort sequence table.
|
|
81 | 51 | CHAR(1) | qqqstbloc | Location of DBCS sort sequence table.
|
|
82 | 52 | BIN(4) | qqqstblen | Length of DBCS sort sequence table. If an SBCS sort sequence table is specified, qqqstblen must be zero. | |
86 | 56 | BIN(4) | qqqstboff | Offset to the DBCS sort sequence table from qqqstb1. | |
90 | 5A | CHAR(22) | qqqresv1 | Reserved. | |
112 | 70 | CHAR(256) | qqqtbl | User-specified sort sequence table. |
File name specification. This structure defines the files, member, and formats that are used in the query. This structure is required.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | qdbqfhdr | File specification header. | ||
0 | 0 | BIN(2) | qdbqfilnum | The number of files, libraries, formats, and members. (Ref #8.) | |
2 | 2 | CHAR(1) | qdbqmfop | Multiple file option. This field is only
applicable if the qdbqfilnum field is greater than one.
|
|
3 | 3 | CHAR(1) | qdbqmfor | Multiple file order option. This field is only
applicable if field qdbqfilnum is greater than one, field qdbqmfop equals J,
and there is no file-distinct processing. For each file specified in the file
specifications, qdbqfdst equals 1. Partial-outer join, exception join, and
file-distinct processing implies no join reordering.
|
|
4 | 4 | CHAR(1) | qdbqdt_21 | Flags. | |
4 | 4 | BIT(1) | qdbqmfio | Multiple file I/O options allowed through this
query.
|
|
4 | 4 | 1 | BIT(1) | qdbqmfjn | Join clause exists. An SQL JOIN clause syntax exists in this query. |
4 | 4 | 2 | BIT(6) | qdbqdt_22 | Reserved. |
5 | 5 | CHAR(11) | qdbqdt_23 | Reserved. | |
16 | 10 | ARRAY(32) OF CHAR(64) | qdbqn | File, library, member, and format array. This structure is defined at QDBQN_T on File, Library, Member, and Format Array (QDBQN_T). |
File, library, member and format names array. This structure defines the file, library, member, and format names that are used in the query. This structure is required.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | CHAR(40) | qdbqflmf | File, library, member, and record format names. | |
0 | 0 | CHAR(10) | qdbqfile | File name. If an override is in effect to another file, the actual file name is returned in this field. | |
10 | A | CHAR(10) | qdbqlib | Library name. If the special value *LIBL is used, the actual library name is resolved and returned in this field. | |
20 | 14 | CHAR(10) | qdbqmbr | Member name. If the special values *FIRST or *LAST are used, the actual member name is resolved and returned in this field. | |
30 | 1E | CHAR(10) | qdbqfmt | Format name. If the special value *ONLY is used, the actual format name is resolved and returned in this field. | |
40 | 28 | CHAR(1) | qdbqfflg | File specification flags. | |
40 | 28 | 0 | BIT(1) | qdbqfdst | File-distinct flag. This field specifies, for the
records that make up the join secondaries for a join query, whether only the
first record or all records that satisfy the join conditions should participate
in the join. This flag only applies to join secondary files (files 2 through
n, where n equals the number of files in the join).
|
40 | 28 | 1 | BIT(1) | qdbqfujn | Unique join fanout. This field specifies whether
the number of join records found can exceed 1. This field only applies to join
secondary files (files 2 through n, where n equals the number of files
in the join).
|
40 | 28 | 2 | BIT(1) | qdbqfgna | Reserved. |
40 | 28 | 3 | BIT(1) | qdbqfngn | Reserved. |
40 | 28 | 4 | BIT(1) | qdbqnmch | Name change indicator
|
40 | 28 | 5 | BIT(1) | qdbqflbo | Library name overridden.
|
40 | 28 | 6 | BIT(1) | qdbqf_nldft | Null or default. The type of values to be
returned for unmatched records of a partial outer or exception join.
|
40 | 28 | 7 | BIT(1) | qdbqdt_24 | Reserved. |
41 | 29 | CHAR(1) | qdbqmfvw | Reserved. | |
42 | 2A | CHAR(1) | qdbqmfvw_spc | Reserved. | |
43 | 2B | BIN(2) | qdbqf_qdtnum | Index into the array of subquery offsets (QDBQQDT_T) for the derived table QDT. | |
45 | 2D | CHAR(19) | QDBQDT_25 | Reserved. |
Record format specification. This structure defines the fields that are used in the query. The structure Qdb_Qddfmt_t is mapped by member QDBRTVFD in the QSYSINC library. If join is specified, this specification is required.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
CHAR(*) | QDBQR | Record specifications. |
Join specification. This structure defines how the files are joined by the query. One join specification exists for the entire query definition. A join specification entry consists of a from-field, a join operator, and a to-field. The join specification entries can be inserted in any order with respect to the file specifications.
If this is an inner join (the qdbqmfop field equals J, and no join specifications are given for a particular to-file, the system searches the record selection specifications for any possible implied join specifications. If no join specifications can be derived from the record selection specifications, Cartesian product is used to do the join.
All join specifications can be given in the record selection specifications. In this case, it is not necessary to provide a join specification.
If this is a partial-outer or exception join (qdbqmfop equals C or E) and no join specifications are given for a particular to-file, the system uses Cartesian product to do the join. In addition, only one join operator can be specified for a particular to-file.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | qdbqjhdr | Join specifications header. | ||
0 | 0 | BIN(4) | qdbqjln | Length of this join specification. | |
4 | 4 | BIN(2) | qdbqjknum | Number of from-join and to-join field specifications. | |
6 | 6 | CHAR(10) | qdbqdt_26 | Reserved. | |
16 | 10 | ARRAY(1) OF CHAR(96) | qdbqjfld | Join specification array. Array of fields that define the from and to fields to use when joining. The structure is defined at QDBQJFLD_T on Join Specification Array (QDBQJFLD_T). | |
112 | 70 | CHAR(*) | QDBQJNXT | Join field pair arrays. Displacement to join specifications array from structure QDBQJ_T (see structure QDBQJFLD_T on Join Specification Array (QDBQJFLD_T)). |
Join specification array. This structure is an array of fields that define the from and to fields to use when joining.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | CHAR(30) | qdbqjfnm | Join from field name. | |
30 | 1E | BIN(2) | qdbqjfnum | Field join reference number. 0 indicates that the QDBQR_T format (see Record Format Specification (QDBQR_T)) is searched for the external field name. If the field is not found, the formats of the files in the file specification are searched. A value in this field indicates that the external field name is to be found in the file format referenced by using this value as an index into the file name specification structure, qdbqf_t, (see File Name Specification (QDBQF_T)). In any case, the field found must exist in a file joined prior to this file. | |
32 | 20 | CHAR(2) | qdbqdt_27 | Reserved. | |
34 | 22 | CHAR(2) | qdbqjop | Join option.
|
|
36 | 24 | CHAR(30) | qdbqjtnm | Join to field name. Note that only character and any DBCS fields may be joined to character and any DBCS fields, and only numeric fields may be joined to numeric fields. The lengths of the two fields need not be the same. However, if they are different, a warning is sent to the user indicating that padding occurred. | |
66 | 42 | BIN(2) | qdbqjtnum | Field join reference number. 0 indicates that the
QDBQR_T format (see Record Format Specification
(QDBQR_T)) is searched for the external field name.
If the field is found, it must have been completely derived from the file associated with this join specification. If the field is not found, the format of the file associated with this join specification is searched. A value in this field indicates that the external field name is to be found in the file format referenced by using this value as an index into the file list. This value must reference the file associated with this join specification. |
|
68 | 44 | CHAR(1) | qdbqjpfmt | Reserved. | |
69 | 45 | CHAR(1) | qdbqjpsep | Reserved. | |
70 | 46 | BIT(1) | qdbqjfprf | Reserved. | |
70 | 46 | 1 | BIT(1) | qdbqjvw | Reserved |
70 | 46 | 2 | BIT(1) | qdbqj_type_sup | Join type specified. The type of join is specified in field qdbqj_type. |
70 | 46 | 3 | BIT(5) | qdbqdt_oj | Reserved. |
71 | 47 | CHAR(1) | qdbqj_type | Type of join.
|
|
72 | 48 | CHAR(24) | qdbqdt_28 | Reserved. |
JREF Join specification. This structure can be used to define the order in which the files are to be joined. It can also be used to specify any join selection needed to implement the join. Two files (or join results) are specified along with the appropriate join type to be used to join together the two operands. An offset can also be specified to the Selection Specifications (QDBQS) that will define the join criteria that applies to the operands.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | qdbq_jref_hdr | JREF Join specifications header. | ||
0 | 0 | BIN(4) | qdbq_jref_len | Length of this JREF join specification. | |
4 | 4 | BIN(2) | qdbq_jref# | Number of JREF Join entries. | |
6 | 6 | CHAR(10) | qdbqdt_66 | Reserved. | |
16 | 10 | CHAR(*) | qdbq_jref_spec | Start of the JREF Join entries. The structure is defined at QDBQ_JREF_ENTRY_T on JREF Join Entry (QDBQ_JREF_ENTRY_T). |
JREF Join Entry.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | BIN(2) | qdbq_jref_ entry_type | JREF Join entry type.
|
|
2 | 2 | CHAR(*) | qdbq_jref_item | JREF Join items. The structure is defined at QDBQ_JREF_OPERAND_T and QDBQ_JREF_OPERATOR_T on JREF Join Specification (QDBQ_JREF_T). |
JREF Join entry operand.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | BIN(2) | qdbq_jref_file# | JREF Join reference number. The value in this field is used to identify the entry in the QDBQN array associated with this file. | |
2 | 2 | CHAR(8) | qdbqdt_67 | Reserved. |
JREF Join entry operator.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | BIN(4) | qdbq_jref_jselo | JREF Join entry offset. Offset to the join selection for this JREF Join predicate. The join selection is defined by the Selection Specifications (QDBQS). | |
4 | 4 | CHAR(1) | qdbq_jref_jtype | JREF Join type. Type of the join specified for
this JREF Join predicate.
|
|
5 | 5 | CHAR(5) | qdbqdt_68 | Reserved. |
Record selection specification. This structure defines the selection specifications for the files being queried. Selection on the file is done before grouping. If selection is desired on group by results, see structure QDBQGS_T on Group-by-Selection Specification (QDBQGS_T).
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | BIN(4) | qdbqsl | Selection specifications length. This is the total length of all selection specifications. | |
4 | 4 | BIN(2) | qdbqsnum | Number of selection specifications. | |
6 | 6 | CHAR(10) | qdbqdt_29 | Reserved. (Ref #9.) | |
16 | 10 | CHAR(*) | qdbqspec | Start of selection specifications. Displacement to selection item specifications array from structure QDBQS_T (see structure QDBQSIT_T on Selection Item Specifications (QDBQSIT_T)). |
Selection item specifications. This structure is defined at field qdbqspec in structure QDBQS_T.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | BIN(4) | qdbqslen | Selection item length. This length includes the length (QDBQSIT_T) plus the length of the selection item structure. | |
4 | 4 | BIN(2) | qdbqsitt | Selection item type.
|
|
6 | 6 | CHAR(*) | qdbqsitm | Selection item. This field is overlaid by the sequence of selection field structures. |
Selection field operand. This structure overlays field qdbqsitm in structure QDBQSIT_T.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | CHAR(30) | qdbqsofn | Field name. The field name must be an external name. | |
30 | 1E | BIN(2) | qdbqsofj | Field join reference number. 0 indicates that the
QDBQR_T format (see Record Format Specification
(QDBQR_T)) is searched for the external field name. If the field is not
found, the formats of the files in the file specification are searched. If the
field name is found in more than one file format, an error is signaled.
A value in this field indicates that the external field name is to be found in the file format referenced by using this value as an index into the file list. |
|
32 | 20 | BIN(2) | qdbqsoqt | Index into the query-definition-template table for the correlated field's associated query definition template. Use zero for noncorrelated fields. | |
34 | 22 | CHAR(24) | qdbqdt_30 | Reserved. |
Selection field subquery operand. This structure overlays field qdbqsitm in structure QDBQSIT_T).
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | BIN(2) | qdbqssub | Index into the query-definition-template offset table for the subquery's query definition template. | |
2 | 2 | CHAR(1) | qdbqstyp | Subquery operator qualifier.
Valid values for qdbqsop when qdbqstyp equals 00 are:
Valid values for qdbqsop when qdbqstyp is not equal to 00 are:
|
|
3 | 3 | CHAR(23) | qdbqdt_31 | Reserved. |
Selection Constant Operand. This structure overlays field qdbqsitm in structure QDBQSIT_T.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
CHAR (32793) | qdbqsoch | Constant operand header. | |||
0 | 0 | BIN(4) | qdbqsocl | Constant operand byte length. This only includes the length of the constant in field qdbqsovl, including apostrophes. | |
4 | 4 | CHAR(1) | qdbqdt_32 | Constant attributes. | |
4 | 4 | 0 | BIT(1) | qdbqsoci | DBCS open constant.
|
4 | 4 | 1 | BIT(1) | qdbqdt_33 | Reserved. |
4 | 4 | 2 | BIT(1) | qdbqsocc | Character constant type.
If it is determined during query processing that the constant should be numeric and if field qdbqsoac in this table is 0, this bit is ignored. |
4 | 4 | 3 | BIT(1) | qdbqsoac | Character constant.
|
4 | 4 | 4 | BIT(1) | qdbqsoco | DBCS-only constant.
|
4 | 4 | 5 | BIT(1) | qdbqsosr | Special register.
|
4 | 4 | 6 | BIT(1) | qdbqsonl | SAA NULL indicator.
The query definition template is synchronized with the format description. |
4 | 4 | 7 | BIT(1) | qdbqdt_34 | Reserved. |
5 | 5 | CHAR(1) | qdbqsorc | Special register constant. This field is defined
by special register constants declared in the record format definition. This
field can only be specified if field qdbqsosr is on.
|
|
6 | 6 | CHAR(1) | qdbqsoft | Date, time, timestamp, format attribute. This
field applies only to date, time, or timestamp literals.
When the value of this field is X'FF', the format and separator specified in the query-definition-template header (either the qdbqdfmt field or the qdbqtfmt field, and either the qdbqdsep field or the qdbqtsep field, for a date or time literal is used first in determining the format and separator of the literal. When the value of this field is X'FE' for a date or time literal, the format and separator are determined using the job attributes. The format value may be X'17', X'18', X'19', X'1A', or X'1B'. The separator specified for qddfdvsp is used first in determining the format and separator. When the value of this field is X'FE' for a timestamp literal, the SAA timestamp format is used as the format of the literal. |
|
7 | 7 | CHAR(1) | qdbqsosp | Date and time separator. This field applies only
to date or time literals. It should only be set when the qdbqsoft field is
X'FE', X'17', X'18', X'19', X'1A', or X'1B'.
When the value of this field is X'00', the separator is obtained from the job attributes, which will be one of the preceding values except X'00' or X'EE'. When the value of this field is X'EE', the implied separator for the format is used. |
|
8 | 8 | CHAR(2) | qdbqdt_35 | Reserved. | |
10 | A | BIN(2) | qdbqsocd | CCSID value for this literal. If not set to zero, the literal will be tagged with this CCSID. Otherwise, the literal will be tagged with the CCSID specified in the query-definition-template header (see Query Definition Header (QDBQH_T)) or the job default, in that order. This field is only valid for character, DBCS-open, DBCS-only, DBCS-graphic, and UCS-2 literals. | |
12 | C | CHAR(1) | qdbqdt_36 | Reserved. | |
12 | C | 0 | BIT(2) | qdbqdt_37 | Reserved. |
12 | C | 2 | BIT(1) | qdbqglit | An indicator that the constant is a DBCS-graphic or UCS-2 literal. If this field is a UCS-2 literal, qdbqsocd must be set to a valid UCS-2 CCSID, or qdbqsocd must be zero and qdbqcsdc (see Query Definition Header (QDBQH_T)) must be set to a valid UCS-2 CCSID. |
12 | C | 3 | BIT(5) | qdbqdt_38 | Reserved. |
13 | D | CHAR(29) | QDBQDT_39 | Reserved. (Ref #11.) | |
42 | 2A | CHAR (32751) | qdbqsovl | Operand value. The operand value must be in external form. |
Selection Operator Item. This structure overlays field qdbqsitm in structure QDBQSIT_T.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | CHAR(2) | qdbqsop | Operators. Relational operators:
Boolean operators:
Case selection operators:
|
|
2 | 2 | CHAR(1) | qdbqswc1 | Wildcard value for any single character. This character indicates the value in the character string operand that should be interpreted as matching any single character. This field is only applicable if the qdbqsop field is a wildcard scan. | |
3 | 3 | CHAR(1) | qdbqswc2 | Wildcard value for any number of characters. This character indicates the value in the character string operand that should be interpreted as matching any number of characters. This field is only applicable if the qdbqsop field is a wildcard scan. | |
4 | 4 | BIN(2) | qdbqvalcnt | Values operand count. This count reflects the number of selection constant operands (values) associated with the values operator. This count must be set if the operator is values and is ignored for all other operators. | |
6 | 6 | CHAR(1) | qdbqdt_55 | Selection operator flags. | |
6 | 6 | 0 | BIT(1) | qdbqescp | Wildcard escape character indicator. This field
is valid only for wildcard scan.
|
6 | 6 | 1 | BIT(1) | qdbqdt_56 | Reserved. |
6 | 6 | 2 | BIT(1) | qdbqsopr_ext | Selection operator extension area indicator.
|
6 | 6 | 3 | BIT(5) | qdbqdt_60 | Reserved. |
7 | 7 | CHAR(3) | qdbqdt_40 | Reserved. | |
Note: The following fields are not present in a query definition restored from a System/38. | |||||
10 | A | CHAR(14) | qdbqsop2 | Wildcard value for double-byte characters | |
10 | A | CHAR(2) | qdbqsdbl | Wildcard value for any one double-byte character. This value indicates the value in the DBCS string operand that should be interpreted as matching any one double-byte character. This field is only applicable if field qdbqsop is a wildcard scan and string operand is a DBCS or graphic pattern. | |
12 | C | CHAR(2) | qdbqsdb2 | Wildcard value for any number of double-byte characters. This value indicates the value in the double-byte string operand that should be interpreted as matching any number of double-byte or single-byte characters. This field is only applicable if field qdbqsop is a wildcard scan and the string operand is a DBCS or graphic pattern. | |
14 | E | CHAR(3) | qdbqdt_41 | Reserved. | |
17 | 11 | CHAR(2) | qdbqsuo1 | Half-width wildcard value for any one double-byte UCS-2 character. This value indicates what value in the UCS-2 operand matches any one double-byte UCS-2 character. This field is only applicable if qdbqsop is a wildcard scan and the pattern is a UCS-2 parameter marker, host variable value, or constant. | |
19 | 13 | CHAR(2) | qdbqsuo2 | Full-width wildcard value for any one double-byte UCS-2 character. This value indicates what value in the UCS-2 operand matches any one double-byte UCS-2 character. This field is only applicable if qdbqsop is a wildcard scan and the pattern is a UCS-2 parameter marker, host variable value, or constant. | |
21 | 15 | CHAR(2) | qdbqsum1 | Half-width wildcard value for any number of double-byte UCS-2 characters. This value indicates what value in the UCS-2 operand matches any number of double-byte UCS-2 characters. This field is only applicable if qdbqsop is a wildcard scan and the pattern is a UCS-2 parameter marker, host variable value, or constant. | |
23 | 17 | CHAR(2) | qdbqsum2 | Full-width wildcard value for any number of double-byte UCS-2 characters. This value indicates what value in the UCS-2 operand matches any number of double-byte UCS-2 characters. This field is only applicable if qdbqsop is a wildcard scan and the pattern is a UCS-2 parameter marker, host variable value, or constant. | |
25 | 19 | CHAR(1) | qdbqdt_59 | Reserved. |
Note: For the wildcard scan operator (qdbqsop=X'0042'), UTF-8 wildcard values should not be specified. If either the match operand, the pattern operand, or the escape character are UTF-8, specify both the EBCDIC equivalents (qdbqswc1, qdbqswc2, qdbqsdb1, and qdbqsdb2) and the UCS-2 equivalents (qdbqsuo1, qdbqsuo2, qdbqsum1, and qdbqsum2).
Selection Operator Item Extension. This structure overlays field qdbqsitm in structure QDBQSIT_T by following QDBQSOPR_T and is only present if qdbqsopr_ext is set to '1'.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | BIN(2) | qdbqswc_ccsid | CCSID of wildcard character values that are specified in qdbqswc1, qdbqswc2, qdbqsdb1, and qdbqsdb2. The appropriate associated CCSID is determined depending on the CCSID of the pattern. If needed, this CCSID is used to convert the relevant wildcard characters to the CCSID of the pattern. If set to zero, it is assumed that the wildcard values are in the same CCSID as that of the pattern. | |
2 | 2 | BIN(2) | qdbqswc_ ccsid_ucs2 | CCSID of wildcard character values that are specified in qdbqsuo1, qdbqsuo2, qdbqsum1, and qdbqsum2. If needed, this CCSID is used to convert the relevant wildcard characters to the CCSID of the pattern. If this field is set to 0, it is assumed that the wildcard values are in the same CCSID as the pattern. If this field is specified, it must be a valid UCS-2 CCSID. | |
4 | 4 | CHAR(28) | qdbqdt_61 | Reserved. |
Order by specification. This structure contains a description of how the results of the query should be ordered. Up to 10 000 bytes may be used in ordering.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | CHAR(16) | qdbqkh | Order by header. | |
0 | 0 | BIN(2) | qdbqknum | The number of key positions in the order by specifications. | |
2 | 2 | CHAR(1) | qdbqkt | Key field ordering type.
This field is only used as a guide when considering indexes. Field qdbqopta) should be set to on to consider that all indexes build over the query files. |
|
3 | 3 | CHAR(13) | qdbqdt_42 | Reserved. | |
16 | 10 | ARRAY(1) OF CHAR(64) | qdbqkf | Key specifications of 10 000. | |
16 | 10 | CHAR(30) | qdbqkfld | Key field name. The field name must be an external field name from the QDBQR_T format (unless QDBQR_T is not specified, in which case the field is an external field name from the file format). For the QDBQR_T structure, see Record Format Specification (QDBQR_T). Field Qddffiob must not be X'04' (neither input nor output) for a key field. | |
36 | 24 | CHAR(1) | qdbqksq | Key field sequencing attributes. | |
36 | 24 | 0 | BIT(1) | qdbqksad | Ascending or descending sequencing indicator.
|
36 | 24 | 1 | BIT(1) | qdbqdt_43 | Reserved. |
36 | 24 | 2 | BIT(1) | qdbqkabs | Absolute value sequence indicator. This bit is
ignored for character key fields.
|
36 | 24 | 3 | BIT(5) | qdbqdt_44 | Reserved. |
37 | 25 | CHAR(33) | qdbqdt_45 | Reserved. |
Group by specification. This structure contains a description of how the record results of the query should be grouped. All records for which equal values exist in the defined fields are grouped together. Up to 2000 bytes may be used.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | CHAR(16) | qdbqgh | Group by header. | |
0 | 0 | BIN(2) | qdbqgfnum | The number of group by fields. If the number of group fields is 0, all the records are processed as one group. | |
2 | 2 | CHAR(14) | qdbqdt_46 | Reserved. | |
16 | 10 | ARRAY(120) OF CHAR(64) | qdbqgf | Group field specification. Up to 120 fields are allowed. | |
16 | 10 | CHAR(30) | qdbqgfld | Group field name. | |
46 | 2E | BIN(2) | qdbqgflj | Field-join reference number. 0 indicates that the QDBQR_T format (Record Format Specification (QDBQR_T)) is searched for the external field name. If the field is not found, the formats of the files in the file specification are searched. If the field name is found in more than one file format, an error is signaled. A value in this field indicates that the external field name is found in the file format referred to by using this value as an index into the file list. | |
48 | 30 | CHAR(32) | qdbqdt_47 | Reserved. |
Group-by-selection specification. This structure defines the selection specifications for the group by results. Selection on the group results is performed after the selection on the record is complete and the grouping has been completed.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | CHAR(*) | QDBQGS_T | Group-by-selection specification structure. See Record Selection Specification (QDBQS_T). | |
CHAR(*) | QDBQGSIT_T | The group by selection item specification structure (see Selection Item Specifications (QDBQSIT_T)). |
Set operation specification. This structure defines the operation specifications being performed for each set of results generated from each query definition template. These specifications are only valid when more than one query definition template is specified. The set operation specifications must only be specified on the last query definition template.
The specification structure is a stack of operands and operators in reverse notation. Operands are constant literals that identify the relative position of a query definition template among others in the query-definition-template chain. Operators are set operators such as union. For example, given the following query definition templates:
The following operations can be performed:
(1st QDT) UNION (2nd QDT) UNION ALL (3rd QDT)
The above can be specified in the set operation specification (in reverse notation) as:
1 2 UNION 3 UNION ALL
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | BIN(4) | qdbqtl | Set specifications length. This is the total length of all set specifications. | |
4 | 4 | BIN(2) | qdbqtnum | Number of set specifications. | |
6 | 6 | CHAR(10) | qdbqdt_48 | Reserved. (Ref #13.) | |
16 | 10 | CHAR(*) | qdbqtspc | Start of set specifications. |
Set item specifications. This structure overlays field qdbqtspc in structure QDBQT_T.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | BIN(4) | qdbqtlen | Set item length. This length includes the length (QDBQTIT_T) plus the length of the set item structure. | |
4 | 4 | BIN(2) | qdbqtitt | Set item type.
|
|
6 | 6 | CHAR(10) | qdbqtitm | Set item. Use either table QDBQtopC_T or QDBQtopR_T. |
Relative number of query definition template. This structure overlays field qdbqtitm in structure QDBQTIT_T .
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
BIN(2) | qdbqtqdt | Relative number of query definition template. | |||
CHAR(8) | qdbqdt_49 | Reserved. |
Set operators. This structure overlays field qdbqtitm in structure QDBQTIT_T .
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
CHAR(2) | qdbqtop | Set operators.
|
|||
CHAR(8) | qdbqdt_50 | Reserved. |
Query definition template offset table. This structure is set for each unioned outermost query definition template that contains subqueries. This offset table contains offsets for addressability to each query definition template within a union.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | CHAR(16) | qdbqqhdr | Header. | |
0 | 0 | BIN(2) | qdbqqdtnum | Number of subqueries defined with offsets. | |
2 | 2 | CHAR(14) | qdbqdt_51 | Reserved. | |
16 | 10 | ARRAY(32) OF CHAR(16) | qdbqqdt | Array of subquery offsets. See structure QDBQQDT_T (Array of Subquery Offsets (QDBQQDT_T)) for the layout. |
Array of subquery offsets.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | BIN(4) | qdbqo | Offset to QDT from start of first QDT in the union. | |
4 | 4 | CHAR(12) | qdbqdt_52 | Reserved. |
The format definition (Qdb_Qddfmt_t) for the QQQQRY API is the same structure that is used by the Retrieve Database File Description (QDBRTVFD) API called FILD0200. Qdb_Qddfmt_t Format shows how this information is organized. When more than one entry can appear, the figure indicates this as in (2). For a description of the fields in Qdb_Qddfmt_t and their respective offsets, see FILD0200 Format (Qdb_Qddfmt Structure) in Retrieve Database File Description (QDBRTVFD) API.
The description and offsets are also in the include source supplied with i5/OS. You can see this source in member QDBRTVFD in the QSYSINC library.
The QQQQRY API builds the format definition if it was not created prior to the query.
User file control block. This structure holds information from the user file control block (UFCB). It contains selected options for the input and output of the specified query.
The options available include:
In addition, some validity checking is done for this UFCB. CPF4297 is issued if any reserved space in the header of the QDBUFCB_T format is not zero.
The offsets and a description of all the fields contained in this structure are shown in the following table. You can see this source in member QQQQRY in the QSYSINC library.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | CHAR (1962) | qufcb | Query base UFCB. A character view of the entire user file control block. | |
0 | 0 | CHAR(174) | reserved1 | Reserved. | |
174 | AE | CHAR(1) | shr_secure | Share and secure flags. | |
174 | AE | 0 | BIT(3) | flglrsva | Reserved. |
174 | AE | 3 | BIT(1) | flglshr | Share specified.
|
174 | AE | 4 | BIT(1) | flglshsw | Share value.
|
174 | AE | 5 | BIT(1) | flglsecr | Secure specified. |
174 | AE | 6 | BIT(1) | flglud | Secure value.
|
174 | AE | 7 | BIT(1) | flglsvb | Reserved. |
175 | AF | CHAR(1) | open | Open flags. | |
175 | AF | 0 | BIT(2) | flagrsva | Reserved. |
175 | AF | 2 | BIT(1) | flagui | Open input. |
175 | AF | 3 | BIT(1) | flaguo | Open output. |
175 | AF | 4 | BIT(1) | flaguu | Open update. |
175 | AF | 5 | BIT(1) | flagud | Delete. |
175 | AF | 6 | BIT(2) | flagsvb | Reserved. |
176 | B0 | CHAR(4) | relver | Release and version. | |
176 | B0 | CHAR(2) | release | Release number. This value must be set to 01. | |
178 | B2 | CHAR(2) | version | Version number. This value must be set to 00. | |
180 | B4 | BIN(4) | invmkcnt | Mark counter of call or activation group. Set
this field to the call mark count when scoping the open to the default
activation group. For this case, a 0 indicates a permanent open,
and any value greater than 0 indicates a temporary open. Set this field to the
activation group mark count when scoping the open to an activation group.
Note: Setting this field to the default activation group is the same as specifying a call mark of 0 for a permanent open. This is the low-order four bytes of the mark count value. This field needs to be concatenated with mumkctbh to retrieve the actual invocation mark. |
|
184 | B8 | CHAR(1) | markcnt | Mark count and blocked record. | |
184 | B8 | 0 | BIT(1) | flg2mkcp | Mark counter option.
|
184 | B8 | 1 | BIT(1) | flg2rsvl | Reserved. |
184 | B8 | 2 | BIT(1) | flg2brcd | Blocked records.
|
184 | B8 | 3 | BIT(5) | flg2rsv2 | Reserved. |
185 | B9 | CHAR(1) | reserved2 | Reserved. | |
186 | BA | CHAR(1) | invact | Mark count usage. | |
186 | BA | 0 | BIT(1) | flg4rsvl | Reserved. |
186 | BA | 1 | BIT(1) | flg4iact | Mark counter usage.
|
186 | BA | 2 | BIT(6) | flg4rsv2 | Reserved. |
187 | BB | CHAR(1) | reserved2a | Reserved. | |
188 | BC | CHAR(1) | native | iSeries environment and process NULLS. | |
188 | BC | 0 | BIT(2) | flg3rsvl | Reserved. |
188 | BC | 2 | BIT(1) | flg3ntve | This field must be set to 1. |
188 | BC | 3 | BIT(3) | flg3rsv2 | Reserved. |
188 | BC | 6 | BIT(1) | flg3null | Process null-capable fields. |
188 | BC | 7 | BIT(1) | flg3rsv3 | Reserved. |
189 | BD | CHAR(2) | reserved3a | Reserved. | |
191 | BF | CHAR(1) | opnscp | Open scope.
|
|
192 | C0 | CHAR(5) | reserved3b | Reserved. | |
197 | C5 | BIN(4) | mumkctbh | High-order four bytes of the mark count value making a total of eight bytes. This needs to be concatenated with invmkcnt to obtain the actual invocation mark. | |
201 | C9 | CHAR(7) | reserved3 | Reserved. | |
Note: The parameter field through the ufcbend field are repeated in the variable-length data area for each parameter. | |||||
208 | D0 | CHAR(73) | parameter | Variable parameters. | |
208 | D0 | BIN(2) | primrlnl | Primary record length. Initialize to -1 to deactivate. | |
210 | D2 | BIN(2) | primrlnv | The user-specified record length. | |
212 | D4 | BIN(2) | filedep | File-dependent I/O. Initialize to -3 to deactivate. | |
214 | D6 | 0 | BIT(1) | fildonoff | File-dependent option.
|
214 | D6 | 1 | BIT(7) | fldrsvl | Reserved. |
215 | D7 | BIN(2) | lvlchk | Level-check option. Initialize to -6 to deactivate. | |
217 | D9 | 0 | BIT(1) | lvlonoff | Level-check option.
|
217 | D9 | 1 | BIT(7) | lvlrsvl | Reserved. |
218 | DA | BIN(2) | recfmts | Record format sequence numbers for level checking. | |
220 | DC | BIN(2) | maximum | The maximum number of formats. | |
222 | DE | BIN(2) | curnum | The current number of formats. | |
224 | E0 | ARRAY(75) of CHAR(23) | formats | Array of format names and sequence numbers | |
224 | E0 | CHAR(10) | name | The format name. | |
234 | EA | CHAR(13) | number | The format sequence number. | |
1949 | 79D | BIN(2) | keyfdbk | Key feedback. Initialize to -53 to deactivate. | |
1951 | 79F | 0 | BIT(1) | keyonoff | Key feedback option.
|
1951 | 79F | 1 | BIT(7) | keyrsvl | Reserved. |
1952 | 7A0 | BIN(2) | seqonly | Sequential processing. Initialize to -58 to deactivate. | |
1954 | 7A2 | 0 | BIT(1) | seqonoff | Sequential processing option.
|
1954 | 7A2 | 1 | BIT(1) | numonoff | Fast sequential processing option.
|
1954 | 7A2 | 2 | BIT(6) | seqrsvl | Reserved. |
1955 | 7A3 | BIN(2) | numrecs | The number of records to transfer to or from the I/O buffers for fast sequential processing. | |
1957 | 7A5 | BIN(2) | commitc | Commitment control. Initialize to -59 to deactivate. | |
1959 | 7A7 | CHAR(1) | control | Commitment control and optional record-locking
level. Possible values are:
|
|
1960 | 7A8 | BIN(2) | ufcbend | This field must be set to 32767, the end of the variable area parameters. Set this field to ENDLIST. | |
1962 | 7AA | BIN(4) | dummy | Dummy pointer to force boundary alignment for the user file control block structure. |
The structure is used to supply the values for the variable fields used by the QQQQRY API. The offsets and a description of all the fields contained in this structure are shown in the following table. You can see this source in member QQQQRY in the QSYSINC library.
Offset | Bit | Type | Variable Name | Field | |
---|---|---|---|---|---|
Dec | Hex | ||||
0 | 0 | BIN(2) | qqqvvalnum | Number of values in list. | |
2 | 2 | CHAR(30) | qqqvals_l | Reserved. | |
32 | 20 | ARRAY(1) OF CHAR(48) | qqqvlst | List of variable field values referenced by field Qddfvarx. See field Qddfvarx for the Qddfvarx field. (Ref #15.) | |
32 | 20 | Pointer | qqqvsptr | Space pointer to the host variable value. The value must be in internal form. | |
48 | 30 | CHAR(7) | qqqvattr | Attributes of value. | |
48 | 30 | 0 | CHAR(1) | qqqvatyp | Scalar type
|
49 | 31 | CHAR(2) | qqqvalen | Scalar length for character, binary, floating point, only, either, or open. For graphic, this is also the number of bytes (not characters). | |
49 | 31 | CHAR(1) | qqqvadec | Fractional digits for zoned or packed. | |
50 | 32 | CHAR(1) | qqqvatot | Total digits for zoned or packed. | |
51 | 33 | CHAR(4) | qqqvaary | Container for precision and digits for binary values. | |
51 | 33 | CHAR(1) | qqqvbind | Fractional digits for binary value. | |
52 | 34 | CHAR(1) | qqqvbint | Total digits for binary value. | |
53 | 35 | CHAR(2) | qqqvals_2 | Reserved. | |
55 | 37 | CHAR(1) | qqqvals_3 | Field attributes. | |
55 | 37 | 0 | BIT(1) | qqqvvlen | Variable length host variable field.
|
55 | 37 | 1 | BIT(1) | qqqvnulll | The form of field qqqvsptr. If on, qqqvsptr is ignored and the literal is the null value. If off, the literal pointed to by qqqvsptr is used. |
55 | 37 | 2 | BIT(1) | qqqvzerol | The length of field qqqvsptr. If on, qqqvsptr is ignored and the literal is zero length. If off, the literal pointed to by qqqvsptr is used. |
55 | 37 | 3 | BIT(5) | qqqvals_4 | Reserved. |
56 | 38 | CHAR(1) | qqqvdvft | Date, time, and timestamp format attribute. This
field applies to date, time, or timestamp values only, where the field qqqvatyp
in this structure is date, time, or timestamp.
|
|
57 | 39 | CHAR(1) | qqqvdvsp | Date, time, and timestamp separator. This field is only set when field qqqvdvft in this structure is X'17', X'18', X'19', X'1A', or X'1B'. | |
58 | 3A | BIN(2) | qqqvcsid | CCSID of value. | |
59 | 3C | CHAR(20) | qqqvals_5 | Reserved. |
In multithreaded jobs, this command is not threadsafe for distributed files and fails for distributed files that use relational databases of type *SNA. This command also is not threadsafe and fails for Distributred Data Management (DDM) files of type *SNA.
Message ID | Error Message Text |
---|---|
CPF2114 E | Cannot allocate object &1 in &2 type *&3. |
CPF2115 E | Object &1 in &2 type *&3 damaged. |
CPF2169 E | Job's sort sequence information not available. |
CPF24B4 E | Severe error while addressing parameter list. |
CPF2619 E | Table &1 not found. |
CPF3BCC E | Language identifier &1 not valid. |
CPF3BC6 E | Sort sequence &1 not valid. |
CPF3BC7 E | CCSID &1 outside of valid range. |
CPF3BC8 E | Conversion from CCSID &1 to CCISID &2 is not supported. |
CPF3BC9 E | Conversion from CCSID &1 to CCISID &2 is not defined. |
CPF3C90 E | Literal value cannot be changed. |
CPF3CF1 E | Error code parameter is not valid. |
CPF3FC0 E | Language identifier is not valid. |
CPF4000 E | All CPF40xx messages could be returned. xx is from 01 to FF. |
CPF4100 E | All CPF41xx messages could be returned. xx is from 01 to FF. |
CPF4200 E | All CPF42xx messages could be returned. xx is from 01 to FF. |
CPF4300 E | All CPF43xx messages could be returned. xx is from 01 to FF. |
CPF5000 E | All CPF50xx messages could be returned. xx is from 01 to FF. |
CPF5100 E | All CPF51xx messages could be returned. xx is from 01 to FF. |
CPF5200 E | All CPF52xx messages could be returned. xx is from 01 to FF. |
CPF5300 E | All CPF53xx messages could be returned. xx is from 01 to FF. |
CPF8133 E | Table &4 in &9 damaged. |
CPF9800 E | All CPF98xx messages could be signaled. xx is from 01 to FF. |
See Code disclaimer information for information pertaining to code examples.
For examples that use the QQQQRY API, see Defining Queries in the Examples: APIs topic.
Top | Database and File APIs | APIs by category |