Examples: Using the QUERY SECURITY command for resource security checking
You can use the two forms of the QUERY SECURITY command in a number of different ways to customize resource security checking within an application. Typically, you can use QUERY SECURITY to check whether a user is authorized to use a particular transaction before displaying the transaction code in a menu. You can also use QUERY SECURITY to control access to data at the record or field level.
Example: Changing the level of security checking
You can use QUERY SECURITY to perform a different level of security checking from that which CICS® would perform for application programs that specify RESSEC(YES) or CMDSEC(YES).
EXEC CICS QUERY SECURITY RESTYPE('FILE') RESID(file_name) UPDATE(cvda)
This command allows the transaction to continue without any further calls to RACF®.Example: Checking which transactions to offer a user
You can use the QUERY SECURITY command to check whether a user is authorized to use a particular transaction before displaying the transaction code as part of an introductory menu.
When you use the command for this purpose, you will probably want to avoid logging the checks for users who are not allowed to use certain transactions. To do this, use the NOLOG option.
Example: Controlling access to data at the record or field level
Normal CICS resource security checking for files operates at the file level only. You can use QUERY SECURITY to enable your application to control access to data at the record or field level.
QUERY SECURITY RESCLASS('$FILEREC') RESID('PAYFILE.SALARY')
RESIDLENGTH(14) READ(read_cvda) NOLOG
where '$FILEREC' is an installation-defined RACF general resource class.