This example shows an entry Customer.
Model
This is the entry as it can be used in a Model Document.
WITH Customer IN DID.Customer
DO
…
OD
DID
This is the definition entry in the DID Document. The entry definition assumes that the C code is implemented in a DLL called example.dll.
DEFINE_ENTRY
NAME Customer
MODEL_DOC_STATEMENT WITH
DATA_RETRIEVAL "Customer@Example.dll"
KEY_RETRIEVAL "*NONE"
CALLING_CONVENTION DLL32
DEFINE_PARAMETERS
Customer_number NUMERICAL ( 9 0)
END_DEFINE_PARAMETERS
DEFINE_FIELDS
Customer_number NUMERICAL ( 9 0)
Surname C_CHAR (31 )
First_name C_CHAR (31 )
Initials C_CHAR (11 )
Date_of_birth NUMERICAL (11 0)
Date_of_death NUMERICAL (11 0)
Gender C_CHAR ( 2 )
Marital_state C_CHAR ( 2 )
Partner_number NUMERICAL ( 9 0)
END_DEFINE_FIELDS
END_DEFINE_ENTRY (* Customer *)
C Program
This is the C-Code for a data retrieval program for the Customer entry. This C-Code is generated by the C-Code wizard. You must insert your own code to retrieve the contents of the result fields at the comment Fill variable(s).
/*
* Function: Customer
*/
#include "itpentry.h"
#include "itpcnv.h"
#ifdef __cplusplus
extern "C" {
int __stdcall _export Customer(void);
}
#endif
int __stdcall _export Customer(void){
int rc;
/* Input definition */
unsigned char InputRecord[1+1+9];
int Customernumber;
/* Output definition */
unsigned char OutputRecord[117];
int Customernumber;
unsigned char Surname[31 + 1];
unsigned char Firstname[31 + 1];
unsigned char Initials[11 + 1];
int Dateofbirth;
int Dateofdeath;
unsigned char Gender[2 + 1];
unsigned char Maritalstate[2 + 1];
int Partnernumber;
/* Initialize entryapi */
APICALL(ITPAPIR(3));
/* Read input parameter block */
APICALL(ITPRCV(InputRecord, sizeof(InputRecord)));
Customernumber = GetNumericalField(InputRecord+2, 9);
/* Prepare for sending output to ITP */
APICALL(ITPOPEN());
/* Prepare and send output (record(s)) to ITP */
..... /* Fill variable(s) */
PutNumericalField(OutputRecord + 0, Customernumber);
PutTextField(OutputRecord + 9, Surname, 31);
PutTextField(OutputRecord + 40, Firstname, 31);
PutTextField(OutputRecord + 71, Initials, 11);
PutNumericalField(OutputRecord + 82, Dateofbirth);
PutNumericalField(OutputRecord + 93, Dateofdeath);
PutTextField(OutputRecord + 104, Gender, 2);
PutTextField(OutputRecord + 106, Maritalstate, 2);
PutNumericalField(OutputRecord + 108, Partnernumber);
APICALL(ITPSND(OutputRecord, sizeof(OutputRecord)));
/* Close and return to ITP */
APICALL(ITPCLOSE(0));
return 0;
}