USEREXITNAME64

The 64bit CONNX Data Server user exit is currently available only for Adabas and C-ISAM.

 

For example -

 

On windows:

USEREXITNAME64 = e:\mydir\myuserexit.dll

On unix:

USEREXITNAME64 = /home/mydir/myuserexit.sl

 

 

 

The specified load module must export a public "C" function called "UserExitFunc"

The function must have the following signature:

For Adabas:

int  UserExitFunc(unsigned int threadid,
const char *userid,
const char * clientid,
void * AdabasControlBlock,
void * szFormatBuffer,
void * szRecordBuffer,  
void *szSearchBuffer,
void *szValueBuffer,
void *szISNBuffer,
int nPrePost );
 

For C-ISAM:

enum CNXUSEREXITFLAGS

{

   CNX_USEREXIT_NONE = 0x00,

   CNX_USEREXIT_PRECALL = 0x01,

   CNX_USEREXIT_POSTCALL= 0x02

};

enum CNXUSEROPERATIONS

{

   CNX_USEREXIT_UPDATE = 0x01,

   CNX_USEREXIT_DELETE = 0x02,

   CNX_USEREXIT_INSERT = 0x04

};

int UserExitFunc(const char *userid,
const char* szFileName,
CNXUSEROPERATIONS nOperation,
CNXUSEREXITFLAGS flags,
const void * uniqueID,
const void * recordnumber,
const void * szRecord,
int nRecordLength);

 

For Adabas the exit will be called either pre or post direct call based on the setting of the USEREXITFLAGS setting.

 

For C-ISAM

CONNX will call this function under the following circumstances:

1) When a record is inserted, the function is called after the insert has been successful.

2) When a record is updated, the function is called twice, once before the update, once after the update.

3) When a record is deleted, the function is called once after the delete is successful

 

Sample exit for Adabas:

#include "stdafx.h"

#include <stdio.h>

#include <stdlib.h>

#pragma pack(1)

typedef struct _ADABASCONTROLBLOCK

{

char cb_cmd_res[2]; // Reserved

char cb_cmd_code[2]; // Command Code

char cb_cmd_id[4]; // COMMAND ID

#if defined (CNX_LITTLE_ENDIAN)

char cb_file_nr; // File#

char cb_db_id; // Database Number

#else

char cb_db_id; // Database Number

char cb_file_nr; // File#

#endif

    //short cb_file_nr;

short cb_return_code;

int cb_isn;

int cb_isn_l1;

int cb_isn_quantity;

unsigned short cb_fmt_buf_lng;

unsigned short cb_rec_buf_lng;

unsigned short cb_sea_buf_lng;

unsigned short cb_val_buf_lng;

unsigned short cb_isn_buf_lng;

char cb_cop1;

char cb_cop2;

char cb_add1[8];

char cb_add2[4];

char cb_add3[8];

char cb_add4[8];

char cb_add5[8];

int cb_cmd_time;

char cb_user_area[4];

//

} ADABASCONTROLBLOCK;

#pragma pack()

// This is an example of an exported function.

extern "C" __declspec(dllexport) int UserExitFunc(unsigned int threadid, const char *userid, const char * clientid, void * AdabasControlBlock, void * szFormatBuffer, void * szRecordBuffer,  void *szSearchBuffer, void *szValueBuffer, void *szISNBuffer, int nPrePost )

{

FILE * fp;

fp = fopen("c:\\adaexit.log", "a+");

if (fp)

{

ADABASCONTROLBLOCK * pBlock = (ADABASCONTROLBLOCK *)AdabasControlBlock;

fprintf(fp, "thread (%d), user(%s), clientid(%s), adabas command(%2.2s)\n", threadid, userid, clientid, pBlock->cb_cmd_code);

fclose(fp);

}

 

return 0;

}

 

Sample exit for CISAM:

#include "stdafx.h"

#include "stdio.h"

extern "C" __declspec(dllexport) int UserExitFunc(const char *userid, const char* szFileName, int nOperation, int flags, const void * uniqueID, const void * recordnumber, const void * szRecord, int nRecordLength)

{

FILE * fp;

fp = fopen("c:\\cisamexit.log", "a+");

if (fp)

{

fprintf(fp, "user(%s), filename(%s), operation(%d), flag(%d) record(%-*.*s)\n", userid, szFileName, nOperation, flags,  nRecordLength, nRecordLength, szRecord);

fclose(fp);

}

return 0;

}

 

 

Default = blank

 

Environments: Client, Windows, Unix

Configuration Manager: CONNX Settings; Current Key = CONNX\ADABAS or CONNX\CISAM; Key Value/Value Name =  USEREXITNAME64

Unix Environment Variable :  USEREXITNAME64