DB2 Stored procedure called from COBOL CICS.

mallik vemugunta

DB2 Stored procedure called from COBOL CICS.
I am new to DB2 stored procedure , can you please help me how I can call from COBOL CICS application program.
We already have a DB2 stored procedure that is being called from Java application and we had a requirement to call the same procedure from COBOL program, here is CREATE procedure syntax.
 
CREATE PROCEDURE ABC ( OUT SQLSTATE_OUT char(5),
                                             IN A char(4),
                                             IN B decimal(8,0),
                                             IN C char(3),
                                             IN D char(5),
                                             IN E char(3),
                                             IN F char(8) )
When I call using the below I am getting compilation error on SQLSTATE as undefined host variable where I defined SQLSTATE AS
 
EXEC SQL BEGIN DECLARE SECTION END-EXEC.           
    01 SQLSTATE PIC X(5).                          
EXEC SQL END DECLARE SECTION END-EXEC.    

EXEC SQL CALL ABC(:SQLSTATE,         
                                :A,            
                                :B,    
                                :C,        
                                :D,        
                                :E,        
                                :F)       
END-EXEC.         
                    
Thanks,
Mallikarjun.   




_____________________________________________________________________

* IDUG North America * Tampa, Florida, * May 10-14 2010 * http://IDUG.ORG/NA *
_____________________________________________________________________

http://www.idug.org/rug/index.html - with almost 150 IDUG Regional User Groups,
there is probably one near you!
Regional User Groups are your local connection to the Worldwide DB2 User Community
_____________________________________________________________________

If you need to change settings, http://www.idug.org/cgi-bin/wa?A0=DB2-L is the home of IDUG's DB2-L

James Campbell

Re: DB2 Stored procedure called from COBOL CICS.
(in response to mallik vemugunta)
http://publibz.boulder.ibm.com/cgi-
bin/bookmgr_OS390/BOOKS/dsnapj15/2.4.3.3?ACTION=MATCHES&REQUEST=and+do+n
ot+use+host+variable+names+that+begin&TYPE=EXACTW&SHELF=DSNSHJA8&DT=2008
0201235049&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=
&ScrollTOP=FIRSTHIT#FIRSTHIT

Sometimes you might be lucky. But when you're not you have to fix your code.

James Campbell


On 29 Dec 2009 at 8:05, mallik vemugunta wrote:

>
> I am new to DB2 stored procedure , can you please help me how I can call from COBOL CICS
> application program.
> We already have a DB2 stored procedure that is being called from Java application and we had a
> requirement to call the same procedure from COBOL program, here is CREATE procedure
> syntax.
>
> CREATE PROCEDURE ABC ( OUT SQLSTATE_OUT char(5),
> IN A char(4),
> IN B decimal(8,0),
> IN C char(3),
> IN D char(5),
> IN E char(3),
> IN F char(8) )
> When I call using the below I am getting compilation error on SQLSTATE as undefined host
> variable where I defined SQLSTATE AS
>
> EXEC SQL BEGIN DECLARE SECTION END-EXEC.
> 01 SQLSTATE PIC X(5).
> EXEC SQL END DECLARE SECTION END-EXEC.
>
> EXEC SQL CALL ABC(:SQLSTATE,
> :A,
> :B,
> :C,
> :D,
> :E,
> :F)
> END-EXEC.
>
> Thanks,
> Mallikarjun.
>
>
>
>
> IDUG - The Worldwide DB2 User Community!
> The IDUG DB2-L Listserv is only part of your membership in IDUG. If you are not already an
> IDUG member, please register here.



_____________________________________________________________________

* IDUG North America * Tampa, Florida, * May 10-14 2010 * http://IDUG.ORG/NA *
_____________________________________________________________________

http://www.IDUG.org membership is now free.
Do you have people in your office who are not an IDUG member?
Show them how to access the information and help train the next generation of DB2 Users!
_____________________________________________________________________

If you need to change settings, http://www.idug.org/cgi-bin/wa?A0=DB2-L is the home of IDUG's DB2-L