
SQL iQuery™
Macro Support
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 QSQLMACRO 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:
RUNIQRY *USRPRF
This statement runs the SQL statement stored in the source member named USRPRF in the source file named QIQMACRO 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 QSQLMACRO in a library on the library list.
For example, if the source member named SAMPLE is created in source file QSQLMACRO and contains: SELECT * FROM QIWS/QCUSTCDT; then following RUNIQRY command could be used to run that SQL statement as follows:
RUNIQRY *SAMPLE
When RUNIQRY is run, it first checks for the macro name as a member in QSQLMACRO 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 as well as providing information on your system, but most are for daily use.
Click the Macro name to view the SQL iQuery statement behind the 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.
Member | Last Modified | Views | Text |
ACTJOB | 2018-04-24 14.28.25 | 772 | List Active Jobs |
ALLUSR | 2018-04-24 14.28.25 | 702 | List User Profiles |
CACHE | 2018-04-24 14.28.25 | 1 | Display the Cache Batteries status |
CACHEBAT | 2018-04-24 14.28.25 | 1 | Display the Cache Batteries status |
DB2PTF | 2018-04-24 14.28.25 | 723 | DB2 Group PTF Level |
DEMO | 2018-04-24 14.28.25 | 161 | SQL iQuery simple demo using QIWS.QCUSTCDT |
DFTPWD | 2018-04-24 14.28.25 | 633 | Check for Users Potentially with Default Password |
DMGOBJ | 2018-04-24 14.28.25 | 562 | Damaged Objects Report |
DSK | 2018-04-24 14.28.25 | 685 | Disk Unit Report |
DSPJRN | 2018-04-24 14.28.25 | 434 | Display Journal |
GRPPRF | 2018-04-24 14.28.25 | 678 | Group Profile Membership list |
HIST | 2018-04-24 14.28.25 | 161 | IBM History Log |
IBMBLOG | 2018-04-24 14.28.25 | 814 | IBM Db2 for i Blog Article Links |
INTERACT | 2018-04-24 14.28.25 | 502 | All Interactive Jobs |
IQVER | 2018-04-24 14.28.25 | 1 | SQL Macro to display the current SQL iQuery Versio |
IQVRM | 2018-04-24 14.28.25 | 1 | SQL Macro to display the current SQL iQuery Versio |
JOBATTR | 2018-04-24 14.28.25 | 307 | Job Attributes |
JOBLOG | 2018-04-24 14.28.25 | 2848 | Joblog table Function QSYS2.JOBLOG_INFO(...) |
JOBSCD | 2018-04-24 14.28.25 | 688 | Check Job Scheduler Entry Last Submitted Status |
JOBSCDE | 2018-04-24 14.28.25 | 686 | List Job Scheduler Entries |
JRNDBF | 2018-04-24 14.28.25 | 33 | List User *FILE's being Journalled (long running) |
KEYFLD | 2018-04-24 14.28.25 | 210 | Key Fields List SETVAR((FILE MYFILE) (LIB MYLIB)) |
LASTUSED | 2018-04-24 14.28.25 | 547 | Program Last Used Date/Time -- iQuery OBJ_LIST |
LIBL | 2018-04-24 14.28.25 | 684 | Current Job''s Library List |
LICPGM | 2018-04-24 14.28.25 | 540 | Installed License Programs (a better view) |
LOG | 2018-04-24 14.28.25 | 150 | SQL iQuery Log File query SETVAR((USER xxxxx)) |
MBRLIST | 2018-04-24 14.28.25 | 378 | MBRL SETVAR((LIB ll) (FILE ff) (MBR mm) (TEXT tt)) |
MCHINFO | 2018-04-24 14.28.25 | 222 | Machine Type,Model,Proc Group,Feature Code,Serial |
MSGW | 2018-04-24 14.28.25 | 705 | List Jobs in MSGW (Message Wait) Status |
OBJLIST | 2018-04-24 14.28.25 | 7078 | Object list using IBM's Object Statistics UDTF |
OBJSTRUCT | 2018-04-24 14.28.25 | 573 | Exploded Object List (*MODULE and *SRVPGM list) |
PTFBKPLVL | 2018-04-24 14.28.25 | 626 | Back-level Group PTFs |
PTFGRP | 2018-04-24 14.28.25 | 668 | PTF Group Levels |
SPCVAL | 2018-04-24 14.28.25 | 714 | Special Values Query |
SYS | 2018-04-24 14.28.25 | 591 | System Information |
SYSVAL | 2018-04-24 14.28.25 | 639 | System Values Listing |
TCPIP | 2018-04-24 14.28.25 | 685 | TCP/IP Info |
TOPHOGS | 2018-04-24 14.28.25 | 671 | Top Storage Hogs |
TOPLIMITS | 2018-04-24 14.28.25 | 567 | Top 3 Consumption Points |
USERS | 2018-04-24 14.28.25 | 82 | List Non-IBM User Profiles |
USRGRP | 2018-04-24 14.28.25 | 669 | List User Profile Group Profiles |
USRPRF | 2018-04-24 14.28.25 | 661 | List Non-IBM User Profiles |