To continue reading for free, register below or login
To read more you must become a member of Search400.com
');
// -->

What you want to do is have the CL program you've written owned by a profile that has *SAVSYS special authority. Or you could have it owned by the profile that owns the file being saved. Then run the CHGPGM command, specifying the user profile parameter to be *OWNER. Now when the program runs, the program will "adopt" the authority of the program's owner. As long as the program is owned by a profile that has sufficient authority to the object or has *SAVSYS, you should be good to go. Here are some things to remember about adopted authority.
Adopted authority is stack-based. That is, as long as the program is active, or in the program call stack, the adopted authority is in effect. So if you do something like a SBMJOB out of the program that adopts, the adopted authority will not carry over to the new job because there's a new stack.
Because it's stack-based, the adopted authority flows to subsequent programs that are called. So if you would call the API that puts up the command line, the adopted authority flows out to that command line. So it's best to do whatever it is that needs the additional authority and then returns (doesn't do a lot of extra stuff.)
To control who can perform these saves, you'll probably want to set the program to *PUBLIC *EXCLUDE and only authorize selected users or groups to the program.
Hope this helps.
|