Progress
Version 9
Product Update Bulletin


Example 6 — Driving a Series Of Dynamic Invokes From a TEMP-TABLE

Example p-diexm6.p drives a series of dynamic invokes from a temp-table.

p-diexm6.p
/*suppose hRuntt is a temp-table that has one record with the 
following fields: 
   parm_1 
   parm_2 
   ... 
   parm_n 
   run-name 
   nparms 
   datatypes, extent nparms 
   iomodes, extent nparms 
*/ 
DEFINE INPUT PARAMETER TABLE-HANDLE hRuntt. 
DEFINE VARIABLE hDtypes  AS HANDLE. 
DEFINE VARIABLE hIOmodes AS HANDLE. 
DEFINE VARIABLE hCall    AS HANDLE. 
DEFINE VARIABLE i        AS INTEGER. 
hDtypes  = hRuntt:BUFFER-FIELD("datatypes"). 
hIOmodes = hRuntt:BUFFER-FIELD("iOmodes"). 
hRuntt:FIND-FIRST. 
CREATE CALL hCall. 
hCall:CALL-NAME = hRuntt:BUFFER-FIELD("run-name"):BUFFER-VALUE. 
hCall:NUM-PARAMETERS = hRuntt:BUFFER-FIELD("nparms"):BUFFER-VALUE. 
FOR i = 1 to hCall:NUM-PARAMETERS. 
    hCall:SET-PARAMETER( i, 
			     hDtypes:BUFFER-VALUE(i), 
			     hIOmodes:BUFFER-VALUE(i), 
			     hRuntt:BUFFER-FIELD(i):BUFFER-VALUE). 
END. 
hCall:INVOKE. 
DELETE OBJECT hCall. 
/* if there are output parms,
   get the values from hRuntt:BUFFER-FIELD(i) 

The idea behind Example p-diexm6.p involves the following tasks:

  1. Defining a temp-table record structure where each field represents one data item involved in dynamic invoke
  2. Loading the temp-table with a row of data for each dynamic invoke to be performed
  3. Reading the temp-table, performing a dynamic invoke for every record

Setting up a temp-table like this lets an application perform any number of dynamic invokes on the fly.


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