ILPROMPT function

Syntax

ILPROMPT (in.line.prompt)

Description

Use the ILPROMPT function to evaluate a string containing in-line prompts.

in.line.prompt is an expression that evaluates to a string containing in-line prompts. In-line prompts have the following syntax:

<< [ control, ] ... text [ , option ] >>

control is an option that specifies the characteristics of the prompt. Separate multiple control options with commas.

Table 1. Possible Control Options
Control Explanation
A Always prompts when the sentence containing the control option is executed. If this option is not specified, the input value from a previous execution of this prompt is used.
Cn Uses the word in the nth position in the command line as the input value. (The verb is in position 1.)

F(filename) record.ID [ ,fm [ ,vm [ ,sm] ] ] )

 
  Finds input value in record.ID in filename. Optionally, extract a value (vm) or subvalue (sm) from the field (fm).
In Uses the word in the nth position in the command line as the input value, but prompts if word n was not entered.
P Saves the input from an in-line prompt. BASIC uses the input for all in-line prompts with the same prompt text until the saved input is overwritten by a prompt with the same prompt text and with a control option of A, C, I, or S, or until control returns to the command prompt. The P option saves the input from an in-line prompt in the current paragraph, or in other paragraphs.
R Repeats the prompt until Return is pressed.
R(string) Repeats the prompt until Return is pressed, and inserts string between each entry.
Sn Takes the nth word from the command but uses the most recent command entered at the command prompt to execute the paragraph, rather than an argument in the paragraph. Use this option in nested paragraphs.
@(CLR) Clears the screen.
@(BELL) Rings the terminal bell.
@(TOF) Positions the prompt at the top left of the screen.
@(col, row) Prompts at this column and row number on the terminal.

text is the prompt text to display. If you want to include quotation marks (single or double) or backslashes as delimiters within the prompt text, you must enclose the entire text string in a set of delimiters different from the delimiters you are using within the text string. For example, to print the following prompt text:

'P'RINTER OR 'T'ERMINAL

you must specify the prompt text as

\'P'RINTER OR 'T'ERMINAL\

or

"'P'RINTER OR 'T'ERMINAL"

option can be any valid ICONV function conversion or matching pattern (see the MATCH operator). A conversion must be in parentheses.

If in.line.prompt evaluates to the null value, the ILPROMPT function fails and the program terminates with a run-time error.

If the in-line prompt has a value, that value is substituted for the prompt. If the in-line prompt does not have a value, the prompt is displayed to request an input value when the sentence is executed. The value entered at the prompt is then substituted for the in-line prompt.

Once a value has been entered for a particular prompt, the prompt will continue to have that value until a CLEARPROMPTS statement is executed, unless the control option A is specified. CLEARPROMPTS clears all values entered for in-line prompts.

You can enclose prompts within prompts.

Example

A="This is your number. - <<number>>"
PRINT ILPROMPT(A)
PRINT ILPROMPT("Your number is <<number>>, and your 
letter is
   <<letter>>.")

This is the program output:

number=5This is your number. - 5
letter=KYour number is 5, and your letter is K.