Question

I am writing an SQL wrapper for a service program procedure. The procedure works, but the UDF I am creating is behaving strangely. When I create the UDF with the external name keyword, it is becoming case sensitive. Here is the code I have:

create function C1ANEWF.getSalesAuditStorePeriodLibrary
                   (inStore decimal(5,0),
                    inDate  date)
returns char(10) ccsid 37

language rpgle
parameter style general
specific sa1802f001
not deterministic
reads sql data
returns null on null input
not fenced
program type sub
no final call
allow parallel
no scratchpad
external name C1NEWO.SA1802("getSalesAuditStorePeriodLibrary")

When I create this, it works. If I remove the "" from the procedure name, it does not. I have lots of SQL UDFs where I am not using the "", and case sensitivity is not an issue.

Any ideas?

Was it helpful?

Solution

Display the procedure exports of your service program, with DSPSRVPGM ____ DETAIL(*PROCEXP). You will see that the procedure name is mixed case. Now look at one of your older service programs. You will see uppercase names.

The quotes your SQL make sure that mixed case is used, and thus match the procedure name, which is case sensitive. Without those quotes, the name would be translated to uppercase, which would match your older procedures.

OTHER TIPS

Wrapping the subprocedure name in quotes tells DB2 to use the name exactly as quoted, that is, in mixed case. If your call to this procedure only works when you register the function in mixed case, it seems that your call must also be using mixed case. Is the calling statement using double quotes? If so, remove them there as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top