Generating Unique Device Names

Some protocols, such as APPC, require a unique device name for each terminal that logs on to the system. Using the runtime settings, you can specify that the TE_connect function generate a unique 8-character device name for each Vuser, and connect using this name. Although this solves the requirement for uniqueness, some systems have an additional requirement: The device names must conform to a specific format. See Runtime Settings Overview for more information.

To define the format of the device names that the TE_connect function uses to connect a Vuser to the system, add an RteGenerateDeviceName function to the Vuser script. The function has the following prototype:

void RteGenerateDeviceName(char buf[32])

The device name should be written into buf.

If an RteGenerateDeviceName function exists in a Vuser script, the Vuser calls the function each time a new device name is needed. If no RteGenerateDeviceName function is defined in the script—and unique device names are required—the TE_connect function generates the required names.

In the following example, the RteGenerateDeviceName function generates unique device names with the format "TERMx". The first name is TERM0, followed by TERM1, TERM2, and so forth.

RteGenerateDeviceName(char buf[32])
    static int n=0;
    sprintf(buf, "TERM%d", n);