Db2 SQLCODE

SQLCODE -471: Routine invocation failed

SQLCODE -471 (SQLSTATE 55023) means Db2 couldn't run a stored procedure or user-defined function, and the reason code in the message says why. The common ones, 00E79002 and 00E7900C, point to the routine being stopped or to its WLM application environment.

Other names for this code

Also written as SQL -471, SQLCODE=-471, SQLCODE = -471, db2 -471, sqlstate 55023, SQL0471N, db2 -471 00E79002, db2 -471 00E7900C, SQL0471, sqlcode -471 wlm.

What it means

Db2 runs external routines, and some IBM-supplied ones, in address spaces managed by Workload Manager. Each routine names a WLM application environment, and WLM starts address spaces for it as work arrives. If Db2 can't get the routine scheduled, it fails the CALL or the function reference with -471. The message gives the routine name and a Db2 reason code. In SQLERRMC the two are separated by a semicolon, for example SYSIBM.SQLCOLUMNS;00E7900C.

Reason code 00E79002 means the routine couldn't be scheduled before the installation's time limit ran out. IBM gives three likely causes. A STOP PROCEDURE or STOP FUNCTION command is in effect, the caller's WLM priority is too low to get a TCB in time, or the application environment is quiesced.

Reason code 00E7900C means the WLM application environment named for the routine isn't defined in the active WLM policy, or isn't available to Db2.

Common causes

  • The application environment is quiesced or stopped. An operator may have quiesced it, or WLM stopped it after its address spaces failed to start, often because of a JCL error. Later calls then wait and can time out with 00E79002.
  • Someone stopped the routine with -STOP PROCEDURE or -STOP FUNCTION SPECIFIC and it was never started again.
  • The WLM ENVIRONMENT named in the routine's definition doesn't exist in the active WLM policy, giving 00E7900C. This is common after a new install or a copy of the catalog to another subsystem.
  • IBM-supplied routines were never set up. JDBC metadata calls such as SYSIBM.SQLCOLUMNS and SYSIBM.SQLTABLES, and SYSPROC.DSNWZP used by admin tools, all need a working WLM environment.
  • The work runs at a low WLM priority on a busy system and waits too long for an address space.

How to find the problem

  1. Read the reason code at the end of the message, or after the semicolon in SQLERRMC from a Java or ODBC client.
  2. Run -DISPLAY PROCEDURE(schema.name) or -DISPLAY FUNCTION SPECIFIC(schema.name) to see whether the routine is stopped and which environment it uses.
  3. Check the environment with D WLM,APPLENV=DB2PWLM1. It shows whether the environment is available, quiesced or stopped.
  4. Look in SYSLOG and the WLM address space's job log in SDSF for the failure that made WLM stop the environment.
  5. Check WLM_ENVIRONMENT in SYSIBM.SYSROUTINES against the application environments defined in the WLM policy. For the IBM routines, the install job DSNTIJMS shows which environment was set up.

How to fix it

  • Start a stopped routine with -START PROCEDURE(schema.name) or -START FUNCTION SPECIFIC(schema.name).
  • Fix the address space JCL if it failed, then resume the environment with V WLM,APPLENV=DB2PWLM1,RESUME.
  • For 00E7900C, define the application environment in the WLM policy and activate the policy, or point the routine at a valid one with ALTER PROCEDURE ... WLM ENVIRONMENT.
  • If priority is the cause, review the service class the calling work runs in.
  • For IBM tool APARs that call DSNWZP when they don't need to, apply the PTFs IBM lists for your tool.

What it looks like

DSNT408I SQLCODE = -471, ERROR:  INVOCATION OF FUNCTION OR PROCEDURE PAYSCHM.CALCTAX FAILED
         DUE TO REASON 00E7900C
DSNT418I SQLSTATE   = 55023 SQLSTATE RETURN CODE

IBM documentation

IBM documentation: -471. Use the documentation for your installed release.

Report a correction to WND Software.

Questions

What does reason 00E79002 mean?

Db2 couldn't schedule the routine before the installation's time limit expired. Check whether the routine is stopped, whether its WLM application environment is quiesced, and the priority of the calling work.

What does reason 00E7900C mean?

The WLM application environment named for the routine isn't defined, or isn't available, in the active WLM policy. Define it or change the routine's WLM ENVIRONMENT.

Why do Java tools hit -471 on SYSIBM.SQLCOLUMNS?

The JDBC driver gets table and column lists by calling IBM stored procedures on Db2 for z/OS. If their WLM environment isn't set up or is stopped, metadata calls fail with -471.