I want to Capture the Result set returned by a stored procedure in another stored procedure.

The Scenario is ::

Stored proc SP1 calls the stored proc SP2.
SP2 is an existing stored proc and SP1 is a new one.
SP2 returns a result set. I need to capture that result set in SP1.

****Hence to achieve this I am using LOCATORS
But while execution its failing because of some communication error.

Its giving SQLSTATE :08001 and SQLCODE : -30081

The IBM DB2 Stored proc builder returns this error message after execution :

"[IBM][CLI Driver][DB2] SQL30081N A communication error has been detected. Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS". Location where the error was detected: "8.251.49.141". Communication function detecting the error: "recv". Protocol specific error code(s): "*", "*", "0". SQLSTATE=08001"


In the mainframe side in DB2DWLM ,the sysout gives the following :

************************************************** ***************************************
"CEE3250C The system or user abend S04E R=00E7000C was issued.
From compile unit HEGETEML at entry point HEGETEML at statement 937 at
<> LEAID ENTERED (LEVEL 09/02/1999 AT 08.41)
<> LEAID ABENDAID DD ALLOCATED BY CWBMAKDD DYNALLOC RC =00000 "
************************************************** ********************************************
Statement 937 refers to the line below ::

000931 025600***** EXEC SQL
000932 025700***** ASSOCIATE RESULT SET LOCATORS (:EMLVAR)
000933 025800***** WITH PROCEDURE IUGETEML
000934 025900***** END-EXEC.
000935 MOVE 'IUGETEML' TO DSNPNM.
000936 PERFORM SQL-INITIAL UNTIL SQL-INIT-DONE
000937 CALL 'DSNHLI' USING SQL-PLIST4.


Any pointers to this will be of great help.

Thanks and Regards
Suniti