OpenTP1 Version 7 Programming Reference C Language

[Contents][Index][Back][Next]

dc_rpc_open - Start an application program

Format

ANSI C, C++

#include <dcrpc.h>
int  dc_rpc_open (DCLONG flags)

K&R C

#include <dcrpc.h>
int  dc_rpc_open (flags)
DCLONGflags;

Description

The function dc_rpc_open() prepares to use the various types of OpenTP1 functions. The function dc_rpc_open() must be called in the main function. Call the function dc_rpc_open() only once in the process.

To initialize in the main function:

  1. Open the entry point for communication between processes.
  2. Acquire shared memory used with OpenTP1.
  3. Post the UAP start to OpenTP1 to request OpenTP1 to supervise processes.
  4. Initialize the OpenTP1 facilities to be used according to the UAP environment settings.

If the transaction attribute is specified in the user service definition, the OpenTP1 transaction service and the process service must be in progress at the node. The function dc_rpc_open() can be called only after OpenTP1 starts normally when the OS starts or after OpenTP1 is started normally by entering the dcstart command. If the function dc_rpc_open() is called before the normal start of OpenTP1, the function returns with the error value DCRPCER_OLTF_NOT_UP. In this case, the function dc_rpc_call() cannot be used.

UAP trace is acquired for all OpenTP1 functions called after the function dc_rpc_open() terminates normally. If the function dc_rpc_open() returns with an error, the UAP trace is not always acquired.

Argument whose value is set in the UAP

flags

Specify DCNOFLAGS.

Return values

Return value Return value (numeric) Explanation
DC_OK 0 Normal termination.
DCRPCER_INVALID_ARGS -301 The value specified for the argument is invalid.
DCRPCER_PROTO -302 The function dc_rpc_open() was called.
DCRPCER_FATAL -303 Initialization was unsuccessful. OpenTP1 functions can no longer be used.
DCRPCER_OLTF_NOT_UP -315 OpenTP1 of the node at which the UAP exists was not executed.
DCRPCER_SEC_INIT -371 An error occurred in initialization of the security environment of the OpenTP1 that used the security facility.
DCRPCER_STANDBY_END -369 The end of standby status was requested for a server in the standby system.

Example

#include <dcrpc.h>
main(){
if(dc_rpc_open(DCNOFLAGS) <0){
  fputs("cannot begin usrserv1",stderr);
goto RPC_CLOSE;
}
if(dc_rpc_mainloop(DCNOFLAGS)<0)
  fputs("cannot begin usrserv1",stderr);
/*The service function is called and executed.*/
/*In the mean time, control does not return to the main function.*/
RPC_CLOSE:
dc_rpc_close(DCNOFLAGS);
}