Retrieval Interfaces

When running an ITP Model data will be retrieved. The Model will ask the DataManager for the data. The DataManager will call the program or function specified in the DID. The program or function will then communicate with the DataManager through calls to functions in the EntryApi DLL. This DLL will communicate with the DataManager to receive parameters and send the retrieved data to it.

Retrievak Interfaces

An Entry program or function must perform the following steps:

  1. Check if the correct version of the EntryApi.Dll is available.
  2. If the Entry has formal parameters, receive them.
  3. Open a communication channel.
  4. Send data on a per-record basis.
  5. Close the channel.

Should an error occur after step 1, this should be reported to ITP.

Example

This example shows a sample entry-program written in pseudo-code. Implementation details depend on the exact programming language used. The parts printed in italics depend on your specific application, setup or environment. You must implement these parts yourself.

EntryProgram
UseLibrary "ITP\ENTRYAPI.DLL"
Function Int ITPAPIR(Int level) As ITPApiLevelRequired
Function Int ITPRCV(Pointer buffer, Int buffer_length) As ITPRcvInputParameterBlock
Function Int ITPOPEN() As ITPOpenOutput
Function Int ITPSND(Pointer buffer, Int buffer_length) As ITPSendData
Function Int ITPERR(Pointer buffer, Int buffer_length) As ITPError
Function Int ITPCLOSE(Int result_code) As ITPCloseOutput
Declare ParameterRecord, ResultRecord, ResultCode
(* Check current version of the entryapi: 3 *)
ResultCode = ITPApiLevelRequired(3);
IsCorrectVersion(ResultCode)
(* Retrieve formal parameter values (key-values) *)
ResultCode = ITPRcvInputParameterBlock(Pointer to ParameterRecord, Length of ParameterRecord)
Errorhandling(ResultCode)
(* Open the output channel to the ITP Datamanager *)
ResultCode = ITPOpenOutput()
Errorhandling(ResultCode)
(* Repeat loop: Retrieving and sending data records. *)
While MoreDataToRetrieve Do
RetrieveData(ParameterRecord)
PutDataIn(ResultRecord)
(* Send the data record to the ITP Datamanager *)
ResultCode = ITPSendData(Pointer to ResultRecord, Length of ResultRecord)
Errorhandling(ResultCode)
End While
(* Close and tell ITP everything is OK (code 0). *)
ITPCloseOutput(0)
Exit
End EntryProgram