skip to main content
OpenEdge Development: ADM Reference
Progress Dynamics Call Wrapper : Temp-table types
 
Temp-table types
This section describes the different temp-tables types that you can use to provide call parameters for the setupTTFrom functions. The different temp-table types are:
*Position native data type table.
*Position character table.
*Name native data type table.
*Name character table.
Position native data type table
The Position Native data type table (table type 1), contains a record for each parameter with a sequence number that matches the ordinal position of the parameter in the call. The value of the parameter is stored in one of the value fields in the native data type of the parameter.
Figure A–1 shows the definition of the native position data type table.
 
DEFINE TEMP-TABLE ttCallParam NO-UNDO
  FIELD iParamNo       AS INTEGER
  FIELD cParamName     AS CHARACTER
  FIELD cDataType      AS CHARACTER
  FIELD cIOMode        AS CHARACTER
  FIELD cCharacter     AS CHARACTER
  FIELD tDate          AS DATE
  FIELD lLogical       AS LOGICAL
  FIELD iInteger       AS INTEGER
  FIELD dDecimal       AS DECIMAL
  FIELD aRaw           AS RAW
  FIELD hHandle        AS HANDLE
  FIELD rRowid         AS ROWID
  INDEX pudx IS UNIQUE PRIMARY iParamNo.
Figure A–1: Position native data type table definition
In Example A–7, the following parameters are added to the ttCallParam temp-table:
*A character input parameter with a value of aaa.
*An integer input-output parameter with a value of 12
*A handle output parameter
 
Example A–7: Parameters stored in a position native data type table 
/* Include the temp-table definition */
{src/adm2/calltables.i
  &PARAM-TABLE-TYPE = "1"}
 
/* Create the parameter values into the parameter value table */
  CREATE ttCallParam.
  ASSIGN
    ttCallParam.iParamNo   = 1
    ttCallParam.cDataType  = "CHARACTER"
    ttCallParam.cIOMode    = "INPUT"
    ttCallParam.cCharacter = "aaa"
  .
  CREATE ttCallParam.
  ASSIGN
    ttCallParam.iParamNo   = 2
    ttCallParam.cDataType  = "INTEGER"
    ttCallParam.cIOMode    = "INPUT-OUTPUT"
    ttCallParam.iInteger   = 12
  .
  CREATE ttCallParam.
  ASSIGN
    ttCallParam.iParamNo   = 3
    ttCallParam.cDataType  = "HANDLE"
    ttCallParam.cIOMode    = "OUTPUT"
    ttCallParam.hHandle    = ?
  .
The parameter number specified in iParamNo indicates the order in which the parameters are specified. As a result, a RUN statement using these parameters would look something like the code in Example A–8. Note the order in which the parameters appear.
 
Example A–8: Parameters specified in iParamNo 
DEFINE VARIABLE hHandle AS HANDLE  NO-UNDO.
DEFINE VARIABLE iVal    AS INTEGER NO-UNDO.
 
ASSIGN
  iVal    = 12
  hHandle = ?.
 
RUN x.p (INPUT "aaa", INPUT-OUTPUT iVal, OUTPUT hHandle).
Position character table
The Position Character table (table type 2), provides the ordinal position of the parameter and stores the parameter value in a character field. As with the position native data type table, the ordinal position of the parameter is important.
Figure A–2 shows the definition of the position character type temp-table.
 
DEFINE TEMP-TABLE ttCallParam NO-UNDO
  FIELD iParamNo       AS INTEGER
  FIELD cParamName     AS CHARACTER
  FIELD cDataType      AS CHARACTER
  FIELD cIOMode        AS CHARACTER
  FIELD cValue         AS CHARACTER
  INDEX pudx IS UNIQUE PRIMARY iParamNo.
Figure A–2: Position character table type definition
The code in Example A–9 illustrates how to set up the same set of parameters as those in Example A–7 for the position native data type table.
 
Example A–9: Parameters stored in a position character table type 
/* Include the temp-table definition */
{src/adm2/calltables.i
  &PARAM-TABLE-TYPE = "2"}
 
/* Create the parameter values into the parameter value table */
  CREATE ttCallParam.
  ASSIGN
    ttCallParam.iParamNo   = 1
    ttCallParam.cDataType  = "CHARACTER"
    ttCallParam.cIOMode    = "INPUT"
    ttCallParam.cValue     = "aaa"
  .
  CREATE ttCallParam.
  ASSIGN
    ttCallParam.iParamNo   = 2
    ttCallParam.cDataType  = "INTEGER"
    ttCallParam.cIOMode    = "INPUT-OUTPUT"
    ttCallParam.cValue     = "12"
  .
  CREATE ttCallParam.
  ASSIGN
    ttCallParam.iParamNo   = 3
    ttCallParam.cDataType  = "HANDLE"
    ttCallParam.cIOMode    = "OUTPUT"
    ttCallParam.cValue     = ?
  .
The conversion to the appropriate data type is done when the dynamic temp-table structure is built from this table.
Name native data type table
With a Name Native data type table (table type 3), the caller needs to know what the name of the parameter is that is being set. This temp-table type requires the use of the setupTTFromSig call to build the temp-table required to make the call.
Figure A–3 shows the definition of the Name native data type temp-table.
 
DEFINE TEMP-TABLE ttCallParam NO-UNDO
  FIELD cParamName     AS CHARACTER
  FIELD cCharacter     AS CHARACTER
  FIELD tDate          AS DATE
  FIELD lLogical       AS LOGICAL
  FIELD iInteger       AS INTEGER
  FIELD dDecimal       AS DECIMAL
  FIELD aRaw           AS RAW
  FIELD hHandle        AS HANDLE
  FIELD rRowid         AS ROWID
  INDEX pudx IS UNIQUE PRIMARY cParamName.
Figure A–3: Name native data type table definition
The code in Example A–10 illustrates how to set up a Name native data type table (table type 3).
 
Example A–10: Name native data type table 
/* Include the temp-table definition */
{src/adm2/calltables.i
  &PARAM-TABLE-TYPE = "3"}
 
/* Create the parameter values into the parameter value table */
  CREATE ttCallParam.
  ASSIGN
    ttCallParam.cParamName = "pcChar"
    ttCallParam.cCharacter = "aaa"
  .
  CREATE ttCallParam.
  ASSIGN
    ttCallParam.cParamName = "piInt"
    ttCallParam.iInteger   = 12
  .
  CREATE ttCallParam.
  ASSIGN
    ttCallParam.cParamName = "phHndl"
    ttCallParam.hHandle    = ?
  .
Note: There is no need to specify the mode or data type of the parameter as these are derived from the signature of the call and placed in the appropriate field. However, when using this table type, the value of the parameter being set must be set in the correct data type field, otherwise the value is never retrieved.
Name character table
The Name Character table (table type 4) is similar to the Name native data type table. However, in the Name character table, the value of the parameter is provided in character format rather than in the native data type. Example A–11 illustrates the definition of the Name Character table.
 
Example A–11: Name character table definition 
DEFINE TEMP-TABLE ttCallParam NO-UNDO
  FIELD cParamName     AS CHARACTER
  FIELD cValue         AS CHARACTER
  INDEX pudx IS UNIQUE PRIMARY cParamName.
 
/* This example illustrates setting up data in the name character table type.
   Include the temp-table definition. */
{src/adm2/calltables.i
  &PARAM-TABLE-TYPE = "4"}
 
/* Create the parameter values into the parameter value table */
  CREATE ttCallParam.
  ASSIGN
    ttCallParam.cParamName = "pcChar"
    ttCallParam.cValue     = "aaa"
  .
  CREATE ttCallParam.
  ASSIGN
    ttCallParam.cParamName = "piInt"
    ttCallParam.cValue     = "12"
  .
  CREATE ttCallParam.
  ASSIGN
    ttCallParam.cParamName = "phHndl"
    ttCallParam.cValue     = ?
  .