Page 1 of 1

How to execute a command on DB2 Command Line from DS

Posted: Wed Oct 24, 2007 11:49 am
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?

Did you ever solve this

Posted: Mon Feb 25, 2008 5:46 am
by Rajb
Hi

I have a very similar problem but with Oracle did you ever solve this probem any help would be serously appreciated

Posted: Mon Feb 25, 2008 8:21 am
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.