Try OpenEdge Now
skip to main content
Dynamic Call Object
Code examples : Using a call object multiple times
 

Using a call object multiple times

This example further demonstrates using a call object multiple times by:
1. Dynamically invoking the procedure file hello.p with the "CHARACTER" input parameter, string "HELLO WORLD"
2. Dynamically invoking the external procedure persis.p persistently
3. Dynamically invoking an internal procedure of persis.p, internal-persis-proc, with an input parameter of type "INTEGER" and with the value 333
DEFINE VARIABLE hCall AS HANDLE NO-UNDO.

CREATE CALL hCall.

/* Invoke hello.p nonpersistently */
ASSIGN
  hCall:CALL-NAME      = "hello.p"
  /* Set CALL-TYPE to the default */
  hCall:CALL-TYPE      = PROCEDURE-CALL-TYPE
  hCall:NUM-PARAMETERS = 1.

hCall:SET-PARAMETER(1, "CHARACTER", "INPUT", "HELLO WORLD").
hCall:INVOKE( ).

/* Reset the call object handle */
hCall:CLEAR( ).

/* Invoke persis.p persistently */
ASSIGN
  hCall:CALL-NAME  = "persis.p"
  /* Set CALL-TYPE to the default */
  hCall:CALL-TYPE  = PROCEDURE-CALL-TYPE
  hCall:PERSISTENT = TRUE.

hCall:INVOKE.

/* Invoke internal-persis-proc in persis.p */
ASSIGN
  hCall:CALL-NAME      = "internal-persis-proc"
  /* Set 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.
This example resets the call object handle by using the CLEAR( ) method between invoking hello.p (the first invoke) and invoking persis.p (the second invoke).