On 05-Aug-2016 15:07 -0500, T. Adair wrote:
I need to add a SPCAUT value (*JOBCTL in this case) to multiple user
profiles. I do a WRKUSRPRF *ALL and put a '2' next each one that I
want to change, and then I type 'SPCAUT(*JOBCTL)' on the command line
and press Enter and - guess what - it stomps over all the existing
SPCAUTs for the selected users and leaves them with only *JOBCTL.
I had long wished for the support to do that with a plus-sign, for
example:
SPCAUT(+*JOBCTL) /* meaning, add *JOBCTL to whatever is there */
How, using this method, can I add an entry to SPCAUT for each of
these users, without losing their existing SPCAUTs?
Not possible using the Work With User Profiles (WRKUSRPRF) except to
prompt each one and add the value on each. Better to instead choose a
method that can allow for the dynamic addition of that special value.
Frankly, in this case I can get around this, but that still leaves
the question in my mind of how to Add an entry to a multi-entry
parameter without stomping over the existing entries.
Not exactly a world-changer, but I am curious now.
We're on 7.2.
Thoughts? Thanks.
Given the Display User Profile (DSPUSRPRF) output file could in
effect replace the WRKUSRPRF interface, then rather than the secondary
action being 2=Change repeated, perform the work in a query modeled
after the following:
select
'chgusrprf ' concat upuprf concat 'spcaut(' concat
case when upspau = '*NONE' then '*JOBCTL'
else rtrim(upspau) concat ' *JOBCTL'
end concat ')' as cupRqs
from dspusrprf_output
where upuprf in ( … ) /* list of user names as values */
and locate('*JOBCTL', upspau) = 0 /* skip: has *JOBCTL already*/
The above query with the selected expression inside of a User Defined
Function (UDF) that invokes a command interpreter against the composed
CL command string would effect the changes; e.g. I have such a UDF
called cmdExec that returns a 1 on success and IIRC, returns 0 on error:
select cmdExec( N.cupRqs )
from
(select
'chgusrprf ' concat upuprf concat 'spcaut(' concat
case when upspau = '*NONE' then '*JOBCTL'
else rtrim(upspau) concat ' *JOBCTL'
end concat ')' as cupRqs
from dspusrprf_output
where upuprf in ( select usrprf from change_list )
and locate('*JOBCTL', upspau) = 0 /* skip: has *JOBCTL already*/
) as N
Note: this variation changed the IN predicate to reference a file
that contains a list of user profile names [column UsrPrf]