MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » September 2014

RE: Problem with EVAL of SQL proc



fixed

Thanks Chuck,
I do like the UDF: it 'reads' better.

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of CRPence
Sent: Wednesday, September 03, 2014 4:44 PM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Problem with EVAL of SQL proc

On 03-Sep-2014 16:59 -0500, Gary Thompson wrote:
<<SNIP>>
From my very limited understanding, having div_lib as declared as
VARCHAR in SQL proc GETLIB was 'the issue'

I changed GETLIB SQL proc to be:

CREATE PROCEDURE SWIRETEST/GETLIB
( IN out_loc CHARACTER (4)
, OUT div_lib CHARACTER(10)
)

<<SNIP>>

Probably not an /issue/ with VARCHAR in the alluded sense; i.e. more likely a difficulty had, than any likely issue to be had, per use of the VARCHAR :-)

I intend SQL proc GETLIB to be a standard utility for us.
<<SNIP>>

Personally, I would [tend to] make the GETLIB routine a scalar User Defined Function (UDF) instead of a PROCEDURE to increase the utility; the GetLib routine could then be referenced directly in queries. Thus using CREATE FUNCTION (scalar); return the value currently defined as OUT for the PROCEDURE, as a scalar VARCHAR [or CHAR] result of the FUNCTION.

Then instead of an SQLRPGLE using the SQL CALL, the request could be a SET; e.g. instead of the first, the second:

Exec SQL
call getlib( :inp_loc , :rtn_libr ) ;
if sqlcod...

Exec SQL
set rtn_libr = getlib(inp_loc) ;
if sqlcod...

--
Regards, Chuck
--
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.






Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact