Server Reference Guide : Designing and Writing OpenROAD Server Applications : OpenROAD Application Requirements : Ghost Frame
 
Share this page                  
Ghost Frame
The starting ghost frame provides an execution context for the procedures invoked through the OpenROAD Server. This frame is not required to do anything, but optionally it can prepare the execution environment by establishing database connections and initializing global variables, possibly based on command line flags that were passed to it.
Note:  Event blocks in the ghost frame will never be executed. An application running under the OpenROAD Server context is driven entirely by synchronous 4GL procedure calls and not by any other kinds of events.
OpenROAD Server StartGhost: Sample Script
The application starting component of an OpenROAD Server application must be a ghost frame. The initialize section of the starting ghost frame is executed once when the image is loaded and prepared by an ASO. There should be no other events in the starting ghost frame; there is no continually running thread within an ASO.
ASOLib must be initialized in your starting ghost frame. This sample script shows how to initialize ASOLib. You can cut and paste it into your application's start ghost frame script.
/*----------------------------------------------------------------------------*/
/*                                                                            */
/* Frame           : ASO Start Ghost frame                                    */
/*                                                                            */
/* Frame Name      : aso_start_ghost_template                                 */
/*                                                                            */
/* System Name     : ASOLib                                                   */
/*                                                                            */
/* Sub-System Name : n/a                                                      */
/*                                                                            */
/* Author          : Ingres Corporation                                       */
/*                                                                            */
/* Date            : dd/mm/yy                                                 */
/*                                                                            */
/* Description     : Example Ghost frame start component for an OR application */
/*                   running under the OpenROAD Server and using ASOLib.      */
/*                                                                            */
/* An application that is to run under the OpenROAD Server MUST have a       */
/* ghost frame defined as its start component.  In addition, an application   */
/* that uses ASOLib must call ASOLibInit from within the GhostFrame start     */
/* component to initialize ASOLib's internal structures.                      */
/*                                                                            */
/* This is an example of such a component.  You can copy it and make it the   */
/* start component of your OpenROAD Server application.                       */
/*                                                                            */
/*                                                                            */
/* Version History                                                            */
/*                                                                            */
/* Version Date     Who   Description                                         */
/* ------- -------- ----- -----------                                         */
/* 1.0     dd/mm/yy ???   Original version.                                   */
/*                                                                            */
/*----------------------------------------------------------------------------*/

INITIALIZE
 (
)=
DECLARE
/*----------------------------------------------------------------------------*/
/* Variables local to this frame and its local procedures                     */
/*----------------------------------------------------------------------------*/

/* none */
/*----------------------------------------------------------------------------*/
/* Procedures local to this frame                                             */
/*----------------------------------------------------------------------------*/

/* none */

ENDDECLARE
/*----------------------------------------------------------------------------*/
/* EVENT: Initialize                                                          */
/*----------------------------------------------------------------------------*/
/* Set an exit trap and initialize the ASO txn control objects                */
/*----------------------------------------------------------------------------*/
BEGIN
    IF CurFrame.SetExitTrap() = 1
    THEN
        CurFrame.Trace ('AppServer application exited abnormally at startup.'
                       +'OSCA.v_msg_txt = ' + OSCA.v_msg_txt
                       +' This message issued from aso_start_ghost ExitTrap');
        RETURN;
    ENDIF;
                                        /*------------------------------------*/
                                        /* Call the ASOLib initialization     */
                                        /* procedure (mandatory if ASOLib is  */
                                        /* being used in an OR Server         */
                                        /* application)                       */
                                        /*------------------------------------*/
 CALLPROC ASOLibInit();
                                        /*------------------------------------*/
                                        /* Call your app-specific             */
                                        /* initialization procedures.         */
                                        /*------------------------------------*/
        /* <<< CALLPROC MyInitProc1();  */
        /* <<< CALLPROC MyInitProc2(); */

END

/*----------------------------------------------------------------------------*/
/* -------------------------- End of Frame Script --------------------------- */
/*----------------------------------------------------------------------------*/
Session Tracing
You can exploit the application session tracing facility of the Server Manager if you put calls to 4GL procedure ASDebug() in your OpenROAD Server application code. When session tracing has been switched on (using the Server Manager), each call to ASDebug will be traced. This can assist greatly with debugging OpenROAD Server applications and can be used to monitor session activity in a production installation.
We recommend that you include a call to ASDebug at the start of every method and 4GL procedure. Multiple calls can be placed in each method or procedure if required. Calls within the same block of code should be distinguished from each other by having a different location number. For example:
Method M1()
BEGIN
    CALLPROC ASDebug(p_ob = CurObject, p_v_method = 'M1');
    ...
    ...
 END
Procedure P1()
BEGIN
    /* procname will be determined from ObjectSource,Name */
    CALLPROC ASDebug(p_ob = CurProcedure);
    ...
    ...
 END
Method BigMethod()
BEGIN
    CALLPROC ASDebug(p_ob = CurObject, p_v_method = 'M1', p_i_locno = 10);
    ...
    ...
    CALLPROC ASDebug(p_ob = CurObject, p_v_method = 'M1', p_i_locno = 20);
    ...
    ...
 END