DB2-12 (Z/OS) - Create Alias for Stored Procedure

344 Views Asked by At

it's possible to define an alias for a stored procedure (sql-native)? In the documentation, reference is made only to: SEQUENCE and TABLES

1) CREATE PROCEDURE OWXXCOLL.STORED1()
2) CREATE ALIAS DB2C.STORED1 FOR OWXXCOLL.STORED1;
3) CALL DB2C.STORED1();

EDIT 2021-05-14

The original question arises for the following problem (I was hoping to get away with using aliases)

Intro

  1. I have defined a native SP The OWXXCOLL schema is the same one I also use for tables/index... (I noticed that the tables also have different aliases)
    CREATE PROCEDURE OWXXCOLL.STORED1(...)
        LANGUAGE SQL
        ISOLATION LEVEL CS
        WLM ENVIRONMENT FOR DEBUG MODE WLMENV1
        ALLOW DEBUG MODE
    BEGIN 
       ...
    END@
  1. I also modified the cobol program (name:PGMSTO1) to call the Stored with the CALL statement (without qualifier)
    EXEC SQL                                        
        CALL STORED1 (...)             
    END-EXEC.                                       

The problem

The various table accesses (SELECT) work correctly BUT When I run the PGMSTO1 the call to the Stored ends with sqlcode -440

NO AUTHORIZED PROCEDURE BY THE NAME STORED1 HAVING COMPATIBLE ARGUMENTS WAS FOUND<

The error comes from the fact that it is not using the owner OWXXCOLL but DB2C (DB2C is user who scheduled the jcl/batch)

If I enter the qualifier (OWXXCOLL) the call it's OK.

I don't understand what to check and what configurations are missing.

Thanks

1

There are 1 best solutions below

0
On

The cobol program (PGMSTO1) that calls the stored procedure has the following BIND parameters:

COLLID     NAME    OWNER CREATOR QUALIFIER DYNAMICRULES    PATHSCHEMAS
OWXXCOLL   PGMSTO1 DB2C  DB2C    FPXX       B               "DB2C"

"DB2C" path is used to resolve unqualified stored procedure

I will need to modify the bind parameter "PATH". I will try to ask to add my schema as well (OWXXCOLL)

PATH("OWXXCOLL","DB2C")