Support email

Contact Us

SQL iQuery Logo

SQL iQuery

Macro Support

Normally, to run an SQL statement, you specify it on the SQL parameter of the RUNIQRY command as follows:


You can also save the SQL statement in a source member and recall it later, using the following syntax:


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:


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:


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.

MemberLast ModifiedViewsText
ACTJOB2018-02-18 14.06.10695List Active Jobs
ALLUSR2018-02-18 14.06.10625List User Profiles
DB2PTF2018-02-18 14.06.10636DB2 Group PTF Level
DEMO2018-02-18 14.06.1074SQL iQuery simple demo using QIWS.QCUSTCDT
DFTPWD2018-02-18 14.06.10529Check for Users Potentially with Default Password
DMGOBJ2018-02-18 14.06.10480Damaged Objects Report
DSK2018-02-18 14.06.10604Disk Unit Report
DSPJRN2018-02-18 14.06.10338Display Journal
GRPPRF2018-02-18 14.06.10608Group Profile Membership list
HIST2018-02-18 14.06.1067IBM History Log
IBMBLOG2018-02-18 14.06.10674IBM Db2 for i Blog Article Links
INTERACT2018-02-18 14.06.10428All Interactive Jobs
JOBATTR2018-02-18 14.06.10213Job Attributes
JOBLOG2018-02-18 14.06.102629Joblog table Function QSYS2.JOBLOG_INFO(...)
JOBSCD2018-02-18 14.06.10614Check Job Scheduler Entry Last Submitted Status
JOBSCDE2018-02-18 14.06.10589List Job Scheduler Entries
KEYFLD2018-02-18 14.06.10125Key Fields List SETVAR((FILE MYFILE) (LIB MYLIB))
LASTUSED2018-02-18 14.06.10456Program Last Used Date/Time -- iQuery OBJ_LIST
LIBL2018-02-18 14.06.10611Current Job''s Library List
LICPGM2018-02-18 14.06.10472Installed License Programs (a better view)
LOG2018-02-18 14.06.1073SQL iQuery Log File query SETVAR((USER xxxxx))
MBRLIST2018-02-18 14.06.10216MBRL SETVAR((LIB ll) (FILE ff) (MBR mm) (TEXT tt))
MCHINFO2018-02-18 14.06.10154Machine Type,Model,Proc Group,Feature Code,Serial
MSGW2018-02-18 14.06.10546List Jobs in MSGW (Message Wait) Status
OBJLIST2018-02-18 14.06.106525Object list using IBM's Object Statistics UDTF
OBJSTRUCT2018-02-18 14.06.10507Exploded Object List (*MODULE and *SRVPGM list)
PTFBKPLVL2018-02-18 14.06.10558Back-level Group PTFs
PTFGRP2018-02-18 14.06.10595PTF Group Levels
SPCVAL2018-02-18 14.06.10629Special Values Query
SYS2018-02-18 14.06.10510System Information
SYSVAL2018-02-18 14.06.10570System Values Listing
TCPIP2018-02-18 14.06.10602TCP/IP Info
TOPHOGS2018-02-18 14.06.10593Top Storage Hogs
TOPLIMITS2018-02-18 14.06.10484Top 3 Consumption Points
USERS2018-02-18 14.06.1013List Non-IBM User Profiles
USRGRP2018-02-18 14.06.10599List User Profile Group Profiles
USRPRF2018-02-18 14.06.10596List Non-IBM User Profiles

Copyright © 2015 Cozzi Productions, Inc. All Rights Reserved.