473,792 Members | 2,796 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DB2 Stored Procedures called from REXX

I'm having a problem invoking DB2 Stored Procedures from REXX. I've
written a generic SP tester where you enter the schema and name of the
SP. The next panel displays the parms for the SP and allows you to
fill in the ones you need to and then invokes the SP.

I'm having two problems in particular that relate to specifying parms
for the SP call.

(1) I can't make it work at all for a VARCHAR parm. Everytime there is
a VARCHAR parm, REXX seems to be passing it to DB2 as a character
string and I get a parameter error (-305). How can I specify a VARCHAR
string from REXX?

(2) If there is a character parm and the user enters in a numeric value
(which is valid) - REXX treats it as a number during the call to DB2
and then I get a parameter error (-305). Is there a way to force the
REXX/SQL interface to recognize the variable as a string regardless of
content?

Thanks much,
Michael

Nov 12 '05 #1
2 2639
wfs
> (1) I can't make it work at all for a VARCHAR parm. Everytime there is
a VARCHAR parm, REXX seems to be passing it to DB2 as a character
string and I get a parameter error (-305). How can I specify a VARCHAR
string from REXX?
I have the opposite problem, I could never get rexx to use fixed length
strings... so I had to define all my sp parameters as varchar.

can you post the sp definition and your sample rexx call
(2) If there is a character parm and the user enters in a numeric value
(which is valid) - REXX treats it as a number during the call to DB2
and then I get a parameter error (-305). Is there a way to force the
REXX/SQL interface to recognize the variable as a string regardless of
content?

I use "'"string"' " (double quote - single quote - double
quote - this makes sure its treated as a string by the rexx/sql interface

Bill
<dr*******@yaho o.com> wrote in message
news:11******** *************@g 14g2000cwa.goog legroups.com... I'm having a problem invoking DB2 Stored Procedures from REXX. I've
written a generic SP tester where you enter the schema and name of the
SP. The next panel displays the parms for the SP and allows you to
fill in the ones you need to and then invokes the SP.

I'm having two problems in particular that relate to specifying parms
for the SP call.

(1) I can't make it work at all for a VARCHAR parm. Everytime there is
a VARCHAR parm, REXX seems to be passing it to DB2 as a character
string and I get a parameter error (-305). How can I specify a VARCHAR
string from REXX?

(2) If there is a character parm and the user enters in a numeric value
(which is valid) - REXX treats it as a number during the call to DB2
and then I get a parameter error (-305). Is there a way to force the
REXX/SQL interface to recognize the variable as a string regardless of
content?

Thanks much,
Michael

Nov 12 '05 #2
I can't post the SP definition because my exec is actually a generic SP
invoker (a SP tester). So the parms could be anything! But, here's
my REXX code for the actual invocation.

An ISPF table has been setup to hold the parameter names and values (as
specified on an input panel). Here's the TBCREATE:
'ISPEXEC TBCREATE SPTESTPM NOWRITE REPLACE' ,
'KEYS(PNAME PTYPE PLEN PSCALE PIO) NAMES(PVALUE)'

So the table has the name of the variable, the definition of it (type,
len, scale, and if IN or OUT) and the value of the parameter.

Then we come to this code:
----

/* Set up variables needed to run the SP. */
FullName = Schema'.'SPname

/* Set the parms for the SP. Read the information from */
/* the parm table and set the variables appropriately. */
'ISPEXEC TBTOP SPTESTPM'
'ISPEXEC TBSKIP SPTESTPM'
ParmString = ''
ParmList. = ''
ParmCount = 0
Do i = 1 While rc = 0

/* Format character variables only to proper length. */
If Ptype = 'CHAR' Then Pvalue = Left(Pvalue,Ple n)

/* Assign Pvalue into variable name stored in Pname. Prefix */
/* parm name with PZ to avoid conflict with our REXX code. */
/* Also store parm name in a stem for later lookup. */
PZparm = Strip(Left('PZ' Pname,18)) /* New name for parm. */
junk = Value(PZparm,Pv alue) /* Assign value. */
ParmCount = ParmCount + 1 /* Count of parms. */
ParmList.ParmCo unt = Pname /* Store original name. */

/* Build string of parm names to pass to SP. */
If ParmString = '' Then
ParmString = ':'PZparm
Else
ParmString = ParmString',:'P Zparm

'ISPEXEC TBSKIP SPTESTPM'
End
If ParmString <> '' Then ParmString = '('ParmString') '

/* Connect to DB2. Initializes RoutineRC showing SQL status. */
Call DB2connect

/* If we're OK, continue. */
If RoutineRC = 0 Then Do

/* Execute the Stored Proc. */
Address DSNREXX "EXECSQL CALL :FULLNAME" ParmString
...retrieve results...
-----

Thanks.

-Michael

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
2212
by: serge | last post by:
How can i delete all user stored procedures and all table triggers very fast in a single database? Thank you
7
15597
by: Jeff Wang | last post by:
Hi all, Can someone help me out? I've been struggling with this for almost a week and still have no clue what's wrong. Basically I want to write a DB2 stored procedure for OS/390 in REXX. In this procedure it reads a dataset and return the first line of the dataset. I met two problems: Problem 1:
7
5676
by: Anthony Robinson | last post by:
Have been encountering an odd issue. Every now and again, certain packages of stored procedures just become invalid. I'm aware that dropping or altering an underlying table would render a package invalid, but we are doing no such thing... After banging my head on the wall for a bit I noticed that the two stored procedures that are experiencing this behavior are procedures that are called from within another procedure (they're not both...
5
3398
by: Rhino | last post by:
I am trying to determine the behaviour of stored procedures in DB2 V8.2.x in Windows/Unix/Linux and how I can control that behaviour. Some documentation in the manuals is confusing the issue somewhat. First, am I right in understanding that the normal behaviour of a stored procedure, fenced or unfenced, is to only go into memory when it is invoked and to be swapped out of memory when it is not needed any more? Second, am I right in...
2
3335
by: Eli | last post by:
Hi all We currently have a strange problem with calling a Stored Procedure (SQL Database) in our C# Project. The only error I get is "System error" which says a lot :) Background: We have several stored procedures to Insert and update datas in our SQL database. Some stored procedures are smaller (insert datas in only one table) and some of them are quite big (insert datas in several
2
1434
by: singlal | last post by:
Hi, my question was not getting any attention because it moved to 2nd page; so posting it again. Sorry for any inconvenience but I need to get it resolved fast. Need your help! **************************************************************************************************** Original Question: -------------------- Has anyone called a COBOL subroutine using COBOL CALL from a COBOL/DB2
2
3864
by: Tonkuma | last post by:
I called Stored Procedure written in SQL from Object REXX on Windows like this CALL SQLEXEC 'CALL MigrateDECODE(:inString,:Converted)' CALL CHECKERR 'CALL MigrateDECODE' (CHECKERR was copied from DB2 sample program) But, it returned -444 as followings. How can I call Stored Procedure written in SQL from REXX? --- error report --- ERROR occurred : CALL MIGRATEDECODE SQLCODE : -444
1
3347
by: jobs | last post by:
I have a growning list of stored procedures that accept a single string as a parameter. The list and parameters are maintained in a table with two columns. Some of the Stored procedures take hours to complete. procedures and the page come right back and recording infomation about the stored procedure (like a job number) that can later be used to report what stored procedures are still running.
2
4108
by: jed | last post by:
I have created this example in sqlexpress ALTER PROCEDURE . @annualtax FLOAT AS BEGIN SELECT begin1,end1,deductedamount,pecentageextra FROM tax
0
9670
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9518
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10159
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3719
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2917
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.