The following functions are used to initialize DynaDIPs.
VSstartup
VSstartup is called once to post a process, like a DIP, to the BB. It also sets up the trace facility. VSstartup takes the DIP name, its instance, and a DIP flag. DIP flag can take one of two values, constants DIP_PROC or NONDIP_PROC. Setting the flag to the constant DIP_PROC allows the DIP to send and receive messages to and from TSM scripts. If the flag is set to the constant NONDIP_PROC, messages sent by the DIP to TSM scripts are ignored by TSM. An assigned IPC message Qkey is returned if successful as in VSstartup Input and Output. A negative value is returned if an error occurs.
The DIP name should be a unique printable name of up to 15 characters.
Note:
Any application-dependent initialization, such as opening files, should be included.
The following example shows the VSstartup synopsis in C-code for the dynamic DIP.
#include <sys/types.h>
#include "VS.h"
key_t VSstartup(dipName,instance,flag)
char *dipName; /* unique name associated with process */
short instance; /* process instance */
long flag; /* Will DIP talk to TSM scripts? */
Note:
Normally, a system that has a significant number of channels will take time to reach the inserv state for all channels due to the diagnostics that are run on the channels at startup. If this is the case with your system and the DIP depends on all channels being in service, you may consider delaying the initialization of the DIP by adding a sleep instruction prior to VSstartup or other initialization processes.
VStoqkey and VStoname
After posting themselves in the BB using VSstartup, DynaDIPs must retrieve the Qkeys of all other user-defined DIPs to which they send or receive messages. The function VStoqkey converts DIP names to their assigned Qkeys and the function VStoname converts Qkeys to DIP names.
The following is an example of the VStoqkey Synopsis in C-code for the dynamic DIP.
#include <sys/types.h>
#include "VS.h"
key_t VStoqkey(dipName)
char *dipName; /* unique name associated with process */
The following is an example of the VStoname Synopsis in C-code for the dynamic DIP.
#include <sys/types.h>
#include "VS.h"
char *VStoname(Qkey)
key_t Qkey; /* message queue key */
VSerror
VSstartup and VStoqkey may return zero or a negative value when an error occurs. At this point, VSerror can be called to retrieve a text description of the error. VSerror is passed the error value and returns a character string describing the error so that a DIP can log or display the error. The following is an example of the VSerror Synopsis written in C-code for the DIP.
#include <sys/types.h>
#include "VS.h"
char *VSerror (errid)
int errid; /* negative error value */