lrt_gettpurcode
| Error Processing Functions |
Retrieves the application return code.
long lrt_gettpurcode( void );
The lrt_gettpurcode function retrieves the global application return code variable (tpurcode) set by the last call to lrt_tpgetrply, lrt_tpcall, lrt_tprecv or lrt_tpdequeue. The tpurcode will also contain the value of the "user-return code" sent with lrt_tpenqueue, where specified.
In multi-tasking environments tpurcode is independent for each task.
Return Values
If the function succeeds, it returns the error code for the last ATMI routine performed by this task.
Parameterization
Parameterization is not applicable to this function.
Example
In the following example data is put on a queue with an application defined user code, the code is read, and the message is taken off the queue.
TPQCTL qCtrl; /* Control structure needed to reference item on queue */
long myAppcURCode; /* Application defined return code */
long myRecovedURCode; /* To read the UR Code */
int rc; /* return code */
char * myQSpace; /* Name of queue space */
char * myQName; /* Name of queue */
char * myDataPtr; /* The data */
long myDataLen; /* Length */
myQSpace = "qspace";
myQName = "qname";
myDataPtr = lrt_tpalloc("STRING", "", 100);
strcpy(myDataPtr, "theData");
myAppcURCode = 100;
/* Put an application defined user code in the control structure */
qCtrl.urcode = myAppcURCode;
/* Put the data and control structure on a queue */
rc = lrt_tpenqueue( myQSpace,
myQName,
&qCtrl,
myDataPtr,
myDataLen,
TPNOTRAN);
/* Recover the application defined user code */
myRecovedURCode = lrt_gettpurcode ();
/* Take the message off the queue by using the same control structure */
rc = lrt_tpdequeue( myQSpace,
myQName,
&qCtrl,
&myDataPtr,
&myDataLen,
TPNOTRAN );

