× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi All,

I have a user defined function that I'm trying to use within an
SQL statement. Ideally I would want the function to use the library list
of the environment it is called from. I'm not having any luck there and
thought someone might point me in the right direction. Below is the
function definition and the error I get when attempting to run it.
From what I've read it looks like it is using SQL naming
convention where the library used is equal to the user profile. I want
to use system naming convention. My defaults within STRSQL (where I'm
testing) is set to *SYS naming convention.

Thanks in advance...
- Steve

FUNCTION DEFINITION:

SET PATH "QSYS","QSYS2","SCOYLE" ;
CREATE FUNCTION GBCMODS.RTVNRACCTCLASS (
INOBJ CHAR(6) ,
INSUB CHAR(8) )
RETURNS CHAR(3)
LANGUAGE SQL
SPECIFIC GBCMODS.RTVNRACCTCLASS
NOT DETERMINISTIC
READS SQL DATA
CALLED ON NULL INPUT
NO EXTERNAL ACTION
NOT FENCED
SET OPTION ALWBLK = *ALLREAD ,
ALWCPYDTA = *OPTIMIZE ,
COMMIT = *NONE ,
DECRESULT = (31, 31, 00) ,
DFTRDBCOL = *NONE ,
DYNDFTCOL = *NO ,
DYNUSRPRF = *USER ,
SRTSEQ = *HEX
BEGIN

DECLARE RECCOUNT INT ;
DECLARE CLASS CHAR ( 3 ) NOT NULL DEFAULT ' ' ;
SET PATH = GBCMODS , GBCCOM ;

IF SUBSTR ( INSUB , 4 , 5 ) = '93720' OR
INSUB >= '92000000' AND INSUB <= '92099999' AND INOBJ = '4215 '
OR
INSUB >= '99000000' AND INSUB <= '99099999' AND INOBJ = '4215 '

THEN
SET CLASS = 'BON' ;
ELSE
SELECT COUNT ( * ) INTO RECCOUNT FROM F0005 WHERE DRSY = '56 ' AND DRRT
= 'JS' AND TRIM ( DRKY ) = SUBSTR ( INSUB , 4 , 5 ) ;
IF RECCOUNT > 0 THEN
SET CLASS = 'MIS' ;
ELSE
SELECT COUNT ( * ) INTO RECCOUNT FROM F0005 WHERE DRSY = '56 ' AND DRRT
= 'JO' AND TRIM ( DRKY ) = TRIM ( INOBJ ) ;
IF RECCOUNT > 0 THEN
SET CLASS = 'PAY' ;
ELSE
SET CLASS = 'OTH' ;
END IF ;
END IF ;
END IF ;

RETURN CLASS ;

END ;


ERROR IN JOBLOG:

F0005 in SCOYLE type *FILE not found.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.