Programming Guide



sm_tm_event

Returns the event number for the specified transaction manager event name

#include <tmusubs.h>
int sm_tm_event(char *event_name);

event_name
One of the names in the table of request and event numbers defined in tmusubs.h.

Returns

Description

sm_tm_event returns the event number corresponding to the specified transaction manager event name. As part of its processing, event_name is converted from lower case letters to upper case.

Example

int process_event (event_name, caller_id)
char* event_name, caller_id;
{
int event_num;
if ((event_num = sm_tm_event(event_name)) != 0)
switch (event_num)
{
case TM_SELECT: ...
break;
case TM_PRE_SELECT: ...
break;
case TM_POST_SELECT: ...
break;
...
case TM_NOTE_FAILURE:
case TM_NOTE_UNSUPPORTED:
sm_tm_failure_message(event_num, caller_id,
"Unsupported or failed event");
break;
default:
sm_tm_failure_message(event_num, caller_id,
"Unsupported event");
}
else /* returned '0', event_name unrecognized */
{
char buf[255];
sprintf(buf, "Bad TM event name: %s", event_name);
sm_tm_error(caller_id, buf, "", TM_WARNING);
buf[0]='\0';
}
}