QMF Catalog objects versus Repository folder objects
When using procedure commands that manipulate QMF objects, (queries, forms, visual reports, or procedures) different syntax should be used for identifying objects that are stored in a QMF Catalog and objects that are stored in a Repository folder.
Objects stored in QMF Catalogs
When QMF objects are stored in a QMF Catalog, the syntax for referring to them in a procedure is to refer to them by<TYPE>
<OWNER>
.<OBJECT_NAME>
. For example:Example 1:
In the QMF
Catalog, RUN QUERY ADMIN.TESTQ
DISPLAY FORM ADMIN.TESTF
<OWNER>.<OBJECT_NAME>
is unique, so the
<TYPE>
identifying is optional but recommended for making the procedure
readable. So, this procedure: Example
2:
RUN QUERY ADMIN.TESTQ
DISPLAY FORM ADMIN.TESTF
could also be written
as:RUN ADMIN.TESTQ
DISPLAY ADMIN.TESTF
Also, if the procedure that is manipulating the QMF Catalog object is being run by the owner of the object, then the
<OWNER>
identifying is also optional. For example, if the procedure is being
run by someone who is signed on as ADMIN
, then it could also be written as
follows:Example
3:
While the shorter object identifiers are supported and are useful
in certain situations, in general it is best practice to fully qualify the procedure object
identifiers as shown in Example 1.RUN QUERY TESTQ
DISPLAY FORM TESTF
orRUN TESTQ
DISPLAY TESTF
Note: In general procedure references to QMF Catalog names are not case sensitive. It is possible but not common for QMF Catalog objects to have more exotic names than the
traditional eight character names. For example, mixed case names and names with spaces and
special characters are supported if during the initial save the name is enclosed in double
quotes. Thereafter all references to the object must also encase the object name in double
quotes. For example:
Example
4:
RUN QUERY ADMIN.”Test Case for Query @ HQ”
To refer to a QMF Catalog object whose <OWNER>
is different than the
<OWNER>
of the procedure, you can set the current SQL ID to the
<OWNER>
of the QMF Catalog object. Subsequently, you can refer to the object
without specifying the <OWNER>
.
Example 5:
To run the query NEWQUERY whose owner is different from the owner
of the procedure, you can run the query by setting the current SQL ID to the
<OWNER>
of NEWQUERY.
SET CURRENT SQLID = 'Q'
RUN QUERY NEWQUERY
Objects stored in Repository folders
When QMF objects are stored in a Repository folder, the syntax for referring to them in a procedure is to refer to them by<TYPE>
<OBJECT_NAME>
. For example:Example 5:
RUN QUERY TESTQ
Notice
that the syntax of this example matches the syntax of shown in Example 3 in the QMF Catalog section. Therefore when a procedure command is submitted there is a search
order that QMF uses to locate the
objects referenced in the procedure.- QMF looks for a QMF Catalog and searches it for a matching
<OWNER>.<OBJECT_NAME>
. If one is found it is used. If no<OWNER>
is supplied as in the Example 5, then the current user ID is used for the<OWNER>
value as described in the third example of the QMF Catalog section. This means that procedures that are stored in a Repository folder can access objects that are stored in the QMF Catalog. - QMF searches the folder in the Repository containing the procedure that is being run. When authoring a new procedure from scratch, this is very important to keep in mind. The new procedure does not have a Repository folder until it has been saved to the Repository. QMF will search the QMF Catalog and if it does not find a match then the search stops and the Repository objects will not be found.
- QMF searches the rest of the Repository
folders for a match. This search will not take place if the procedure has not been saved to a
Repository folder yet. Caution: The result of the search among the rest of the Repository tree
might not result as expected if there is more than one object of the same name. Unlike the QMF Catalog, the Repository tree does not enforce uniqueness
on object names outside the same folder. Therefore, for procedures that refer to objects by
<OBJECT_NAME>
, it is highly recommended that the objects be in the same folders as the procedure that references them.
Using the Key property to reference objects
With a complex Repository tree and objects that are stored outside the same folder as the procedure that references them, another syntax is available that guarantees uniqueness. When an object is selected in the Repository tree, the Properties view for that object contains a field called Key. The Key is unique and can be used by a procedure to reference the object. For example:RUN QUERY qmf:/.workspaces/Default/Queries/TESTQ
If
text in the Key contains spaces, then the Key must be enclosed in double quotes. Procedures in
development that have not been saved to the Repository yet can be run using the Key syntax. A
procedure that is stored in the QMF Catalog can use the Key
syntax to access objects that are stored in Repository folders.