Normally, to run an SQL statement, you specify it on the SQL parameter of the RUNIQRY command as follows:
RUNIQRY SQL('SELECT * FROM QIWS/QCUSTCDT')
You can also save the SQL statement in a source member and recall it later, using the following syntax:
RUNIQRY SRCMBR(SAMPLE) SRCFILE(MYLIB/QSQLSRC)
A great feature in SQL iQuery allows users to store SQL statements in source member and more easily recall them. We call this our "SQL Macro" feature or simply, Macros.
Using the RUNIQRY command, users may run pre-defined SQL statements using the member name as a "macro" identifier. To do so, the member name is specified on the SQL parameter, prefixed with an asterisk. User-defined macros are stored in QMACSRC on the library list, whereas SQL iQuery's built-in macros are stored elsewhere. For example to run the SQL iQuery-provided USRPRF (User Profile Listing) macro, type the following:
This statement runs the SQL statement stored in the source member named USRPRF in the source file named QIQMACROS in the SQL iQuery product library.
There are a number of macros shipped with SQL iQuery (see below) and end-users may create their own. User-created Macros should be stored in source file QMACSRC in a library on the library list.
For example, if the source member named SAMPLE is created in source file QMACSRC and contains: SELECT * FROM QIWS/QCUSTCDT; then following RUNIQRY command could be used to run that SQL statement as follows:
When RUNIQRY is run, it first checks for the macro name as a member in QMACSRC on the library list. If it does not locate a member with that name, it then searches source file QIQMACROS in the SQL iQuery product library for the member.
The SQL iQuery product ships with the following Macros. Some are for testing/debugging the product and your system's setup but most are for daily use.
Click on the Macro name to view the SQL Statement being run for that Macro.
Powered by COZTOOLS find out more
Click on a name in the list to view its contents.
Source Viewer © 2004 Robert Cozzi, Jr. All rights reserved.
|ACTJOB||2017-04-27 16.55.26||513||List Active Jobs|
|ALLUSR||2017-04-27 16.55.26||453||List User Profiles|
|DB2PTF||2017-04-27 16.55.25||453||DB2 Group PTF Level|
|DFTPWD||2017-04-27 16.55.26||339||Check for Users Potentially with Default Password|
|DMGOBJ||2017-04-27 16.55.26||305||Damaged Objects Report|
|DSK||2017-04-27 16.55.26||439||Disk Unit Report|
|DSPJRN||2017-04-27 16.55.26||157||Display Journal|
|GRPPRF||2017-04-27 16.55.26||443||Group Profile Membership list|
|IBMBLOG||2017-04-27 16.55.26||442||IBM Db2 for i Blog Article Links|
|INTERACT||2017-04-27 16.55.26||271||All Interactive Jobs|
|JOBATTR||2017-04-27 16.55.26||45||Job Attributes|
|JOBLOG||2017-04-27 16.55.26||2003||Joblog table Function QSYS2.JOBLOG_INFO(...)|
|JOBSCD||2017-04-27 16.55.26||450||Check Job Scheduler Entry Last Submitted Status|
|JOBSCDE||2017-04-27 16.55.26||422||List Job Scheduler Entries|
|LASTUSED||2017-04-27 16.55.26||291||Program Last used Date/Time|
|LASTUSED2||2017-04-27 16.55.26||1||Program Last Used Date/Time -- iQuery OBJ_LIST|
|LIBL||2017-04-27 16.55.26||452||Current Job''s Library List|
|LICPGM||2017-04-27 16.55.26||316||Installed License Programs (a better view)|
|MCHINFO||2017-04-27 16.55.26||2||Machine Type,Model,Proc Group,Feature Code,Serial|
|MSGW||2017-04-27 16.55.26||269||List Jobs in MSGW (Message Wait) Status|
|OBJLIST||2017-04-27 16.55.26||4934||Object list using IBM's Object Statistics UDTF|
|OBJSTRUCT||2017-04-27 16.55.26||353||Exploded Object List (*MODULE and *SRVPGM list)|
|PTFBKPLVL||2017-04-27 16.55.26||420||Back-level Group PTFs|
|PTFGRP||2017-04-27 16.55.26||443||PTF Group Levels|
|SPCVAL||2017-04-27 16.55.26||459||Special Values Query|
|SYS||2017-04-27 16.55.25||347||System Information|
|SYSVAL||2017-04-27 16.55.26||443||System Values Listing|
|TCPIP||2017-04-27 16.55.25||447||TCP/IP Info|
|TOPHOGS||2017-04-27 16.55.26||428||Top Storage Hogs|
|TOPLIMITS||2017-04-27 16.55.26||334||Top 3 Consumption Points|
|USRGRP||2017-04-27 16.55.26||454||List User Profile Group Profiles|
|USRPRF||2017-04-27 16.55.26||466||List Non-IBM User Profiles|