Re: Passing parms to a C Stored Proc Paul M wrote:
> Hi Knut,
>
> Thanks for your assistance and reply!
>
> I recreated the Stored Proc definition without the "WITH NULLS" keywords
> (ie. "PARAMETER STYLE GENERAL") hoping so simplify debugging this problem.
> Unfortunately, I still got the same results - the C code does not receive
> the parm I'm trying to pass in.
>
> How does the variable used on the stor proc define...
>
> CREATE PROCEDURE TMFDBC.PTMFMBID
> (
> INOUT MAILBOXID VARCHAR(8) CCSID EBCDIC
> )
> EXTERNAL NAME PTMFMBID LANGUAGE C
> PARAMETER STYLE GENERAL
>
> ...MAILBOXID, in this case, relate to the argv[] array in C?
>
> I'm assuming that since I'm only specifying 1 parameter, I *should* be
> able
> to reference it using argv[1]? (argv[0] being the program name by
> default).
>
> This is making me crazy! I'm following the example in the Redbook, but I
> can't get it to work!
First, check how DB2 for z/OS passes the parameters to a procedure. You
have probably some samples shipped with DB2. I'll I'm saying now refers to
DB2 for LUW.
A procedure declared as above would require the following C code:
int function(char *mailBoxId)
{
// ...
}
Note that the argc/argv stuff is only applicable to a "main" function in
C/C++. In particular, DB2 sends the parameters not in an array but rather
as separate parameters (or rather separate pointers to the parameters).
--
Knut Stolze
DB2 Information Integration Development
IBM Germany |