Thanks Michael,
That was what I was looking for.
The service program is not a problem, just needed the SQL for the function.
Jeff Young
Sr. Programmer Analyst
________________________________
From: "Schutte, Michael D" <Michael_Schutte@xxxxxxxxxxxx>
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Sent: Fri, May 6, 2011 11:18:33 AM
Subject: RE: AW: SQL UDF to return edited numeric field
Have you ever created service programs before? Create one then it's as simple
as
CREATE FUNCTION LIBRARY/SQL_FUNCTION_NAME (
PARM1 CHAR(1), --must match parm 1 of the procedure being called in the
service program
PARM2 CHAR(3) -- must match parm 2 if there are more parms to the
procedure then add them, separate with a comma
)
RETURNS CHAR(25) -- this should match what's being returned from the
called procedure in the service program.
LANGUAGE RPGLE
SPECIFIC SCRLIBTST/SPV_PRICECHANGE -- Just to give this UDF a specific
name.
DETERMINISTIC -- If same parms are passed on consecutive calls, returns
same result.
NO SQL -- Tell the UDF that that service program doesn't have SQL
embedded. (I think)
RETURNS NULL ON NULL INPUT
NO EXTERNAL ACTION
NOT FENCED
EXTERNAL NAME 'LIBRARY/SERVICEPGM (PROCEDURETOCALL)' -- WHAT PROCEDURE
WITHIN THE SERVICE PROGRAM SHOULD BE CALLED.
PARAMETER STYLE GENERAL ;
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx]
On Behalf Of Jeff Young
Sent: Friday, May 06, 2011 10:49 AM
To: Midrange Systems Technical Discussion
Subject: Re: AW: SQL UDF to return edited numeric field
Thanks Birgitta,
I have never created a UDF.
Would it be possible to point me to some examples of the SQL code needed?
Thanks again,
Jeff Young
Sr. Programmer Analyst
________________________________
From: Birgitta Hauser <Hauser@xxxxxxxxxxxxxxx>
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Sent: Fri, May 6, 2011 10:13:07 AM
Subject: AW: SQL UDF to return edited numeric field
Hi,
just write an RPG function that edits a numeric value by using either the
built-in-function %EditC or %EditW.
Register this RPG function as UDF and call this UDF from SQL.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Jeff Young
Gesendet: Thursday, 05. May 2011 22:57
An: midrange-l@xxxxxxxxxxxx
Betreff: SQL UDF to return edited numeric field
Does anyone have a UDF (or other SQL method) of taking a numeric field and
returning a character value representing the value as edited via an edit
code or
edit word in RPG?
I know that if I use CAST/SUBSTR/CONCAT that I can do this, but was looking
for
a neater way.
Needs to be supported on V5R4 or earlier.
Thanks,
Jeff Young
Sr. Programmer Analyst
--
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.
--
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.
--
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.