Previous Topic: Application Help ScreenNext Topic: Effects of Automatic Editing on Flow of Control


Runtime Flow Of Control

Flow of control is the way control is passed from one application function or dialog to another at runtime. In CA ADS, the runtime flow of control is determined by user requests or runtime events, based on specifications made at definition time.

AGR-CURRENT-RESPONSE

The CA ADS runtime system uses the AGR-CURRENT-RESPONSE field of ADSO-APPLICATION-GLOBAL-RECORD to direct the flow of control in applications defined by using the application compiler.

When the user presses a control key, the value of AGR-CURRENT-RESPONSE is established by means of the following steps:

  1. The runtime system moves spaces to AGR-CURRENT- RESPONSE.
  2. The runtime system checks the AGR-MAP-RESPONSE field of ADSO-APPLICATION-GLOBAL-RECORD (AMR- RESPONSE-FIELD of ADSO-APPLICATION-MENU- RECORD for menu functions) for a response entered by the user. If the user entered a response and pressed the ENTER key, the runtime system moves the response to AGR-CURRENT-RESPONSE. If the user pressed a control key other than the ENTER key, the runtime system proceeds to Step 4 below.
  3. If the user did not enter a response, the runtime system checks the AGR-DEFAULT-RESPONSE field of ADSO- APPLICATION-GLOBAL-RECORD for a default response for the current function. If a default response exists and the user pressed the ENTER key, the runtime system moves the default response to AGR-CURRENT-RESPONSE. If a default response does not exist or if the terminal operator did not press the ENTER key, the runtime system proceeds to Step 4 below.
  4. If a default response does not exist or if the user did not press the ENTER key, the runtime system checks the AGR-AID-BYTE field for the control key pressed by the user. If the control key pressed is associated with a response, the runtime system moves the associated response to AGR- CURRENT-RESPONSE. If the control key pressed is not associated with a response, spaces remain in AGR-CURRENT- RESPONSE.

The following diagram shows how the runtime system establishes the value of AGR-CURRENT-RESPONSE.

Note: When a series of dialogs that are not associated with application functions is executed as an application, the flow of control is directed by the control commands coded in the premap and response processes. The control commands specify, either explicitly or implicitly, the next component to be executed.

Establishing the Value of AGR-CURRENT-RESPONSE

Valid Response

If the response established in AGR-CURRENT-RESPONSE is valid for the current function, the runtime system moves the name of the function associated with the response to the AGR-NEXT-FUNCTION field of ADSO-APPLICATION-GLOBAL-RECORD.

For responses with a security class higher than zero, the runtime system also checks whether the terminal operator has an acceptable security class. If the user does not have an acceptable security class, the current screen is redisplayed with a message indicating that a different response must be selected.

Note: Process code can move values to the AGR-CURRENT-RESPONSE field, overwriting the response selected by the user. The runtime system does not check security for a response moved to the AGR-CURRENT- RESPONSE field in process code. A process code value is executed if it is valid for the current function.

The response moved to AGR-CURRENT-RESPONSE establishes the next function to be executed. The function is not executed, however, until the runtime system satisfies certain criteria. The following diagram shows how the flow of control is directed within an application at runtime.

Application Flow of Control

Notes:

  1. Immediately executable functions are HELP, SIGNON, SIGNOFF.
  2. Message displayed on user's screen:
    UNACCEPTABLE RESPONSE.  PLEASE TRY AGAIN.
    
  3. Inter-dialog control commands are DISPLAY, INVOKE, LEAVE, LINK, RETURN, and TRANSFER.
  4. Message displayed on user's screen:
    INVALID RESPONSE SPECIFIED BY DIALOG PROCESS CODE
    
  5. HDR can be specified only in a dialog associated with a pageable map.

Default Control Key Assignments

At system generation, default control key assignments can be specified for certain formats of the LEAVE and RETURN process commands. By default, PA1 is assigned to LEAVE APPLICATION; CLEAR is assigned to RETURN CLEAR. At runtime, the user can press these keys to perform their associated commands.

Note: For more information on defining default control key assignments, see the discussion of the KEYS statement in the CA IDMS System Generation Guide.

Default control key assignments are overridden by control key assignments specified for application responses and dialog response processes.

More information:

System Records

Control Commands