PROMPT

 

PROMPT statement assigns values supplied by the users to the program variables.

 

 

Element

Description

Expression List

Expression List which returns the message displayed by the prompt statement

ATTRIBUTE Clause

Display attributes applied to the displayed message and to the entered value

Variable

The variable to which the entered value is assigned

HELP Clause

The clause that specifies the number of the help message

INPUT Control block

The clause that controls the input of the prompted value

 

The PROMPT statement must be followed by the message that is displayed on the PROMPT line and that informs the user what kind of data are expected. The message may be represented by a quoted character string, or by a variable of character data type. When the PROMPT statement is executed, 4GL waits for the user input. After the value is entered, it is assigned to the variable specified in the FOR clause, unless the typed value coincides with the key-name specified in the ON KEY clause.

 

The following actions are performed when 4GL encounters a PROMPT statement:

  1. If any variables are present in the prompt text, they are replaced with their current values.

  2. The values, and quoted character strings are concatenated into a single prompt message (the total length of such message must not exceed 80 bytes)

  3. The prompt message is displayed on the PROMPT LINE (which is the first line of a 4GL window or 4GL screen by default)

  4. 4GL waits for the user input

  5. The entered value is assigned to the variable specified in the FOR clause.

 

The prompt field remains active and the prompt message remains visible until the input is performed.

 

The PROMPT statement must include such components:

 

There are also optional components that may follow the required components:

 

If at least one PROMPT input control clause is present within the PROMPT statement, the END PROMPT statement is required to mark the end of the PROMPT statement.

 

The PROMPT input control clauses can be listed in any order within the PROMPT statement, but they will be executed in the order in which they are listed above. However, all the other optional clauses must be placed in the order specified by the diagram, otherwise a compile-time error may occur.