× 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.



Not sure what this has to do with RPG nor how the given sources for both the CREATE and the CALL are related...? As well, the token USER in SQL is a reserved word for the USER "special register" and the SESSION USER special register; USER is not a variable.

Regardless, to avoid coding the library name, just do that; remove the library name and the slash as qualifier. The SQL CALL without specifying the library name, an unqualified call, will use the SQL PATH to locate the procedure [name]. If the procedure is called using the *SYSTEM naming instead of the *SQL naming, then the default path will be the library list [*LIBL] used to locate the unqualified callee. If the procedure is called using *SQL naming instead of *SYSTEM naming, then the default path will be the authorization identifier which is the SESSION USER. Use the SET SESSION AUTHORIZATION statement to change the session user.

http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/db2/rbafzcallsta.htm
http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/db2/rbafzpath.htm
http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/db2/rbafzch2auth.htm

Regards, Chuck

DLee@xxxxxxxx wrote:
Could use some help.

Is there any way I can avoid hard coding the library name on
the call statement? If I can know the userid, I can determine
where to call the program from.

I guess I could call this stored procedure from a clp program
and pass in a library reference, but that seems like the long
way around.

I admit, I'm not too sharp on the stored procedures, but I've been kicking and biting my way thru it. I tried to DECLARE USER
and then VALUES SESSION_USER INTO USER but that didn't seem to
work as it does in SQL stored procedures.

Appreciate any help, or references. Ignore the &lib, that's something Aldon uses when a proc is created in aldon to promote
to programs from development to QA.

CREATE PROCEDURE &LIB/REM125SP ( ) RESULT SETS 1 LANGUAGE CL SPECIFIC &LIB/REM125SP NOT DETERMINISTIC NO SQL CALLED ON NULL INPUT EXTERNAL NAME CRPRDLIBTS/REM110CL PARAMETER STYLE GENERAL;
CALL CRPRDLIBTS/STRTSTLIB(COCD);

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.