IBM Support

How to access an alias in a distributed environment

Question & Answer


Question

My SPUFI plans and packages are bound with DRDA® protocol. I can use SPUFI to access a remote table, but I receive SQLCODE204 when I use SPUFI to access an alias.

Cause

My SPUFI plans and packages are bound with DRDA® protocol. I can use SPUFI to access a remote table, but I receive SQLCODE204 when I use SPUFI to access an alias.

For example, when I submit the following query:
SELECT * FROM ACONTST.PS_WD_MISC_PYMTS_A;

I receive the following error message:
DSNT408I SQLCODE = -204, ERROR: ACONTST.PS_WD_MISC_PYMTS_A IS AN UNDEFINED NAME

This query works in QMF™ and other interactive SQL software.

Answer

When you issue a SELECT statement with SPUFI using DRDA, the alias needs to be defined on both subsystems. DB2 does a connect and passes the SELECT statement to the server to execute.

The V6 Release Planning Guide has the following discussion under 5.2.5 Moving from DB2 private protocol access to DRDA access:

      "4. Ensure that aliases resolve correctly.

      For DB2 private protocol access, DB2 resolves aliases at the requesting location. For DRDA access, however, DB2 resolves aliases at the location where the package executes. Therefore, you might need to define aliases for three-part names at remote locations.

      For example, suppose you use DRDA access to run a program that contains this statement:

      SELECT * FROM MYALIAS;

      Assume MYALIAS is an alias for LOC2.MYID.MYTABLE. DB2 resolves MYALIAS at the local location to determine that this statement needs to run at LOC2. DB2 does not send the resolved name to LOC2. When the statement executes at LOC2, DB2 resolves MYALIAS using the catalog at LOC2. If the catalog does not contain the alias MYID.MYTABLE for MYALIAS, the SELECT statement does not execute successfully.

      This situation can become more complicated if you use three-part names to access DB2 objects from remote locations. For example, suppose you are connected explicitly to LOC2, and you use DRDA access to execute this statement:

      SELECT * FROM YRALIAS;

      where YRALIAS is an alias for LOC3.MYID.MYTABLE. When this SELECT statement executes at LOC3, both LOC2 and LOC3 must have an alias YRALIAS that resolves to MYID.MYTABLE at LOC3. "

[{"Product":{"code":"SSEPEK","label":"Db2 for z\/OS"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Not Applicable","Platform":[{"code":"PF035","label":"z\/OS"}],"Version":"7.0;8.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
16 June 2018

UID

swg21141626