Procedure Execution

  1. The value of option_nr is stored.
  2. For menus and action bars the condition to enter of all the subsidiary procedures is evaluated with no_grey set to TRUE and option_nr set temporarily to the value required to select that subsidiary. This is used to build a list of options that are greyed out in the menu.
  3. option_nr is restored to the value stored. On entry to a procedure body it is always the return value of the calling procedure.
  4. The procedure body is executed (see on Procedure Body Execution ) and a result returned indicating what happened.

    Possible results (return values) are:

    SUCCESS Successful completion
    ESCAPE −1  The procedure was terminated because the user pressed <Escape> or the procedure was a batch procedure and all possible processing was completed
    DELETE −3  The procedure was terminated because the user chose to delete the record being processed
    TERMINATED  −12  Premature termination – the procedure terminated because the record selected for processing did not satisfy all the necessary conditions or because of a non recoverable error or the procedure was of type Run another program and the command line could not be executed
    OPTION >0  If the procedure body is a menu then OPTION is the selected option number. If the procedure body is not a menu then the return value is forced to 0. If Qeat_func_keys is TRUE then the original return value is ignored. If Qeat_func_keys is FALSE the return value is stored in an internal variable that works like force_option. The next menu procedure will short cut and select the saved option. If force_option is set it will over-ride the saved option value, which is then discarded.

    If the procedure returned ESCAPE, procedure execution is terminated, unless the procedure has a window and the ESCAPE was generated after a selection had been made from the window.

    The subsidiary procedures of the procedure are executed according to the value returned by the procedure body:

    SUCCESS  Execute the subsidiary procedures in turn
    OPTION  Execute corresponding subsidiary procedure
    ESCAPE  Do not execute any subsidiary procedures
    Otherwise  Execute any subsidiary procedures if Always execute subsidiaries is specified

  5. If the procedure body specifies that changes are to be secured (see Securing changes), the database is checkpointed unless abandon_changes (or decommit) is TRUE (in which case decommit() is called). Note that this operation takes place after all subsidiary procedures have been executed. A checkpoint() or decommit() is also done in the same way if the procedure was a Save/Exit menu.

  6. firstitem is set FALSE.