F$PRIVILEGE()

From VSI OpenVMS Wiki
Jump to: navigation, search

F$PRIVILEGE is a lexical function that returns a string value of either TRUE or FALSE, depending on whether your current process privileges match those specified in the argument. You can specify either the positive or negative version of a privilege.

Syntax

F$PRIVILEGE(priv-states)

Return Value

A character string containing the value TRUE or FALSE. The F$PRIVILEGE function returns the string FALSE if any one of the privileges in the priv-states argument list is false.

Arguments

priv-states Specifies a character string containing a privilege, or a list of privileges separated by commas (,). Specify any one of the process privileges except [NO]ALL.

Examples

$ PROCPRIV = F$PRIVILEGE("OPER,GROUP,TMPMBX,NONETMBX") 
$ SHOW SYMBOL PROCPRIV PROCPRIV = "FALSE" 

The F$PRIVILEGE function is used to test whether the process has OPER, GROUP, and TMPMBX privileges and if you do not have NETMBX privileges. The process in this example has OPER (operator), GROUP, TMPMBX (temporary mailbox), and NETMBX (network mailbox) privileges. Therefore, a value of FALSE is returned because the process has NETMBX privilege, but NONETMBX was specified in the priv-states list. Although the Boolean result for the other three keywords is true, the entire expression is declared false because the result for NONETMBX was false.