HP OpenVMS DCL Dictionary
INQUIRE
Reads a value from SYS$COMMAND (usually the terminal in interactive
mode or the next line in the main command procedure) and assigns it to
a symbol.
Format
INQUIRE symbol-name [prompt-string]
Parameters
symbol-name
Specifies a symbol consisting of 1 to 255 alphanumeric characters.
prompt-string
Specifies the prompt to be displayed at the terminal when the INQUIRE
command is executed. String values are automatically converted to
uppercase. Also, any leading and trailing spaces and tabs are removed,
and multiple spaces and tabs between characters are compressed to a
single space.
Enclose the prompt in quotation marks (" ") if it contains
lowercase characters, punctuation, multiple blanks or tabs, or an at
sign (@). To denote an actual quotation mark in a prompt-string,
enclose the entire string in quotation marks and use quotation marks
(" ") within the string.
When the system displays the prompt string at the terminal, it
generally places a colon (:) and a space at the end of the string. (See
the /PUNCTUATION qualifier.)
If you do not specify a prompt string, the command interpreter uses the
symbol name to prompt for a value.
Description
The INQUIRE command displays the prompting message to and reads the
response from the input stream established when your process was
created. This means that when the INQUIRE command is executed in a
command procedure executed interactively, the prompting message is
always displayed on the terminal, regardless of the level of nesting of
command procedures. Note that input to the INQUIRE command in command
procedures will be placed in the RECALL buffer.
When you enter a response to the prompt string, the value is assigned
as a character string to the specified symbol. Lowercase characters are
automatically converted to uppercase, leading and trailing spaces and
tabs are removed, and multiple spaces and tabs between characters are
compressed to a single space. To prohibit conversion to uppercase and
retain space and tab characters, place quotation marks around the
string.
To use symbols or lexical functions when you enter a response to the
prompt string, use single quotation marks (` ') to request symbol
substitution.
Note that you can also use the READ command to obtain data
interactively from the terminal. The READ command accepts data exactly
as the user types it; characters are not automatically converted to
uppercase and spaces are not compressed. However, symbols and lexical
functions will not be translated even if you use apostrophes to request
symbol substitution.
When an INQUIRE command is entered in a batch job, the command reads
the response from the next line in the command procedure; if procedures
are nested, it reads the response from the first level command
procedure. If the next line in the batch job command procedure begins
with a dollar sign ($), the line is interpreted as a command, not as a
response to the INQUIRE command. The INQUIRE command then assigns a
null string to the specified symbol, and the batch job continues
processing with the command on the line following the INQUIRE command.
Qualifiers
/GLOBAL
Specifies that the symbol be placed in the global symbol table. If you
do not specify the /GLOBAL qualifier, the symbol is placed in the local
symbol table.
/LOCAL (default)
Specifies that the symbol be placed in the local symbol table for the
current command procedure.
/PUNCTUATION (default)
/NOPUNCTUATION
Inserts a colon and a space after the prompt when it is displayed on
the terminal. To suppress the colon and space, specify the
/NOPUNCTUATION qualifier.
Examples
#1 |
$ INQUIRE CHECK "Enter Y[ES] to continue"
$ IF .NOT. CHECK THEN EXIT
|
The INQUIRE command displays the following prompting message at the
terminal:
The INQUIRE command prompts for a value, which is assigned to the
symbol CHECK. The IF command tests the value assigned to the symbol
CHECK. If the value assigned to CHECK is true (that is, an odd numeric
value, a character string that begins with a T, t, Y, or y, or an odd
numeric character string), the procedure continues executing.
If the value assigned to CHECK is false (that is, an even numeric
value, a character string that begins with any letter except T, t, Y,
or y, or an even numeric character string), the procedure exits.
#2 |
$ INQUIRE COUNT
$ IF COUNT .GT. 10 THEN GOTO SKIP
.
.
.
$ SKIP:
|
The INQUIRE command prompts for a count with the following message:
Then the command procedure uses the value of the symbol COUNT to
determine whether to execute the next sequence of commands or to
transfer control to the line labeled SKIP.
#3 |
$ IF P1 .EQS. "" THEN INQUIRE P1 "FILE NAME"
$ FORTRAN 'P1'
|
The IF command checks whether a parameter was passed to the command
procedure by checking if the symbol P1 is null; if it is, it means that
no parameter was specified, and the INQUIRE command is issued to prompt
for the parameter. If P1 was specified, the INQUIRE command is not
executed, and the Fortran command compiles the name of the file
specified as a parameter.
|