multiple special authorities in cl command

how we can pass multiple special authorities in a cl command? separated by spaces or separated by commmas?

Answer Wiki

Thanks. We'll let you know when a new response is added.

What exactly are you trying to do? I don’t fully understand the question, but in general list items in command parameters are separated by spaces and sometimes in parenthesis. For example:

KEYWORD(value1 value2 value 3)
KEYWORD((value1a value1b) (value2a value2b)

Special Authorities are usually assigned to a user using the CRTUSRPRF or CHGUSRPRF commands and the parameter for either would be:

SPCAUT(value1 value2 value3…)

If you’re wanting to change the authority to a specific command so that only certain users/user groups can use the command then you’re talking about object authority to the command itself. That is easily changed using the EDTOBJAUT command.

If you could post more detailed information I’m sure we can help you more.

All the best



I’d guess that you are trying to execute CRTUSRPRF or CHGUSRPRF in a CL program, and you want the special authorities to be passed into the command by variables. Unfortunately, you didn’t respond to Jonathan’s request for clarification; so, there doesn’t seem to be any reason for me to explain how to do that. I can’t tell if that’s what you want to know.

I would possibly be wasting my time or making things more confusing for those who read this later.

Please, if someone asks for clarification, take the time to respond.


Discuss This Question: 2  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • pdraebel
    Simple trick to see how your command strings should look in CL. On a command line enter the command and press F4 to enter the parameters you want. Once you completed filling in all parameters press F14. That will show the resulting command string. Very easy to see how parameter lists are actually coded.
    7,545 pointsBadges:
  • TomLiotta
    The most likely problem is that the CHGUSRPRF command is specified in a CL Program, and the SPCAUT() parameter is being populated with values. However, the program is trying to populate the parameter through a CL variable; and the variable is being given a value like '*ALLOBJ *SPLCTL *JOBCTL' or '*ALLOBJ, *SPLCTL, *JOBCTL'. Neither spaces nor commas are going to work as delimiters. That's because each value is a separate list element. They're not supposed to be supplied as a string in a single variable. If you are going to assign three different special authorities, you must specify at least three different variables for the list within the SPCAUT() parameter. By itself, that's not a very big deal. It gets complicated, though, when you want to specify one special authority for one user and four for another user. You can't have a compiled program use one variable one day and four variables the next day. You could have a nested IF-test that ran eight different versions of the CHGUSRPRF command, a version for each of the different numbers of elements. You'd need the additional logic to assign specific special values to the variables which could be complex since CL has no array data attribute. The resulting code would be ugly and a real mess. It's complicated further by the fact that blanks aren't valid as one of the special values. You can only use the values that are presented when you prompt the parameter. There are two possible better alternatives. Maybe the most common is to construct the CHGUSRPRF command as a string rather than as a compiled command. As a string, the special authorities are perfectly fine being delimited by spaces. The string will look just like it does when typed on a command line. To execute it, you use the QCMDEXC API with the string (in a variable) as the first parameter and the length of the string in a variable as the second parameter. Less common and probably less well known, each special authority value can be specified more than once. What that means is that you can repeat, say, the last special authority through any remaining variables. There are no ill effects from using the same value eight times if necessary. It only gets applied once to the profile. That lets you always use exactly eight variables for the list. Actually, you still need two variations because there are three "single" values possible -- *SAME, *NONE and *USRCLS. If you use one of those, you must use it exactly once and no other values are allowed. And that means the program will have an IF-test that has CHGUSRPRF with a single variable value for the SPCAUT() list and another CHGUSRPRF with eight variables. Still, the choices of a command string for the QCMDEXC API and of repeated values in a list of variables simplify the programming over other possibilities. Tom
    125,585 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: