Query Document Library (QRYDOCLIB)

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

The Query Document Library (QRYDOCLIB) command allows you to search for documents within the document library. A document list is created containing the results of the search. You can also copy information about the documents that satisfy the search request into a database file for processing.

When the QRYDOCLIB command is run, a document list object is created. The document list object is created regardless of whether an output file is produced unless the user specifies *NONE for the DOCL parameter. This document list object is used by the OfficeVision/400 product as well as the SAVDLO command.

Restrictions:

Top

Parameters

Keyword Description Choices Notes
QRYDFN Query definition Single values: *NONE
Other values: Element list
Optional
Element 1: Start query *IF
Element 2: Search criteria Values (up to 49 repetitions): Element list
Element 1: Profile *ACTDATE, *ALWRPL, *ASP, *AUTHOR, *CHGDATE, *CMPDATE, *CPYLST, *CRTDATE, *DOCCLS, *DOCD, *DOCDATE, *DOCTYPE, *EXPDATE, *FILDATE, *IDXDATE, *KWD, *OWNER, *PROJECT, *REF, *REVDATE, *STATUS, *SUBJECT, *USEDATE
Element 2: Relational operator *EQ, *GT, *LT, *NE, *GE, *NL, *LE, *NG, *CT, *BG
Element 3: Compare value Character value, *YES, *NO
Element 4: Logical operator *AND, *OR
FLR In folder Single values: *ALL
Other values (up to 100 repetitions): Character value, *NONE
Optional
SCHSUBFLR Search subfolder *NO, *YES Optional
QRYTXT Query text Single values: *NONE
Other values: Element list
Optional
Element 1: Start query *IF
Element 2: Search criteria Values (up to 30 repetitions): Element list
Element 1: Phrase Character value
Element 2: Type of matching *ALL, *EXACT
Element 3: Allow synonyms *NO, *YES
Element 4: Logical operator *OR, *AND, *ANDNOT
TXTLANGID Language ID Character value, *JOB Optional
DOCL Document list Character value, *DFT, *NONE Optional
TEXT Text Character value, *BLANK Optional
OUTFILE File to receive output Single values: *NONE
Other values: Qualified object name
Optional
Qualifier 1: File to receive output Name
Qualifier 2: Library Name, *LIBL, *CURLIB
OUTMBR Output member options Element list Optional
Element 1: Member to receive output Name, *FIRST
Element 2: Replace or add records *REPLACE, *ADD
OUTDTATYP Type of data for output Single values: *DFT, *ALL
Other values (up to 21 repetitions): *ACTDATE, *AUTHOR, *CHGDATE, *CMPDATE, *CPYLST, *CRTDATE, *DOCCLS, *DOCD, *DOCDATE, *EXPDATE, *FILCAB, *FILDATE, *IDP, *IDXDATE, *KWD, *PROJECT, *REF, *REVDATE, *STATUS, *SUBJECT, *USEDATE
Optional
USRID User identifier Single values: *CURRENT
Other values: Element list
Optional, Positional 1
Element 1: User ID Character value
Element 2: Address Character value
TIMLMT Time limit 1-9999, *NOMAX Optional
SELLMT Selection limit 1-32767, *NOMAX Optional
ORDER Order by Single values: *NONE
Other values (up to 5 repetitions): Element list
Optional
Element 1: Profile *ACTDATE, *ASP, *AUTHOR, *CHGDATE, *CMPDATE, *CPYLST, *CRTDATE, *DOCCLS, *DOCD, *DOCDATE, *DOCTYPE, *EXPDATE, *FILDATE, *IDXDATE, *KWD, *OWNER, *PROJECT, *REF, *REVDATE, *STATUS, *SUBJECT, *USEDATE
Element 2: Selection order *ASCEND, *DESCEND
CMDCHRID Command character identifier Single values: *SYSVAL, *DEVD
Other values: Element list
Optional
Element 1: Graphic character set Integer
Element 2: Code page Integer
Top

Query definition (QRYDFN)

Specifies what query definition selection values are used to select the documents. The values you specify on this parameter are used to search the document library. If values other than *NONE are specified on both the Query text (QRYTXT) parameter and this parameter, only documents that match both sets of values are selected. If you specify *NONE on both parameters, all documents to which you are authorized are selected.

Single values

*NONE
No query definition is used to select the documents.

Element 1: Start query

*IF
A query definition is used to select the documents.

Element 2: Search criteria

To specify the conditions under which documents are selected, a set of values is specified for each condition. Each set must contain exactly four values:

  1. The name of the document profile parameter to be compared (from the list that follows)
  2. One of the relational operator values (from the list that follows)
  3. The compare value
  4. One of the logical operators *AND, *OR, or *ANDNOT

Values 1 and 3 are compared for the relationship specified by value 2. Each QRYDFN relational set must be enclosed in parentheses. A maximum of 49 sets of values can be specified.

Element 1: Profile

Specifies the name of the document profile parameter to be compared.

*ACTDATE
Action due date
*ALWRPL
Allow document replacement
*ASP
Auxiliary storage pool ID
*AUTHOR
Document author
*CHGDATE
Last change date
*CMPDATE
Completion date
*CPYLST
Copy list
*CRTDATE
Create date
*DOCCLS
Document class
*DOCD
Document description
*DOCDATE
Document date
*DOCTYPE
Document type
*EXPDATE
Expiration date
*FILDATE
File date
*IDXDATE
Last indexed date
*KWD
Keyword
*OWNER
Document owner
*PROJECT
Document project
*REF
Reference
*REVDATE
Last revision date
*STATUS
Document status
*SUBJECT
Document subject
*USEDATE
Last used date

Element 2: Relational operator

The relational operator indicates the relationship that must exist between the profile parameter contents in the document and the value specified as the compare value parameter of the query definition for the relationship to be true.

The *CT operator is used to perform a context search. It asks the system to determine whether the character string specified by the compare value is contained anywhere in the profile parameter.

The *BG operator is used to perform a search that compares the compare value with the beginning of the profile parameter. The profile parameter is truncated or extended as necessary to match the length of the specified value. It asks the system to determine whether the character string specified by the value is contained at the beginning of the profile parameter.

Some operators are not allowed for some profile parameters. In this case, a diagnostic message followed by an escape message is sent.

The following cases are not valid:

  • The *ALWRPL (allow document replacement) is a YES/NO switch. The *EQ operator is the only operator allowed with *ALWRPL.
  • The *CT and *BG operators are not allowed with the *ASP value or date values such as *CRTDATE and *EXPDATE.
*EQ
Equal
*GT
Greater than
*LT
Less than
*NE
Not equal
*GE
Greater than or equal
*NL
Not less than
*LE
Less than or equal
*NG
Not greater than
*CT
Contains
*BG
Begins

Element 3: Compare value

Specifies the compare value to be used in the search.

character
Specify the value to compare with the contents of the specified profile parameter. The parameter value must be specified in apostrophes if it contains blanks or special characters.

The *ALWRPL field has two special values: *YES and *NO. When these are specified with the *ALWRPL field, they are changed to internal values for the indicator. When *YES or *NO are specified for the text field, they are used like they are.

The *OWNER field is an 8-character user ID followed by its address. Trailing blanks cannot be omitted from the user ID. For example, if the user ID is JMDOE and the address is SYSTEM1, the query request would be:

(*IF ((*OWNER *EQ 'JMDOE   SYSTEM1'))).

If the user ID is JIMSMITH, the query request would be:

(*IF ((*OWNER *EQ 'JIMSMITHSYSTEM1'))).

Dates must be entered in the system date format.

Note: If one of the date profile parameters is specified and the compare value is ' '(blank), then the compare value is equated to 01/01/01 or 01/001 for Julian date. '/' is changed depending on the system separator value QDATSEP.

The allowable length for the search fields is limited by the Document Interchange Architecture (DIA) search database. When the length of the value is greater than the maximum, the value is truncated to the allowed length. The maximum lengths are:

Value
Maximum Length
*DOCD
44 characters
*DOCCLS
16 characters
*SUBJECT
60 characters
*AUTHOR
20 characters
*KWD
60 characters
*CPYLST
60 characters
*OWNER
16 characters
*REF
60 characters
*STATUS
20 characters
*PROJECT
10 characters

For all operators except *CT and *BG, if a value is specified that is shorter than the profile parameter value, then the specified value is extended with blanks to match the length of the profile parameter.

The case (upper, lower, or mixed) that is used to enter the original parameter value or the case of the comparison value do not matter. The system changes both the entered comparison value and the original parameter value to upper case before making a comparison.

Element 4: Logical operator

The logical operators are used to group conditions. The first AND operator encountered signifies that a condition group starts with the condition immediately preceding the AND operator. Subsequent conditions with the AND operator are added to the condition group. The first condition encountered containing the OR operator or the last condition in the query definition ends the condition group.

*AND
The profile parameter value relational groups on both sides of the *AND value must all be satisfied before a document is selected.
*OR
If the parameter value relational group on either side of the *OR value is satisfied, the document is selected.
Top

In folder (FLR)

Specifies the folders to search for the documents that match the search values specified on the Query definition (QRYDFN) parameter and the Query text (QRYTXT) parameter.

*ALL
All the folders on the system are searched.
*NONE
Documents not located in any folder are searched.
name
Specify the name of the folders to search for the documents. This is the only folder searched. A folder name can consist of a series of folder names (FLR1/FLR2/etc.) if the documents being searched for are located in a folder contained in another folder. A maximum of 100 folders can be specified and each folder name can be a maximum of 63 characters in length.
Top

Search subfolder (SCHSUBFLR)

Specifies whether subfolders of the folder specified on the In folder (FLR) parameter are searched.

*NO
Subfolders are not searched.
*YES
Subfolders of the specified folder are searched.
Top

Query text (QRYTXT)

Specifies the text search values used to select documents. The values you specify on this parameter are used to search the text index. If values other than *NONE are specified on both the Query definition (QRYDFN) parameter and this parameter, only documents that match both sets of values are selected. If you specify *NONE on both parameters, all documents to which you are authorized are selected.

Single values

*NONE
No text search values are entered.

Element 1: Start query

*IF
Text search values are used in the document search.

Element 2: Search criteria

To specify the conditions under which documents are selected, a set of values is specified for each condition. Each set contains four values:

  1. A phrase, which the system compares to entries in the text search index
  2. One of the 'type of matching' values
  3. One of the 'allow synonyms' values
  4. One of the logical operators

A maximum of 30 sets of values can be specified. Each set must be enclosed in parentheses.

Element 1: Phrase

Specifies a phrase which the system compares to entries in the text search index.

character
Specify a phrase of one or more words. Do not use any punctuation. When specifying phrases, you can:
  • use an asterisk (*) to mask a whole word within a phrase. For example, if you want to search for documents referring to various annual reports, you can specify the phrase:

       annual * report
    

    The search results will include documents containing such phrases as annual budget report, annual progress report, and annual sales report. The search results will also include documents containing the phrase 'annual report' without a word in between.

    When using a word mask, you must specify a word before and after the asterisk. A word mask at the beginning or end of a phrase is ignored.

  • use an asterisk (*) to mask part of a word within a phrase. The mask can be used at the beginning, middle, or end of a word. For example, if you want to search for documents referring to word processing, you can specify the phrase:

       word process*
    

    The search results will include documents containing such phrases as word processing, word processor, and word processed.

  • use a question mark (?) to mask one or more characters in a word. For example, if you want to search for documents referring to the various spellings of Johnson, you can specify the phrase:

       j?hns?n
    

    The search results will include documents containing such phrases as johnson, johnsen, and jahnson.

Element 2: Type of matching

Specifies a type of matching value to be used in the search.

*ALL
The phrase must be contained within one sentence, but the words do not have to be in the specified order.
*EXACT
The phrase must be contained within one sentence and the words must be in the specified order.

Element 3: Allow synonyms

Specifies whether synonyms are to be used in the search.

*NO
No synonyms are used.
*YES
Synonyms for each word in the phrase, if available, are also used to compare to entries in the text index.

Note: Using synonyms may affect the performance of the request by causing more words to be searched for, and possibly by causing more documents to be selected.

Element 4: Logical operator

Specifies a logical operator to be used in the search.

*OR
If the phrase on either side of the *OR value is found, the document is selected.
*AND
If the phrases on both sides of the *AND value are found, the document is selected.
*ANDNOT
If the phrase following the *ANDNOT value is not found, the document is selected.
Top

Language ID (TXTLANGID)

Specifies the language identifier for the phrases in the query text. This parameter is required if the Query text (QRYTXT) parameter is specified; it is not allowed if the QRYTXT parameter is not specified or has a value of *NONE.

*JOB
The language identifier specified for the job in which this command is entered is used.
character
Specify a language identifier. Press the PF4 key when prompting the Language ID (TXTLANGID) parameter to see a list of valid identifiers.
Top

Document list (DOCL)

Specifies the name of the document list. The document list contains a pointer to each document in the document library that is qualified for search. This list is a copy of the library at the time the search was run. As documents are deleted from the library or added to the library, the document list is not updated. The document library list name is specified with the name of the user requesting the search.

*DFT
A system created name is used as the default name. The default list is the same as the user ID on the User identifier (USRID) parameter.
*NONE
No document list is created.
character
Specify the name of the document list. A maximum of 8 characters can be used.
Top

Text (TEXT)

Specifies the text that briefly describes the object.

*BLANK
No text is specified.
character
Specify a maximum of 50 characters, enclosed in apostrophes.
Top

File to receive output (OUTFILE)

Specifies the database file to which the output of the command is directed. If the file does not exist, this command creates a database file in the specified library. If the file is created, the public authority for the file is the same as the create authority specified for the library in which the file is created. Use the Display Library Description (DSPLIBD) command to show the library's create authority.

Qualifier 1: File to receive output

name
Specify the name of the database file to which the command output is directed.

Qualifier 2: Library

*LIBL
The library list is used to locate the file. If the file is not found, one is created in the current library. If no current library exists, the file will be created in the QGPL library.
*CURLIB
The current library for the thread is used to locate the file. If no library is specified as the current library for the thread, the QGPL library is used.
name
Specify the name of the library to be searched.

Note: If a new file is created, the system uses QAOSIQDL in QSYS with a format name of OSQDL as a model.

Top

Output member options (OUTMBR)

Specifies the name of the database file member that receives the output of the command.

Element 1: Member to receive output

*FIRST
The first member in the file receives the output. If OUTMBR(*FIRST) is specified and the member does not exist, the system creates a member with the name of the file specified for the File to receive output (OUTFILE) parameter. If the member already exists, you have the option to add new records to the end of the existing member or clear the member and then add the new records.
name
Specify the name of the file member that receives the output. If it does not exist, the system creates it.

Element 2: Replace or add records

*REPLACE
The system clears the existing member and adds the new records.
*ADD
The system adds the new records to the end of the existing records.
Top

Type of data for output (OUTDTATYP)

Specifies that certain information about the selected documents is written to the output file if a value is specified on the File to receive output (OUTFILE) parameter.

*DFT
The document information record is written to the output file. This is the same as specifying *DOCD. The record code is 105.
*ALL
All information records about the document are written.
*ACTDATE
The action due date record is written. The record code is 135.
*AUTHOR
The author records are written. The record code is 145.
*CHGDATE
The date last changed record is written. The record code is 130.
*CMPDATE
The completion date record is written. The record code is 140.
*CPYLST
The copy list records are written. The record code is 150.
*CRTDATE
The create date record is written. The record code is 110.
*DOCCLS
The document class record is written. The record code is 155.
*DOCD
The document description record is written. The record code is 105.
*DOCDATE
The document date record is written. The record code is 120.
*EXPDATE
The expiration date record is written. The record code is 115.
*FILCAB
The file cabinet reference record is written. The record code is 160.
*FILDATE
The file date record is written. The record code is 125.
*IDP
The interchange document profile (IDP) is written. The record code is 500.
*IDXDATE
The last indexed date record is written to the output file. OfficeVision/400 text search services must be installed if this value is specified.
*KWD
The keyword records are written. The record code is 170.
*PROJECT
The project record is written. The record code is 185.
*REF
The reference record is written. The record code is 175.
*REVDATE
The date of the last revision to the document content is written to the output file.
*STATUS
The status record is written. The record code is 180.
*SUBJECT
The subject records are written. The record code is 165.
*USEDATE
The date last used record is written. The record code is 200.
Top

User identifier (USRID)

Specifies which user ID and user ID address should be associated with the request.

Single values

*CURRENT
You are performing the request for yourself.

Element 1: User ID

character
Specify another user's user ID or your user ID. You must have been given permission to work on behalf of another user or have all object (*ALLOBJ) special authority.

Element 2: Address

character
Specify another user's address or your address. You must have been given permission to work on behalf of another user or have *ALLOBJ authority.
Top

Time limit (TIMLMT)

Specifies the amount of time allowed for the requested search to run.

*NOMAX
No time limit for the search is set. All qualified documents are searched.
1-9999
Specify the maximum time limit (in minutes) that the search runs. A two-hour limit is specified as TIMLMT(120). If the search has not been completed when the time limit is reached, the search ends with an informational message followed by a completion message. The output file, and if specified the document list, will contain the documents found within the specified time limit.
Top

Selection limit (SELLMT)

Specifies the allowed number of documents to select in the search.

*NOMAX
No document limit for the search is set. All qualified documents are selected, up to the system limit of 32,767.
1-32,767
Specify the maximum number of documents to select. If there are more documents than the set limit, the document list and the output file contain information about the selected documents up to this limit and an informational message indicating that the limit was reached. The completion message indicates the number of documents selected.
Top

Order by (ORDER)

Specifies that the selected documents are to be ordered (ascending or descending) when placed in the created document list or output file. The order is defined for one or more document profile parameters specified, up to a maximum of 5.

Note: If a value other than *NONE is specified on the Query text (QRYTXT) parameter, ordering is not allowed.

When a user specifies an order to the search request, the performance of the request may be affected. The request performs best if no order is specified.

Single values

*NONE
No order is applied to the selected documents.

Element 1: Profile

*ACTDATE
The returned documents are ordered by the action due date.
*ASP
The returned documents are ordered by the auxiliary storage pool ID (ASPID) parameter.
*AUTHOR
The returned documents are ordered by the author.
*CHGDATE
The returned documents are ordered by the last changed date.
*CMPDATE
The returned documents are ordered by the completion date.
*CPYLST
The returned documents are ordered by the copy list.
*CRTDATE
The returned documents are ordered by the create date.
*DOCCLS
The returned documents are ordered by the document class.
*DOCD
The returned documents are ordered by the document description.
*DOCDATE
The returned documents are ordered by the document date.
*DOCTYPE
The returned documents are ordered by the document type profile parameter. Valid values range from 2 through 65535.
*EXPDATE
The returned documents are ordered by the expiration date.
*FILDATE
The returned documents are ordered by the date the documents were filed.
*IDXDATE
The returned documents are ordered by the last indexed date profile parameter. Text search services must be installed if this value is specified.
*KWD
The returned documents are ordered by the keyword.
*OWNER
The returned documents are ordered by the name of the owner user profile name.
*PROJECT
The returned documents are ordered by the project.
*REF
The returned documents are ordered by the reference.
*REVDATE
The returned documents are ordered by the last content revision date.
*STATUS
The returned documents are ordered by the status.
*SUBJECT
The returned documents are ordered by the subject.
*USEDATE
The returned documents are ordered by the last used date.

Element 2: Selection order

*ASCEND
The returned documents are ordered in the ascending collating sequence.
*DESCEND
The returned documents are be ordered in the descending collating sequence.
Top

Command character identifier (CMDCHRID)

Specifies the character identifier (graphic character set and code page) for the data being entered as command parameter values. The character identifier is related to the display device used to enter the command.

The CMDCHRID parameter applies to the following parameters and means that the data is translated to the code page and character set common to all documents in the search database. That character set and code page is '697 500', except for the User identifier (USRID) parameter, which is '930 500'.

The following parameters are translated:

Single values

*SYSVAL
The system determines the graphic character set and code page values for the command parameters from the QCHRID system value.
*DEVD
The system determines the graphic character set and code page values from the display device description where this command was entered. This option is valid only when entered from an interactive job. If this option is specified in a batch job, an error occurs.

Element 1: Graphic character set

1-32767
Specify the graphic character set to use.

Element 2: Code page

1-32767
Specify the code page to use.
Top

Examples

QRYDOCLIB   USRID(*CURRENT)  OUTFILE(*NONE)  DOCL(MYLIST)
            QRYDFN(*IF ((*DOCD *EQ DOCDESC *AND)
                        (*DOCCLS *BG CLASS *OR)
                        (*FILDATE *LE '06/13/88')))

This command searches for documents that meet the following search conditions: document description equals DOCDESC and document class starts with Class; or the file date is on or before 06/13/88. The results of the search will be stored in the document list MYLIST.

Top

Error messages

*ESCAPE Messages

CPF900B
User ID and address &1 &2 not in System Distribution Directory.
CPF900C
Sign on and verify of user failed.
CPF905C
Error occurred trying to find a translation table.
CPF905D
Query of document library failed.
CPF9096
Cannot use CMDCHRID(*DEVD), DOCCHRID(*DEVD) in batch job.
CPF9860
Error occurred during output file processing.
Top