How to execute a command on DB2 Command Line from DS

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
basiltarun
Premium Member
Premium Member
Posts: 15
Joined: Tue Sep 09, 2003 10:41 pm

How to execute a command on DB2 Command Line from DS

Post by basiltarun »

I have a command that I can run through iSeries on the command line that in turn executes a compiled command object (like a program) on the DB2 AS400. Text I type in iSeries is:
"Call MYLIBNAME/MYProgName".

I need to execute this command from DS8. I am trying to figure out a way to do this since the command stage in DS8 is only going to execute command line code on the UNIX machine.

I have ODBC connections to the DB2 AS400 and am able to select and insert data from the DB2 database. But I am not sure how to execute a command line code on the AS400 thru DS8.

I have tried to create a Stored Procedure on the AS400 (although I am not sure if it is correct and have no way of testing it). I created it with the code:
CREATE PROCEDURE MYLIBNAME/MYStProcName
(INOUT RETURN CHAR(1))
EXTERNAL NAME MYLIBNAME/MYProgName LANGUAGE CL
PARAMETER STYLE GENERAL
NOT VARIANT

I was able to import the Stored Procedure metadata in DS8 and put in the the Stored Procedure Stage. When I run I get the error:

"Fatal Error: StProcStage,0: Operator terminated abnormally: received signal SIGSEGV

Fatal Error: main_program: APT_PMsectionLeader(1, node1), player 2 - Unexpected exit status 1.
APT_PMsectionLeader(2, node2), player 2 - Unexpected exit status 1.
"

The Call Statement in the St Proc Stage is:
CALL MYLIBNAME.MYStProcName(?);

Have also tried it with: CALL MYLIBNAME/MYStProcName(?);

The Input/Ouput Parameter name is "Return" which is mapped to the Output column of DUMMY.

I am not familiar with creating Stored Procedures in DB2 and how it is done. Can someone let me know if this is wrong or what am I missing. Any other suggestions are welcome to execute this task. Can I use a routine to connect to the DB2 with the ODBC, but then how will I execute a statement in the command line of the AS400?
Rajb
Premium Member
Premium Member
Posts: 11
Joined: Tue Jan 15, 2008 6:07 am
Location: UK

Did you ever solve this

Post by Rajb »

Hi

I have a very similar problem but with Oracle did you ever solve this probem any help would be serously appreciated
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Start your own post. Explain in detail what your Oracle issue is rather than saying it is 'very similar' to a DB2 problem as that doesn't really tell us much of anything. Then people would stand a chance of actually helping.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply