F$MODE() is a lexical function that returns a character string showing the mode in which a process is executing. The F$MODE function has no arguments, but must be followed by parentheses.
The character string INTERACTIVE for interactive processes. If the process is noninteractive, the character string BATCH, NETWORK, or OTHER is returned. Note that the return string always contains uppercase letters.
$ IF F$MODE() .NES. "INTERACTIVE" THEN GOTO NON_INT_DEF $ INTDEF: ! Commands for interactive terminal sessions . . . $ EXIT $ NON_INT_DEF: !Commands for noninteractive processes . . .
This example shows the beginning of a login.com file that has two sets of initialization commands: one for interactive mode and one for noninteractive mode (including batch and network jobs). The IF command compares the character string returned by F$MODE with the character string INTERACTIVE; if they are not equal, control branches to the label NON_INT_DEF. If the character strings are equal, the statements following the label INTDEF are executed and the procedure exits before the statements at NON_INT_DEF.