Probably not known to many people is the existence or how to use the CLIST parameter of the RACF SEARCH command. Its usefulness however makes it worthwhile for everyone to learn how it works.
As you may know, to query the RACF database for the existence of profiles, we rely on the RACF SEARCH command. For example, if we want to know if there are any userids prefixed with ABC, we execute the RACF command SEARCH MASK(ABC) CLASS(USER), which in our example returns:
ABC001
ABC002
ABC003
ABC004
ABC005
To now know more about these 5 userids, we would need to issue a RACF LISTUSER (LU) command against each userid:
LU ABC001
LU ABC002
LU ABC003
LU ABC004
LU ABC005
Imagine now that there were 100 userids prefixed with ABC. Issuing 100 LISTUSER commands would be a very boring task, and this is where the CLIST parameter can be of great help.
Basically, the CLIST parameter allows us to indicate which RACF command is to be executed after the SEARCH is complete.
Here’s an example on how to use the CLIST parameter on a RACF SEARCH (SR) command:
//SEARCH EXEC PGM=IKJEFT01
//SYSTSPRT DD DISP=SHR,DSN=SCCUSER.REPORT(SRCHABC)
//SYSOUT DD SYSOUT=*
//SYSTSIN DD *
SR MASK(ABC) CLASS(USER) CLIST('LU ')
//LIST EXEC PGM=IKJEFT01
//SYSTSPRT DD DISP=SHR,DSN=SCCUSER.REPORT(LISTABC)
//SYSOUT DD SYSOUT=*
//SYSTSIN DD DISP=SHR,DSN=SCCUSER.EXEC.RACF.CLIST
Notes:
- REPORT(SRCHABC) will store the result of the SR (SEARCH) command
- REPORT(LISTABC) will store the result of the LU (LISTUSER) command
- EXEC.RACF.CLIST will store the RACF commands generated by the CLIST
- The CLIST parameter specifies the RACF command we wish to execute against each of the names returned by the SR (SEARCH) command. In our example it’s a LISTUSER (LU) command.
- The RACF command in the CLIST parameter needs to be enclosed in single quotes
- A blank space needs to exist after the RACF command in the CLIST and before any parameter. For example: CLIST(‘LU ” TSO’)
- If we don’t allocate dataset EXEC.RACF.CLIST, this will be automatically allocated by the system.
- EXEC.RACF.CLIST dataset must have variable length records and a maximum logical record size of 255
Be the first to comment