Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

QMF prompted input carried over multiple queries

Status
Not open for further replies.

987654

Programmer
Aug 9, 2001
2
0
0
IL
Greetings,

In QMF (Query Management Facility) for DB2 I have set up a PROC which runs and exports the result of five queries. Each query requires the user to enter the same two prompted details. Instead of the user entering the same criteria five times, I am looking for a way to use the criteria captured in the first prompt as the criteria for the rest of the queries.
I was reading about global parameters in the QMF's Help system, is this what I am after? Can this be done?

Thanks for any help,
Scott
 
Hi Scott,
The GLOBAL option is definitely what you require. This will enable you to set &userid (for instance) at the beginning of the PROC and have it carried through to numerous QUERIES within the proc. Haven't done this in a while but seem to recall that the command is SET GLOBAL(userid=ABC123)
Hope this helps
Marc
 
Hi Scott,

You have two options:

The easiest is the GLOBAL option.
ADV: Easiest to program
DIS: Once the globals are set, they remain in effect
until the session ends. You can solve this by
imbedding the RESET GLOBAL ALL at the end of the proc.
__________________________________

proc1:
SET GLOBAL (vari1 = &VARI1
+ vari2 = &VARI2

RUN query1
EXPORT DATA TO file1 (CONFIRM = NO
RUN query2
EXPORT DATA TO file2 (CONFIRM = NO ...

RESET GLOBAL ALL <--- will remove all globals
___________________________________
When you run the proc:

VARI1 ===> (enter value for vari1)
VARI2 ===> (enter value for vari2)
___________________________________
The other option is to pass the parameters from the proc
to the queries.

ADV: Will do the same thing as above but the values will
not be retained within a session.
DIS: Redundant keying for each query.
______________________________________

Proc1:
RUN query1 (&&vari1 = &vari1, &&vari2 = &vari2
EXPORT DATA TO file1 (CONFIRM = NO
RUN query2 (&&vari3 = &vari1, &&vari4 = &vari2
EXPORT DATA TO filename2 (CONFIRM = NO ...
_______________________________

When you run this proc, it will ask for variable values to resolve, and pass them to query1 as vari1,2 and query2 as vari3 and 4.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top