Apologies but what am I setting in the options?

I do not want the service program to adopt its owner authority. I want it to adopt the calling program's authority. If a program (not the service program) is owned by QSECOFR and adopts its authority, when that program calls a function in the service program, that function should run as SECOFR. However, if the calling program does not adopt QSECOFR authority, when that program calls a function in the service program, it will run as the user.


-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Niels Liisberg
Sent: Saturday, April 18, 2026 7:31 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Service program and adopting authority

Look at the exec sql set option… i think you can change it there.

I have a similar sql stored procedure that does the same, there I use the set option…

fre. 17. apr. 2026 kl. 20.07 skrev <smith5646midrange@xxxxxxxxx>:

I have a service program with a lot of miscellaneous functions. One
of these functions is an "ExecuteCommand" function using SQL. It
uses SQL so it can reach out to other systems to execute commands.



From SYSTEMA, it can do a CALL PGMA on SYSTEMB using the following logic.

EXEC SQL CONNECT TO SYSTEMB;

ExecuteCommand('CALL PGMA');





ExecuteCommand does

Build sqlString which then looks like this.CALL
QSYS2/QCMDEXC('CALL PGMA');

EXEC SQL EXECUTE IMMEDIATE :sqlString;

Return sqlcode = 0;



I have an RPGLE program (not SQLRPGLE) that is owned by a *SECOFR
profile and adopts *OWNER authority. When it calls the ExecuteCommand
function in the service program, it appears that it is not adopting
any authority from the calling program.



I do not want the service program to adopt *OWNER authority because
then any program could call ExecuteCommand and do major damage if they
want.ExecuteCommand('DLTLIB ProdLib').



Is there a way to have the service program adopt the authority of the
calling RPGLE program (Use adopted authority = *YES already) when it
does the ExecuteCommand? Is my problem because of the service program
or the SQL inside of it?



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

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related questions.


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

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2026 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.