Progress
Version 9
Product Update Bulletin


Example 2 — Running an External Procedure Persistently and One Of Its Internal Procedures

The next example, p-diexm2.p, is a bit more complicated. It does two things:

  1. Dynamically invokes the external procedure persis.p persistently.
  2. Dynamically invokes an internal procedure of persis.p, internal-persis-proc, with an input parameter of type INTEGER with the value 333.
  3. p-diexm2.p
    DEFINE VARIABLE hCall AS HANDLE. 
      
    CREATE CALL hCall. 
    /*invoke persis.p persistently */ 
    hCall:CALL-NAME = "persis.p". 
    /*sets CALL-TYPE to the default/* 
    hCall:CALL-TYPE = PROCEDURE-CALL-TYPE. 
    hCall:PERSISTENT = true. 
    HCall:INVOKE. 
       /* IN-HANDLE is automatically set
          to the handle of the persistent procedure
       */
      
    /* invoke internal-persis-proc in persis.p */ 
    hCall:CALL-NAME = "internal-persis-proc". 
    /*sets CALL-TYPE to the default/* 
    hCall:CALL-TYPE = PROCEDURE-CALL-TYPE. 
    hCall:NUM-PARAMETERS = 1. 
    hCall:SET-PARAMETER( 1, "INTEGER", "INPUT", 333). 
    hCall:INVOKE. 
    /* clean up */ 
    DELETE PROCEDURE hCall:IN-HANDLE. 
    DELETE OBJECT hCall. 
    

In p-diexm2.p, when persis.p is invoked dynamically, the handle of the running persistent procedure is stored in CALL’s IN-HANDLE attribute automatically, Then, when internal-persis-proc is invoked dynamically, Progress knows it resides in the running persistent procedure whose handle is stored in CALL’s IN-HANDLE attribute.

p-diexm2.p also illustrates using a single CALL handle multiple times — in this case, twice. The next example, p-diexm3.p, demonstrates this in more detail.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095