Stored Procedure Stage in 7.5 (for DB2)

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
banactp
Participant
Posts: 52
Joined: Tue Feb 22, 2005 2:55 pm

Stored Procedure Stage in 7.5 (for DB2)

Post by banactp »

I am trying to use the new Stored Procedure stage (NOT an ODBC stage) to call a DB2 stored procedure. This procedure accepts a single input and returns a cursor to a result set. The result set contains a number of numeric and character fields.

My question centers around how to map the result set to an output link. The stage documentation indicates that a CursorOutput parameter should be used "when the stored procedure returns a record or a result set." However, the parameter entry tab insists that every parameter be mapped to a column, presumably to one on the output link in this case.

The columns on my output link are defined as the several fields in the result set (shown at the bottom of this post.) As far as I can tell, there is no way to declare a "result set" type output column and there is no "result set stage" that I can pipe the result to. Attempts to map the cursor to one or several output columns result in a segmentation violation.

Hopefully, someone has some experience with this new stage type and has gotten it to work before. How should I set up the parameter list, parameter mapping and output links and columns in order to get this stored procedure stage to work properly?

For reference, I have included the stored procedure code below. Thank you for your assistance.

Code: Select all

CREATE PROCEDURE GITDBA.SELCAT (IN TABLENAME VARCHAR(30) ) 
    RESULT SETS 1                                           
    LANGUAGE SQL                                           
    COLLID D4R                                             
    WLM ENVIRONMENT SDD40H1                                 
    RUN OPTIONS 'NOTEST(NONE,*,*,*)'                       
------------------------------------------------------------
-- SQL Stored Procedure                                     
------------------------------------------------------------
P1: BEGIN                                                   
    DECLARE  FIELD  VARCHAR(10);                           
    DECLARE CURSOR1 CURSOR WITH RETURN FOR                 
    SELECT  TBCREATOR, TBNAME,  NAME, COLNO, COLTYPE, LENGTH
       FROM SYSIBM.SYSCOLUMNS                               
        WHERE TBNAME = TABLENAME                                                           
            AND TBCREATOR = 'INV'                           
        ORDER BY COLNO;                                     
    OPEN CURSOR1;                                           
END P1                                                     

Column definitions:
TBCREATOR            CHAR(8)
TBNAME               VARCHAR(18)
NAME                 VARCHAR(18)
COLNO                SMALLINT
COLTYPE              CHAR(8)
LENGTH               SMALLINT
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
this was covered before.
check the docs inthe install disk (client side is good)
I belive only future releases will support none Oracle DBs.

Contact your support for more details.

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
banactp
Participant
Posts: 52
Joined: Tue Feb 22, 2005 2:55 pm

Post by banactp »

This particular problem arose because the DB2 stored procedure in question had both input parameters and an output cursor.

Ascential has provided me with a solution in the form of a patch for version 7.5.1. Refer to ECASE G73450 on the Ascential support site for more details.

tpb
Post Reply