If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Stored procedure OUT parameters from CLP

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-10-11, 09:34
PhilHibbs PhilHibbs is offline
Registered User
 
Join Date: Nov 2011
Posts: 5
Stored procedure OUT parameters from CLP

I'm trying to use the CLP on Z/OS Linux to call a stored procedure that has some IN and some OUT parameters. Do I need to declare variables to hold the OUT values? How do I do that in the CLP?
Reply With Quote
  #2 (permalink)  
Old 11-10-11, 09:41
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
I am not sure on Z/OS, but on LUW you just use a ? for the out parameters in CLP.

Andy
Reply With Quote
  #3 (permalink)  
Old 11-10-11, 09:54
PhilHibbs PhilHibbs is offline
Registered User
 
Join Date: Nov 2011
Posts: 5
What does that do? Does it discard the output? Does it write it to stdout?
Reply With Quote
  #4 (permalink)  
Old 11-10-11, 09:55
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
The CLP writes all the out parameters to stdout.

Andy
Reply With Quote
  #5 (permalink)  
Old 11-10-11, 09:55
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
What do you mean exactly by "CLP". Please be very specific.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #6 (permalink)  
Old 11-10-11, 10:08
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
For me, it means the DB2 Command Line Processor.

Andy
Reply With Quote
  #7 (permalink)  
Old 11-10-11, 10:24
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
Quote:
Originally Posted by ARWinner View Post
For me, it means the DB2 Command Line Processor.

Andy
Sorry, I thought he was referring to z/OS, but I guess he means z/Linux, so should be the same as CLP in LUW.

No need to declare variables or ref cursors from the command line (outside of the SP) like is required in Oracle.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #8 (permalink)  
Old 11-10-11, 10:48
PhilHibbs PhilHibbs is offline
Registered User
 
Join Date: Nov 2011
Posts: 5
Quote:
Originally Posted by Marcus_A View Post
Sorry, I thought he was referring to z/OS, but I guess he means z/Linux, so should be the same as CLP in LUW.

No need to declare variables or ref cursors from the command line (outside of the SP) like is required in Oracle.
Yes, Z/Linux, with the IBM Command Line Processor for DB2 Client 9.7.0

Thanks for the answer, I will try passing ? and checlking stdout (when I get permissions granted to actually call the stored proc, that is...)
Reply With Quote
  #9 (permalink)  
Old 11-11-11, 06:31
PhilHibbs PhilHibbs is offline
Registered User
 
Join Date: Nov 2011
Posts: 5
OK I can now call the stored procedure, and as long as there are no records to update, it works. If there is work for it to do, though, it returns this output:
Code:
PSQLCODE: -303
PSQLSTATE: 42806
PSQLERRMC: A VALUE CANNOT BE ASSIGNED TO OUTPUT HOST VARIABLE NUMBER 18 BECAUSE THE DATA TYPES ARE NOT COMPARABLE
So, at least the passing back of the PSQLCODE, PSQLSTATE and PSQLERRMC is working.

The developer of the stored proc says that I need to pass 0 instead of ? in the 7th parameter. If I do that, though, I get this error:
Code:
DB21105E  Parameter 7 for stored procedure "DA03.EROL_CLOSURE" should be an
OUTPUT parameter.
Any ideas? I don't have the source to the stored proc at the moment, I will try and get it.
Reply With Quote
  #10 (permalink)  
Old 11-11-11, 07:59
PhilHibbs PhilHibbs is offline
Registered User
 
Join Date: Nov 2011
Posts: 5
It's working now - the error message in the previous post is simply a bug within the stored procedure, which is nothing to do with the rest of this thread. Thanks all for patience and assistance.
Reply With Quote
Reply

Tags
clp, db2, stored procedure

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On