Difference between revisions of "F$ENVIRONMENT()"

From VSI OpenVMS Wiki
Jump to: navigation, search
m (Reverted edits by Tonvanderzwet (talk) to last revision by Darya.zelenina)
(Tag: Rollback)
m (Reverted edits by Jane.doe (talk) to last revision by Tonvanderzwet)
(Tag: Rollback)
 
Line 140: Line 140:
 
This example uses the F$ENVIRONMENT function to save the current default protection before changing the protection. At the end of the command procedure, the original protection is restored. You must place single quotation marks around the symbol SAVE_PROT to request symbol substitution.
 
This example uses the F$ENVIRONMENT function to save the current default protection before changing the protection. At the end of the command procedure, the original protection is restored. You must place single quotation marks around the symbol SAVE_PROT to request symbol substitution.
  
[[Caterogy:Lexical Functions]]
+
[[Category:Lexical Functions]]

Latest revision as of 10:53, 11 November 2019

F$ENVIRONMENT is a lexical function that returns information about the current DCL command environment.

Syntax

F$ENVIRONMENT(item)

Return_Value

Information that corresponds to the specified item. The return value can be either an integer or a character string, depending on the specified item (see the Data Type column in the table below).

Arguments

item

Specifies the type of information to be returned. Specify one of the following keywords (do not abbreviate these keywords):

Item Data Type Information Returned
CAPTIVE String TRUE if you are logged in to a captive account. The system manager can define captive accounts in the user authorization file (UAF) by using the Authorize utility (AUTHORIZE).
CONTROL String Control characters currently enabled with SET CONTROL. Multiple characters are separated by commas; if no control characters are enabled, the null string ("") is returned.
DEFAULT String Current default device and directory name. The returned string is the same as SHOW DEFAULT output.
DEPTH Integer Current command procedure depth. The command procedure depth is 0 when you log in interactively and when you submit a batch job. The command procedure depth is 1 when you execute a command procedure interactively or from within a batch job. A nested command procedure has a depth of 1 greater than the depth of the command procedure from which the nested procedure is executed.
DISIMAGE String TRUE if you are logged in to an account that does not allow you to directly invoke images (for example, RUN is not allowed). The system manager can add or remove the DISIMAGE attribute for accounts in the UAF by using AUTHORIZE.
INTERACTIVE String TRUE if the process is executing interactively.
KEY_STATE String Current locked keypad state. See the description of the DEFINE/KEY command for more information on keypad states.
MAX_DEPTH Integer Maximum allowable command procedure depth.
MESSAGE String Current setting of SET MESSAGE qualifiers. Each qualifier in the string is prefaced by a slash (/); therefore, the output from F$ENVIRONMENT("MESSAGE") can be appended to the SET MESSAGE command to form a valid DCL command line.
NOCONTROL String Control characters currently disabled with SET NOCONTROL. Multiple characters are separated by commas (,); if no control characters are disabled, the null string is returned.
ON_CONTROL_Y String If issued from a command procedure, returns TRUE if ON_CONTROL_Y is set. ON_ CONTROL_Y always returns FALSE at DCL command level.
ON_SEVERITY String If issued from a command procedure, returns the severity level at which the action specified with the ON command is performed. ON_SEVERITY returns NONE when SET NOON is in effect or at DCL command level.
OUTPUT_RATE String Delta time string containing the default output rate, which indicates how often data is written to the batch job log file while the batch job is executing. OUTPUT_RATE returns a null string if used interactively.
PROCEDURE String File specification of the current command procedure. If used interactively, the terminal device name is returned.
PROMPT String Current DCL prompt.
PROMPT_CONTROL String TRUE if a carriage return and line feed precede the prompt.
PROTECTION String Current default file protection. The string can be used with the SET PROTECTION/DEFAULT command to form a valid DCL command line.
RESTRICTED String TRUE if you are logged in to a restricted account. The system manager can define restricted accounts in the UAF by using AUTHORIZE.
SYMBOL_SCOPE String [NO]LOCAL, [NO]GLOBAL to indicate the current symbol scoping state.
VERB_SCOPE String [NO]LOCAL, [NO]GLOBAL to indicate the current symbol scoping state for verbs.
VERIFY_IMAGE String TRUE if image verification (SET VERIFY=IMAGE) is in effect. If image verification is in effect, then the command procedure echoes input data read by images.
VERIFY_PREFIX String Returns the prefix control string set by means of the set prefix command.
VERIFY_PROCEDURE String TRUE if procedure verification SET VERIFY=PROCEDURE is in effect. If command verification is in effect, then the command procedure echoes DCL command lines.

Examples

$ SAVE_MESSAGE = F$ENVIRONMENT("MESSAGE")
$ SET MESSAGE/NOFACILITY/NOIDENTIFICATION
.
.
.
$ SET MESSAGE'SAVE_MESSAGE'

This example uses the F$ENVIRONMENT function to save the current message setting before changing the setting. At the end of the command procedure, the original message setting is restored. The single quotation marks (` ') surrounding the symbol SAVE_MESSAGE indicate that the value for the symbol should be substituted.

$ MAX = F$ENVIRONMENT("MAX_DEPTH")
$ SHOW SYMBOL MAX
  MAX = 32   Hex = 00000020  Octal = 00000000040

This example uses the F$ENVIRONMENT function to determine the maximum depth allowable within command procedures.

$ SAVE_PROT = F$ENVIRONMENT("PROTECTION")
$ SET PROTECTION = (SYSTEM:RWED, OWNER:RWED, GROUP, WORLD)/DEFAULT
.
.
.
$ SET PROTECTION = ('SAVE_PROT')/DEFAULT

This example uses the F$ENVIRONMENT function to save the current default protection before changing the protection. At the end of the command procedure, the original protection is restored. You must place single quotation marks around the symbol SAVE_PROT to request symbol substitution.