Page 1 of 1
copy QMF queries, procs from one user to another
Posted: Sat Oct 23, 2021 6:43 pm
by Rajat Singh
Hi,
Can we copy QMF queries, procs from one user to another? How to do it, could you please help.
Thanks in advance.
Re: copy QMF queries, procs from one user to another
Posted: Wed Oct 27, 2021 8:01 pm
by Rajat Singh
Hi,
Could someone please help on this? It'll be a great help.
Re: copy QMF queries, procs from one user to another
Posted: Thu Oct 28, 2021 12:39 am
by Robert Sample
Google is your friend. I Googled "copy qmf queries" and got the first hit for
https://www.ibm.com/support/pages/how-c ... er-another which says
How can I copy QMF objects from one user to another?
Question & Answer
Question
How can I copy QMF procedures, queries, and forms from one QMF user to another?
Answer
The most direct method to copy QMF objects to new owners is for the recipient to display the owner's object and save it under the recipient's userid (RECIPID). If the object's owner has saved a query, form, or proc with the SHARE=YES parameter, other users can display the object and save it under their own userid.
If user RECIPID enters these commands:
Command ===> DISPLAY OWNERID.QUERY23
Command ===> SAVE
The query will be saved as RECIPID.QUERY23
=================================================================
Another method is to use the QMF EXPORT and IMPORT commands:
1. The object owner exports the QMF object using the export command:
Command ===> EXPORT QUERY TO XXX
The data set with OWNERID's High Level Qualifier is created ==> ' OWNERID.XXX.QUERY'.
2. The recipient user RECIPID must fully qualify the import command to receive the file created by OWNERID:
Command ===> IMPORT QUERY YYY FROM 'OWNERID.XXX.QUERY.
The recipient can use the original query name, XXX, for his imported query's name, or give it a new name, YYY.
However, RECIPID must have authority to READ OWNERID's data sets. Most shops use the RACF utility to grant such authority. If your shop doesn't use RACF, some other product is being used.
Management of this kind of authority is handled outside of QMF and affects everything you do on TSO/ISPF, not just QMF.
3. You can write a REXX exec in a QMF procedure to EXPORT or IMPORT multiple objects at once. REXX can be used to identify all data sets that fit the naming profile of exported objects, such as 'OWNERID.*.QUERY', and IMPORT each of those to new objects under the userid RECIPID.
This sample REXX program uses the TSO command LISTD to create a list of all data sets that follow the naming convention 'OWNERID.*.QUERY'. The QMF IMPORT command is issued for each data set found, thus creating a new query under RECIPID's userid for each of OWNERID's exported queries. This simple exec does not check for existing queries of the same name, and it names each new query QUERYn, where n = a number. Ex. 'OWNERID.FINDHATS.QUERY' could be imported as 'RECIPID.QUERY26'.
/* REXX */
HLQ = 'OWNERID'
OBJECT = 'QUERY'
FILTER = HLQ'.*.'OBJECT
ADDRESS TSO
CALL OUTTRAP "DSN.","*"
"LISTD '"FILTER"'"
IF RC = 0 THEN
DO
ADDRESS QRW
DO I = 1 TO DSN.0
DSSTART = POS(HLQ, DSN.I)
IF DSSTART > 0 THEN
DO
DSLEN = LENGTH(DSN.I)
DSNAME = SUBSTR(DSN.I,1,DSLEN)
"IMPORT "OBJECT "QUERY"I" FROM '"DSNAME"'"
END
END
END
ELSE
SAY 'NO EXPORTED 'FILTER 'DATA SETS FOUND.'
RETURN
So now you know what IBM tells you to do. If you want something else, the Google search returned plenty of other hits.
Re: copy QMF queries, procs from one user to another
Posted: Fri Oct 29, 2021 8:23 am
by Rajat Singh
Thank you so much Robert. I must have done some wrong search. Will keep posted about what I've used, will research. Thanks again.