Support email

Contact Us


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 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.

MemberLast ModifiedViewsText
ACTJOB2017-03-21 16.47.29491List Active Jobs
ALLUSR2017-03-21 16.47.29433List User Profiles
DB2PTF2017-03-21 16.47.29433DB2 Group PTF Level
DFTPWD2017-03-21 16.47.29323Check for Users Potentially with Default Password
DMGOBJ2017-03-21 16.47.29285Damaged Objects Report
DSK2017-03-21 16.47.29426Disk Unit Report
DSPJRN2017-03-21 16.47.29142Display Journal
GRPPRF2017-03-21 16.47.29424Group Profile Membership list
IBMBLOG2017-03-21 16.47.29421IBM Db2 for i Blog Article Links
INTERACT2017-03-21 16.47.29249All Interactive Jobs
JOBATTR2017-03-21 16.47.2933Job Attributes
JOBLOG2017-03-21 16.47.291941Joblog table Function QSYS2.JOBLOG_INFO(...)
JOBSCD2017-03-21 16.47.29433Check Job Scheduler Entry Last Submitted Status
JOBSCDE2017-03-21 16.47.29407List Job Scheduler Entries
LASTUSED2017-03-21 16.47.29273Program Last used Date/Time
LIBL2017-03-21 16.47.29434Current Job''s Library List
LICPGM2017-03-21 16.47.29297Installed License Programs (a better view)
MCHTYPE2017-03-21 16.47.29134Machine Type,Model,Proc Group,Feature Code,Serial
MSGW2017-03-21 16.47.29251List Jobs in MSGW (Message Wait) Status
OBJLIST2017-03-21 16.47.294768Object list using IBM's Object Statistics UDTF
OBJSTRUCT2017-03-21 16.47.29333Exploded Object List (*MODULE and *SRVPGM list)
PTFBKPLVL2017-03-21 16.47.29405Back-level Group PTFs
PTFGRP2017-03-21 16.47.29430PTF Group Levels
SPCVAL2017-03-21 16.47.29440Special Values Query
SYS2017-03-21 16.47.29323System Information
SYSVAL2017-03-21 16.47.29428System Values Listing
TCPIP2017-03-21 16.47.29430TCP/IP Info
TOPHOGS2017-03-21 16.47.29410Top Storage Hogs
TOPLIMITS2017-03-21 16.47.29317Top 3 Consumption Points
USRGRP2017-03-21 16.47.29434List User Profile Group Profiles
USRPRF2017-03-21 16.47.29447List Non-IBM User Profiles

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