Create Query Management Query (CRTQMQRY)

Where allowed to run: All environments (*ALL)
Threadsafe: No
Parameters
Examples
Error messages

The Create Query Management Query (CRTQMQRY) command allows you to create a query management query from a specified source file member. The source for a query is a single Structured Query Language (SQL) statement that can contain variable substitution values and embedded comments. It can be spread over multiple records in a source file member.

Top

Parameters

Keyword Description Choices Notes
QMQRY Query management query Qualified object name Required, Positional 1
Qualifier 1: Query management query Name
Qualifier 2: Library Name, *CURLIB
SRCFILE Source file Qualified object name Optional, Positional 2
Qualifier 1: Source file Name, QQMQRYSRC
Qualifier 2: Library Name, *LIBL, *CURLIB
SRCMBR Source member Name, *QMQRY Optional, Positional 3
TEXT Text 'description' Character value, *SRCMBRTXT, *BLANK Optional
SRTSEQ Sort sequence Qualified object name Optional
Qualifier 1: Sort sequence Name, *SRC, *JOBRUN, *JOB, *HEX, *LANGIDSHR, *LANGIDUNQ
Qualifier 2: Library Name, *LIBL, *CURLIB
LANGID Language ID Character value, *SRC, *JOBRUN, *JOB Optional
AUT Authority Name, *USE, *CHANGE, *ALL, *EXCLUDE, *LIBCRTAUT Optional
REPLACE Replace object *YES, *NO Optional
Top

Query management query (QMQRY)

Specifies the query management query to be created.

This is a required parameter.

Qualifier 1: Query management query

name
Specify the name of the query to be created.

Qualifier 2: Library

*CURLIB
The current library for the job is used to locate the query. If no library is specified as the current library for the job, the QGPL library is used.
name
Specify the name of the library where the query is located.
Top

Source file (SRCFILE)

Specifies the source file containing the source for the query being created. The query is identified by the name specified on the QMQRY parameter.

Qualifier 1: Source file

QQMQRYSRC
IBM-supplied source file QQMQRYSRC contains the source for the query to be created.
name
Specify the name of the file containing the source for the query to be created.

Qualifier 2: Library

*LIBL
All libraries in the library list for the current thread are searched until the first match is found.
*CURLIB
The current library for the job is searched. If no library is specified as the current library for the job, the QGPL library is used.
name
Specify the name of the library to be searched.
Top

Source member (SRCMBR)

Specifies the member of the source file member that contains source for the query to be created.

*QMQRY
The member name is the same as the query name specified on the QMQRY parameter.
name
Specify the name of the member that contains the query source.
Top

Text 'description' (TEXT)

Specifies the text that briefly describes the query management query.

*SRCMBRTXT
The descriptive text for the object being created is the same as the text description of the source member. If the source member has no text description, or if it is blank, then TEXT(*BLANK) is assumed.
*BLANK
No text is specified. If this command causes an object to be replaced, any existing text for the object is replaced with blank text.
character-value
Specify no more than 50 characters of text, enclosed in apostrophes. The apostrophes are not part of the 50-character string.
Top

Sort sequence (SRTSEQ)

Specifies the sort sequence table to be used for string comparisons in this query.

Note: This parameter is valid only when creating a query. This parameter is not valid when creating a FORM.

Qualifier 1: Sort sequence

*SRC
The source file member contains the sort sequence to be used when creating the query.
*JOBRUN
The SRTSEQ value for the job at the time the query is run is used.
*JOB
The SRTSEQ value for the job at the time the query is created is used.
*HEX
A sort sequence table is not used, and the hexadecimal values of the characters are used to determine the sort sequence.
*LANGIDUNQ
The unique-weight sort table for the language specified on the LANGID parameter is used.
*LANGIDSHR
A shared-weight sort table for the language specified on the LANGID parameter is used.
name
Specify the name of the sort sequence table to be used when this query is created.

Qualifier 2: Library

*LIBL
All libraries in the library list for the current thread are searched until the first match is found.
*CURLIB
The current library for the job is searched. If no library is specified as the current library for the job, the QGPL library is used.
name
Specify the name of the library to be searched.
Top

Language ID (LANGID)

Specifies the language identifier to be used when SRTSEQ(*LANGIDUNQ) or SRTSEQ(*LANGIDSHR) is specified.

*SRC
The source file member contains the language ID to be used when the query is created.
*JOBRUN
The LANGID value for the job is determined when the query is run.
*JOB
The LANGID value for the job is determined when the query is created.
language-ID
Specify the language identifier to be used for the query.
Top

Authority (AUT)

Specifies the authority you are giving to users who do not have specific authority for the object, who are not on an authorization list, and whose group profile or supplemental group profiles do not have specific authority for the object.

*LIBCRTAUT
The system determines the authority for the object by using the value specified for the Create authority (CRTAUT) parameter on the Create Library command (CRTLIB) for the library containing the object to be created. If the value specified for the CRTAUT parameter is changed, the new value will not affect any existing objects.
*CHANGE
The user can perform all operations on the object except those limited to the owner or controlled by object existence (*OBJEXIST) and object management (*OBJMGT) authorities. The user can change and perform basic functions on the object. *CHANGE authority provides object operational (*OBJOPR) authority and all data authority. If the object is an authorization list, the user cannot add, change, or remove users.
*ALL
The user can perform all operations except those limited to the owner or controlled by authorization list management (*AUTLMGT) authority. The user can control the object's existence, specify the security for the object, change the object, and perform basic functions on the object. The user also can change ownership of the object.
*USE
The user can perform basic operations on the object, such as running a program or reading a file. The user cannot change the object. Use (*USE) authority provides object operational (*OBJOPR), read (*READ), and execute (*EXECUTE) authorities.
*EXCLUDE
The user cannot access the object.
name
Specify the name of an authorization list to be used for authority to the object. Users included in the authorization list are granted authority to the object as specified in the list. The authorization list must exist when the object is created.
Top

Replace object (REPLACE)

Specifies whether an object with the same name and type in the library to receive the output is replaced with the output of this command.

*YES
An existing object is replaced with the output of this command.
*NO
An existing object is not replaced with the output of this command.
Top

Examples

CRTQMQRY   QMQRY(NEWQRY)  SRCFILE(RPTLIB/QRYSRC)

This command creates a query named NEWQRY in the current library. The query source is in member NEWQRY, which is located in source file QRYSRC in library RPTLIB.

Top

Error messages

*ESCAPE Messages

QWM2701
&1 command failed.
QWM2703
&1 command ended.
QWM2705
Source file &1 in &2 not available.
QWM2706
&1 in &2 not replaced.
Top