EXECUTE EVENT

Execution

PERFORM RMP--EE-PANELNAME

Description

This standard runtime function performs the entry of a single panel field/control, but when placed in an event loop it allows entry of all fields/controls on the panel. Use the EXECUTE EVENT standard runtime function as the standard method of allowing user input with RM/Panels. It provides the power of multiple field entry with the flexibility of field-by-field control. Use a related standard runtime function, ACCEPT FIELD when only one field/control is to be entered.

Required Parameters

There are three ways to specify which field/control receives input focus on each execution of the EXECUTE EVENT standard runtime function:

  1. If you want to begin entry on the first field/control of the panel, RMP--FIRST-FIELD must be set to TRUE.
  2. If you want to specify the next input field/control, RMP--NEXT-FIELD must be set to the field/control name, and RMP--NEXT-OCCUR must be set to the field/control occurrence number. The RM/Panels runtime system resets these parameters after each execution of the EXECUTE EVENT standard runtime function, thereby preparing for the next execution.
  3. If you want to resume entry on the last field/control of the panel that the user entered, RMP--REPEAT-EVENT must be set to TRUE. This is useful if multiple panels are in use and the user is returning to a previously accessed panel, or if invalid user input is detected.

Returned Values

The value entered for each field/control in the panel is stored within panelname.WS. The field termination code indicating the terminating key is returned in RMP--EXCEPTION- NUMBER.

The values of RMP--LAST-FIELD, RMP--LAST-OCCUR, RMP--NEXT-FIELD, and RMP--NEXT-OCCUR are also set to the appropriate values for the next event. Occurrence numbers are equivalent to COBOL subscripts and begin at 1.

Under modeless operation, the following parameters are also returned:

  • RMP--LAST-PANEL contains the name of the panel for which the last EXECUTE EVENT standard runtime function was performed.
  • RMP--REQUESTED-PANEL contains the name of the panel that the user requested for the next event. To support modeless behavior, the application program must be written so that the next EXECUTE EVENT standard runtime function is performed for the panel named by this parameter.

Additional Usage Notes

Example

1 SET RMP--FIRST-FIELD TO TRUE.
2 PERFORM WITH TEST AFTER UNTIL F3-KEY
3    PERFORM RMP--EE-PANELNAME
4      EVALUATE RMP--LAST-FIELD
5         WHEN "CUSTOMER-NUMBER"
             PERFORM CUSTOMER-VALIDATION
             IF CUST-NOT-VALID
6               SET RMP--REPEAT-EVENT TO TRUE
             END-IF
7         WHEN "CUST-BAL"
             IF CUST-BAL = 0
8               MOVE "SHIP-CODE" TO RMP--NEXT-FIELD
             END-IF
9         WHEN "SHIP-CODE"
             IF SHIP-CODE NOT = OLD-SHIP-CODE
                PERFORM VALIDATE-SHIP-CODE
                IF SHIP-CODE-NOT-VALID
10                 SET RMP--REPEAT-EVENT TO TRUE
                END-IF
             END-IF
11     END-EVALUATE
12     EVALUATE RMP--NEXT-FIELD
13        WHEN "SHIP-CODE"
             MOVE SHIP-CODE TO OLD-SHIP-CODE
14     END-EVALUATE
15 END-PERFORM.
  1. Setting RMP--FIRST-FIELD to TRUE tells RM/Panels to begin user input with the first field/control on the panel.
  2. This is the loop control, specifying the condition that terminates the event loop.
  3. This is the execution of the event, the entry of a field/control. It is done with the EXECUTE EVENT standard runtime function.
  4. This is the first of the event tests. The EVALUATE statement is used to determine the field/control on the panel that was just entered by the user.
  5. This statement checks to see if the customer number was just entered. If it was entered, a validation routine contained in the application program is performed.
  6. Setting RMP--REPEAT-EVENT to TRUE forces the customer number to be reentered as the next event, rather than moving on to the next field/control.
  7. This statement checks to see if the customer balance was just entered.
  8. Moving SHIP-CODE to RMP--NEXT-FIELD forces the next event to be the entry of the SHIP-CODE field/control, rather than the next field/control on the panel.
  9. This statement checks to see whether the SHIP-CODE field/control was just entered. If so, the statement checks to see if the value changed and validates the new value.
  10. Setting RMP--REPEAT-EVENT to TRUE forces reentry of the SHIP-CODE field/control.
  11. This statement ends the evaluation of the last field/control entered.
  12. This statement begins evaluation of the next field/control to be entered.
  13. This statement checks to see whether the SHIP-CODE field/control is about to be entered. If so, it saves the current value allowing the operations, described previously in #9, to detect a change in the value.
  14. This statement ends the evaluation of the next field/control to be entered.
  15. This statement ends one iteration of the loop.

    This type of flexibility provides limitless possibilities. For more conceptual information on event loops, see the discussion of Event Loop Method.

RMP--STATUS Values

Status value Description
0 The function executed successfully.
1 The field/control name is invalid.
2 The occurrence number is invalid.
5 The panel is not in this library
6 The library does not exist.
8 The panel does not contain any fields/controls.
9 The panel contains no input fields/controls.
10 The panel is not displayed.
14 A COBOL input/output error was encountered on the panel library during execution of this function. To determine the exact nature of the I/O error, use the C$RERR subprogram.