473,416 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

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 2609
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*******@yahoo.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.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,Plen)

/* 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,Pvalue) /* Assign value. */
ParmCount = ParmCount + 1 /* Count of parms. */
ParmList.ParmCount = Pname /* Store original name. */

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

'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
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
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...
7
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...
5
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...
2
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...
2
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! ...
2
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...
1
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...
2
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
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...

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.