HP 3000 Manuals

PROMPT [ HP Transact Reference Manual ] MPE/iX 5.0 Documentation


HP Transact Reference Manual

PROMPT 

Accepts input from the user terminal and places the supplied values into
the list, data, argument, match, and/or update registers.

Syntax 

     PROMPT[(modifier)] item-name[("prompt-string")][,option-list]
           [:item-name[("prompt-string")][,option-list]...;

PROMPT prompts the user for values and, depending on the syntax option
chosen, places the value in one or more registers.  The register affected
depends on the verb modifier.  You can choose from the following:

none       Adds item name to list register and input value to data
           register.  (See Syntax Option 1.)

KEY        Adds item name to key register and adds input value to
           argument register.  (See Syntax Option 2.)

MATCH      Adds item name to list and match registers and adds input
           value to data register.  Also sets up input value in match
           register as a match criterion.  (See Syntax Option 3.)

PATH       Adds item name to list and key registers, and adds input value
           to data and argument registers.  (See Syntax Option 4.)

SET        Adds item name to list register and adds input value to data
           register, unless response is a carriage return.  (See Syntax
           Option 5.)

UPDATE     Adds item name to list and update registers and input value to
           data register; also adds input value to update register for
           subsequent replace operation.  (See Syntax Option 6.)

PROMPT is used to set up and perform a data entry operation, usually for
a subsequent data set or file operation.  At execution time it prompts
the user with a prompt string, the entry text associated with the item,
or with the item name to request the value of the data item.  An entry
text can be associated with an item in a dictionary or in the
DEFINE(ITEM) definition of the item.

Transact validates the input value as to type, length, or any other
characteristics specified in a dictionary or in a DEFINE(ITEM) statement
before it modifies the specified register.  If Transact detects an error,
it displays an appropriate error message and reissues the prompt
automatically.  With native language support, Transact validates numeric
data using the thousands and decimal indicators of the language in
effect.  For more information, see Appendix E, "Native Language Support."

Statement Parts 

modifier      Changes or enhances the PROMPT verb.  Usually determines
              the register in which to place the item name and the
              register to which the input value should be added or the
              register whose value should be changed.

item-name     The name of the data item to be placed in the list register
              and/or another register, and whose value should be added to
              or changed in the data register and/or another register.
              The item name cannot be the name of a child item.

prompt-       The string that prompts the terminal user for the input
string        value.  If omitted, the prompt is the entry text associated
              with the item.  If there is no entry text, the prompt is
              the item name.

option-list   A field specifying how the data should be formatted and/or
              other checks to be performed on the value.

              Choose one or more of the following options (separated by
              commas) for any syntax option.  (See Syntax Option 3,
              PROMPT(MATCH) for additional options.)

              BLANKS          Does not suppress leading blanks supplied
                              in the input value.  (Leading and trailing
                              blanks are normally stripped.)

              CHECK=          Checks the input value against the master
              set-name        set set-name to ensure that a corresponding
                              search item value already exists.  If the
                              value is not in the data set at execution
                              time, Transact displays an appropriate
                              error message and reissues the prompt.

                              __________________________________________ 

                              NOTE  The CHECK= or CHECKNOT= options
                                    cannot be used to check against MPE
                                    or.  KSAM files, nor can either
                                    option be included in a PROMPT(MATCH)
                                    statement.  Also, if the CHECK= or
                                    CHECKNOT= option is used with STATUS,
                                    then "]", "]]", or a carriage return
                                    suppresses the data set operation and
                                    control passes to the next statement.

                              __________________________________________ 

              CHECKNOT=       Checks input value against the master set
              set-name        set-name to ensure that a corresponding
                              search item value does not already exist.
                              If the value is in the data set at
                              execution time, Transact displays an
                              appropriate error message and reissues the
                              prompt.

              NOECHO          Does not echo the input value to the
                              terminal.  If omitted, the input value is
                              displayed on the terminal.

              RIGHT           Right-justifies the input value within the
                              data register field.  By default, the input
                              value is left-justified.

              STATUS          Suppresses normal processing of "]" and
                              "]]", which cause an escape to a higher
                              processing or command level.

   Status                  Meaning 
  Register 
   Value 

     -1      User entered a "]".

     -2      User entered a "]]".

     -3      User entered one or more blanks and
             no non-blank characters.

     -4      If timeout is enabled with a
             FILE(CONTROL) statement, a timeout
             has occurred.

    > 0      Number of characters (includes
             leading blanks if BLANKS option is
             specified); no trailing blanks are
             counted.

                              The STATUS option allows you to control
                              subsequent processing by testing the
                              contents of the register with an IF
                              statement.

Syntax Options 

(1) PROMPT item-name [("prompt-string")][,option-list];

PROMPT with no modifier adds the item-name to the list register and the
input value to the data register.

Specifying the ALIGN option forces the item to be aligned on a 16-bit
boundary in Transact/V and on a 32-bit boundary in Transact/iX.


NOTE Only compile time alignment is supported.
(2) PROMPT(KEY) item-name[("prompt-string")][,option-list]; PROMPT(KEY) places the item-name in the key register and the input value in the argument register. The data item and its value are used as a retrieval key for a subsequent data set or file operation. (3) PROMPT(MATCH)item-name[("prompt-string")][,option-list]; PROMPT(MATCH) adds the item-name to the list and match registers. In addition, it adds the input value to the data register and also sets up this value as a selection criterion in the match register for a subsequent database or file operation. The user response to PROMPT(MATCH) can be any of the valid selection criteria described under "Responding to a MATCH Prompt" in Chapter 5. If the response is a carriage return, then all values for the data item are selected. If the response contains several values separated by connectors, only the first value is placed in the data register space for the item. If a particular value is input, then all entries that match the associated data item are selected. [REV BEG] If the item name is an unsubscripted array, only the value of the first element of the array will be set in the data register. This value from the data register will be set up as a match criterion in the match register.[REV END] The MATCH modifier allows one or more of the option-list items listed under "Statement Parts", except for CHECK= and CHECK NOT=, which are not allowed in a PROMPT(MATCH) statement. Additionally, you can select one of the following options to specify that a match selection is to be performed on a basis other than equality. If you specify one of the options listed below, the entire user input is treated as a single value. The match specification characters described in Chapter 5 are not allowed as user input with the options listed below. option- Any of the following options can be selected: list: ALIGN Forces the item to be aligned on a 16-bit boundary in Transact/V and on a 32-bit boundary in Transact/iX NE Not equal to LT Less than LE Less than or equal to GT Greater than GE Greater than or equal to LEADER Matched item must begin with the input string; equivalent to the use of trailing "^" on input SCAN Matched item must contain the input string; equivalent to the use of trailing "^^" on input TRAILER Matched item must end with the input string; equivalent to the use of a leading "^" on input For example, for the following command and response sequence, the database or file entries selected will contain EMPL values starting with "LIT", AGE values less than 35, and LOS values greater than or equal to 5: PROMPT(MATCH) EMPL: AGE, LT: LOS, GE; EMPL> LIT^ AGE> 35 LOS> 5 (4) PROMPT(PATH) item-name[("prompt-string")][,option-list]; PROMPT(PATH) adds the item-name to the list register and the key register. In addition, the input value is added to the data register and the argument register. Use this modifier to set up a data item for a data set or file operation and its value for use as a retrieval key. Specifying the ALIGN option forces the item to be aligned on a 16-bit boundary in Transact/V and on a 32-bit boundary in Transact/iX. (5) PROMPT(SET) item-name [("prompt-string")][,option-list]; PROMPT(SET) adds the item-name to the list register and the input value to the data register only if the input value is not a carriage return. If the user responds to the prompt with a carriage return, no additions are made to the list and data registers. The modifier is primarily used to set up a data item list for a data set or file operation using the UPDATE verb, where the user controls that list by means of his or her responses. For example, the following PROMPT(SET) statement and the responses to its prompts produce a list register content of "PHONE" and "ROOM" and a data register content of the associated supplied values. Note that if you use the CHECK option and the item is not found in the data set, you must clear this value from the match register with RESET(MATCH) before you reissue the prompt. PROMPT(SET) EMPL: DEPT: PHONE: ROOM: LOCATION; EMPL> DEPT> PHONE> 278 ROOM> 312 LOCATION> Specifying the ALIGN option forces the item to be aligned on a 16-bit boundary in Transact/V and on a 32-bit boundary in Transact/iX. (6) PROMPT(UPDATE) item-name[("prompt-string")][,option-list] [:item-name...]...; PROMPT(UPDATE) adds the item-name to the list and update registers, and adds the input value to the data register. In addition, it sets up the input value in the update register for a subsequent data set or file operation using REPLACE. When a subsequent REPLACE statement is executed, it replaces any value for the specified data item with the value added to the update register. Specifying the ALIGN option forces the item to be aligned on a 16-bit boundary in Transact/V and on a 32-bit boundary in Transact/iX. Examples This example causes a sequence of prompts to be displayed: $$ADD: <<Add a new record >> $CUSTOMER: PROMPT CUST-NAME("CUSTOMER'S NAME"): CUST-ADDR: CUST-CITY: CUST-PHONE; This example is a result of the above code. CUSTOMER'S NAME> CUST-ADDR> CUST-CITY> CUST-PHONE> The following example adds a new customer number to the data set and then adds transactions for that customer. It checks to make sure that the customer number entered by the user is not already in the data set and that the transactions apply to a customer number that is in the data set. $$ADD: <<Add new customer >> $CUSTOMER: PROMPT(PATH) CUST-NUMBER, CHECKNOTCUST-MASTER; : PUT CUST-MASTER; $TRANS: PROMPT(PATH) CUST-NUMBER, CHECKCUST-MASTER; PROMPT INV-NUMBER: AMOUNT; : PUT CUST-DETAIL; The last example shows how the ALIGN option word-aligns select-code in the list register. PROMPT(MATCH)select-code,ALIGN;


MPE/iX 5.0 Documentation