VMS Help INQUIRE *Conan The Librarian (sorry for the slow response - running on an old VAX) |
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]
1 - 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.
2 - Qualifiers |
2.1 - /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.
2.2 - /LOCAL
/LOCAL (default) Specifies that the symbol be placed in the local symbol table for the current command procedure.
2.3 - /PUNCTUATION
/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.
3 - 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: Enter Y[ES] to continue: 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: COUNT: 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.
|