IBM Support

RUNSQL Command

Troubleshooting


Problem

This document contains information on the IBM i  RUNSQL command.
You may have just upgraded to a newer IBM i release (or Database Group PTF) and now  your RUNSQL or RUNSQLSTM isn't working as it did before the upgrade
For example you are may be seeing a MCH0801 in your joblog

Symptom

In IBM i V6R1 and IBM i V7R1, IBM Development created an official command for RUNSQL.
Unfortunately some customers had already created their own command named RUNSQL - so sometimes there are conflicts

Environment

All IBM i releases IBM i 6.1 and higher

Resolving The Problem

IBM i introduced a new command mid-release of R610 and R710 called RUNSQL. Like other IBM i commands, RUNSQL will reside in QSYS. This command is very similar to the RUNSQLSTM command; however, it has one key difference. It does not require the existence of a source physical file or IFS stream file to contain the SQL statement text string.

If you have your own version of a command named RUNSQL and that command is called without library qualification (in other words, RUNSQL instead of <library-name>/RUNSQL), the new QSYS/RUNSQL command will be the command called. Because QSYS is typically the first library in the system library list, the simple application of the DB2 PTF Group could cause unexpected results where unqualified library calls are made to commands which share the name RUNSQL.

The PTFs which introduce the change are as follows:

R610
APAR SE51168 PTF SI46208 and is included in group PTF SF99601 level 25.

R710
APAR SE51276 PTF SI46219 and is included in group PTF SF99701 level 14.

To determine whether RUNSQL commands exist on a machine, you should use WRKCMD CMD(*ALL/RUNSQL).

To overcome the command conflict problem, you should consider the following options:
1. Change applications to library qualify use of non-QSYS RUNSQL commands.
2. Rename the IBM-supplied RUNSQL command to RUNSQLIBM.
Example: RNMOBJ OBJ(QSYS/RUNSQL) OBJTYPE(*CMD) NEWOBJ(RUNSQLIBM)

Note: This option should be considered as a short-term fix, since future PTFs and OS upgrades will fix the name back to the IBM verison.
3. Use a proxy command to allow the existing non-QSYS RUNSQL command to be found ahead of QSYS/RUNSQL:

CRTLIB LIB(MYQSYS)
CRTPRXCMD CMD(MYQSYS/RUNSQL) TGTCMD(XXXLIB/RUNSQL)
CHGSYSAL SYSVAL(QSYSLIBL) VALUE('MYQSYS QSYS QSYS2 QHLPSYS QUSRSYS')
4. Change the non-QSYS/RUNSQL command name to RUNSQLOLD or some other name of your choosing, and modify existing applications to use the new command name.
5. Change the position of the RUNSQL library so it is above QSYS in the system library list.

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000001iIgAAI","label":"IBM i Db2-\u003ERUNSQL, RUNSQLSTM, STRSQL"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]

Historical Number

635368574

Document Information

More support for:
IBM i

Component:
IBM i Db2->RUNSQL, RUNSQLSTM, STRSQL

Software version:
All Versions

Operating system(s):
IBM i

Document number:
684429

Modified date:
04 December 2024

UID

nas8N1010961

Manage My Notification Subscriptions