IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DB2 Stored Procedures Input Parameters


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rahuindo

New User


Joined: 09 Apr 2008
Posts: 83
Location: Chennai

PostPosted: Tue May 12, 2009 6:22 pm
Reply with quote

Hi,
We are writing DB2 Stored Procedures for the 1st time. The system in which the DB2 Stored Procedures are written will be in COBOL and the calling system is a .Net system and further it is an external application to my application.
Now my question is:
1. What all parameters do i need to fetch as input for my Stored Proc.
For e.g if i want information for Employee ID, then will Employee ID be the only input to the Stored Proc or there will be other parameters as well?
2. I know that we just have to declare and open the Stored Proc and not do a fetch on the Cursor. Now if i face some error in the Open of the SQL Statement, then will my SQL Error Message length be the same as in normal SQL Error Codes i.e SQLCA?
3. How do i display the Error Messages encountered? Through the normal "DISPLAY" statement of COBOL or is there something else?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue May 12, 2009 6:28 pm
Reply with quote

DB2 for z/OS Stored Procedures: Through the CALL and Beyond
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri May 15, 2009 4:09 am
Reply with quote

In addition, there are examples at the REDBOOKs site for stored procedures,
in COBOL, C, REXX, SQL Procedure Language, DDL, JCL,
the url for the additional material for z/OS Stored Procedures is
www.redbooks.ibm.com/redbooks/SG247083
Back to top
View user's profile Send private message
rahuindo

New User


Joined: 09 Apr 2008
Posts: 83
Location: Chennai

PostPosted: Fri May 15, 2009 9:23 am
Reply with quote

Hi Dino,
I am unable to open the FTP link. Meanwhile i am going through the whole PDF document.
Thanks!!!
Back to top
View user's profile Send private message
rahuindo

New User


Joined: 09 Apr 2008
Posts: 83
Location: Chennai

PostPosted: Fri May 15, 2009 10:54 am
Reply with quote

Hi,
I went through the document -Through the Call and Beyond.
It was quite informative.
But i am still unable to find the answer to one of my question:
"If i am declaring my Stored Procedures in Cobol, then do the calling program which is in .Net have the same parameters definition as in the COBOL Stored Proc? If yes, then how do we pass the packed decimal variables?"
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri May 15, 2009 12:58 pm
Reply with quote

Suggest yuo go through some already available DB2 Store Proc at your shop-- not necessarily the one one which belongs to your team.
Quote:
1. What all parameters do i need to fetch as input for my Stored Proc. For e.g if i want information for Employee ID, then will Employee ID be the only input to the Stored Proc or there will be other parameters as well?
This depends on your application requirement-- no way I can tell from here what is needed and what is not, probabley no one can.
Quote:
I know that we just have to declare and open the Stored Proc
icon_confused.gif, You don't do that, unless I misunderstood.
Quote:
do a fetch on the Cursor.
Yes the only and probably the best way-- you have to have cursors.
Quote:
Now if i face some error in the Open of the SQL Statement, then will my SQL Error Message length be the same as in normal SQL Error Codes i.e SQLCA?
Don't worry about this-- you are still using SQL, same rules will be applied.
Quote:
3. How do i display the Error Messages encountered? Through the normal "DISPLAY" statement of COBOL or is there something else?
ah..this is site specific question, though I'll try to put up a general interpretaion-- Error messages if they are related to front end such as, in your case, entered Employee ID is wrong-- this should be reflected on Front-end screen, there is no meaning of showing this error only in the SYSOUT. And this "error-message" become the "output from SP".

If there is some other error, say some SQL code -904 comes and you pop-up this mesage"SQL code -904" on front end screen-- this will give a technically correct but a vague information to the "user"-- better you display this SQL code in SYSOUT and on front end throw some "manager understandable ( icon_wink.gif ) message, such as "Execution is not successful because the call to database was not complted. Get in touch with “some” support."

Hope this helps . . .
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts force tablespace using LISTDEF input DB2 1
No new posts Two input files & writing counter... DFSORT/ICETOOL 12
No new posts Use input file with OMIT rcd keys? DFSORT/ICETOOL 15
Search our Forums:

Back to Top