Please show how you defined the parms to DISPLAYVAL. If you said that the second parm was char 2, then you will need to wrap '02' with char() to get it to match. When using functions and procedures, the data type you pass must match what it's expecting. In this example you are passing a varchar by default. So if you defined that second parm as char then try this.

Displayval(1001,char('02',2))

Personally, I've never tried just calling the function from STRSQL. You may need to select displayval(1001,char('02',2)) from sysibm/sysdummy1


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of James Lampert
Sent: Tuesday, March 29, 2011 2:50 PM
To: Midrange Systems Technical Discussion
Subject: SQL UDF help

I'm trying to write a UDF to convert from a "code" to a "display value."

I think I managed it,
Function DISPLAYVAL was created in MERCURY.

but I'm having trouble testing it (probably from not knowing what I'm doing)

I try
displayval(1001, '02')
and I get
Token DISPLAYVAL was not valid. Valid tokens: ( CL END GET SET CALL

I try
create procedure myproc3
begin
signal SQLSTATE '70000' set message_text = displayval(1001, '02')
end
and I get
Variable DISPLAYVAL not defined or not usable.

I'm obviously doing *something* wrong, but I haven't a clue *what*.

--
JHHL
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

________________________________

Notice from Bob Evans Farms, Inc: This e-mail message, including any attachments, may contain confidential information that is intended only for the person or entity to which it is addressed. Any unauthorized review, use, disclosure or distribution is strictly prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message and any attachments.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.