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