Yes, there is a way to write a query on one iSeries server, run it on a database residing on a second iSeries server, and have the resulting report or outfile on the first iSeries. The STRQMQRY command accepts a database name, user and password, and will connect to the remote database for the query execution.
STRQMQRY runs by default Query Management Queries which are created with STRQM -- an excellent alternative to WRKQRY since you can write your own SQL in a query. However, there is an option to run regular queries (of type *QRYDFN) as well. To run a regular query, use the ALWQRYDFN(*YES) option. Thus, a regular query called MYQRY that is to execute on another computer called AS4002 and to print the results on the local machine will be STRQMQRY QMQRY(MYQRY) OUTPUT(*PRINT) RDB(AS4002) USER(USER) PASSWORD(pwd) ALWQRYDFN(*YES)
Note:
You have to define AS4002 with the WRKRDBDIRE command before this works.================================== MORE INFORMATION ON THIS TOPIC ==================================
The Best Web Links: tips, tutorials and more.
Ask your programming questions--or help out your peers by answering them--in our live discussion forums.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.
This was first published in June 2003