CRTQMQRY (Create Query Management Query)

CRTQMQRY Command syntax diagram

 

Purpose

The Create Query Management Query (CRTQMQRY) command allows the user 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.

 

Required Parameters

QMQRY
Specifies the name of the query management query to be created.

The possible library values are:

*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.

library-name: Specify the name of the library where the query is located.

query-name: Specify the name of the query to be created.

 

Optional Parameters

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

The name of the source file can be qualified by one of the following library values:

*LIBL: All libraries in the job's library list 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.

library-name: Specify the name of the library to be searched.

QQMQRYSRC: The file having the IBM-supplied source file name, QQMQRYSRC, contains the source for the query to be created.

source-file-name: Specify the name of the file containing the source for the query to be created.

SRCMBR
Specifies the name of the source file member containing the source for the query to be created.

*QMQRY: The member name is the same as the query name specified on the QMQRY parameter.

source-file-member-name: Specify the name of the member that contains the query source.

TEXT
Specifies the text that briefly describes the query management query. More information on this parameter is in Commonly used parameters.

*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, then any existing text for the object is replaced with blank text.

'description': Specify no more than 50 characters of text, enclosed in apostrophes. The apostrophes are not part of the 50-character string.

AUT
Specifies the authority given to users who do not have specific authority to the query management query, who are not on an authorization list, and whose user group has no specific authority to the query management query. More information on this parameter is in Commonly used parameters.

*LIBCRTAUT: The public authority for the query management query is taken from the value on the CRTAUT parameter of the target library (the library that is to contain the query management query). The public authority is determined when the query management query is created. If the CRTAUT value for the library changes after the query management query is created, the new value does 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 authority and object management authority. The user can change and perform basic functions on the object. Change authority provides object operational authority and all data authority.

*ALL: The user can perform all operations except those limited to the owner or controlled by authorization list management 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 query management query. If the object is part of an authorization list, the user cannot add, change, or remove other users.

*USE: The user can perform basic operations on the object, for example, run a program or read a file. The user is prevented from changing the object in any way. This authority provides object operational authority and read authority.

*EXCLUDE: The user cannot access an object.

authorization-list-name: Specify the name of the authorization list used.

REPLACE
Specifies whether an existing object with the same name and type in the library to receive the output is replaced with the output of this command. More information on this parameter is in Commonly used parameters.

*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.

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.

*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. 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: The shared-weight sort table for the language specified on the LANGID parameter is used.

The name of the sort sequence table can be qualified by one of the following library values:

*LIBL: All libraries in the job's library list 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.

library-name: Specify the name of the library to be searched.

table-name: Specify the name of the sort sequence table to be used when this query is created.

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.

Example for CRTQMQRY

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.

Error messages for CRTQMQRY

*ESCAPE Messages

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