DB2 not making the FINAL CALL to my user-defined function

pts.
Tags:
IBM DB2
UDF is written in RPGLE, and the CREATE FUNCTION specifies SCRATCHPAD and FINAL CALL. When I do an INSERT statement with the UDF specified for one of the columns, I get called twice. The first has a CALLTYPE of -1, and the second CALLTYPE is 0. I'm expecting a third invocation with a CALLTYPE of 1, but it never happens. Here's the parameter list defined in my UDF: D SHADENCCHR PI * Input parameters D resource 10A OPTIONS(*VARSIZE) VARYING D value 1024A OPTIONS(*VARSIZE) VARYING * Output parameter D returnVal 20A OPTIONS(*VARSIZE) VARYING * Remaining SQL parameters D resourceNull 2B 0 D valueNull 2B 0 D returnNull 2B 0 D sqlState 5A D funcName 517A CONST OPTIONS(*VARSIZE) VARYING D specName 128A CONST OPTIONS(*VARSIZE) VARYING D errorMsg 70A OPTIONS(*VARSIZE) VARYING D scratchPad 104A OPTIONS(*VARSIZE) VARYING D callType 2B 0

Answer Wiki

Thanks. We'll let you know when a new response is added.

Not sure from the snippet from the UDF code if this was addressed, but…

from the iSeries DB2 Universal Database for iSeries SQL Reference Version 5 Release 3 “…FINAL CALL is only allowed with PARAMETER STYLE DB2SQL or PARAMETER STYLE DB2GENERAL…”

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • JBTaylor
    This was my mistake. The 'callType' parameter passed from DB2 is a 4-byte integer and must be defined in RPG as '9B 0'. I had it defined as a 2-byte integer, so the value '1' looked like a '0'.
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following