HP-UX SNAplus2 R7 LUA Programmer's Guide

Sample LUA Application
Testing the Application
6.2.1 Host Requirements
To run the sample application, you will need an LU on the host computer. Because the sample application is
emulating a 3270 display terminal, the LU must be congured at the host as a 3270 display LU (LU type 2) such
as 3278 or 3279. The LU number assigned at the host must be used when conguring the LU on SNAplus2.
6.2.2 Conguration for the Sample Application
SNAplus2 must be congured to include the required LU. This task is usually performed by the System
Administrator. The following components are required:
A DLC, port, and LS
An LU of type 03, with an LU number which matches that of a suitable LU on the host
These components can be given any names you wish; the only information required by the application is the LU to
be used for the session. This is passed to the application as a single command-line parameter (the LU name), or as
two command-line parameters (the PU name and LU number). The following items also apply to LU conguration:
The LU number congured for this LU in the SNAplus2 conguration must match the LU number assigned at
the host.
You can congure an LU pool for use with the application, containing one or more LUs. To access the pool,
you can then supply either the name of the pool or the name of any LU within it; the rst available LU from
the pool will be used.
6.2.3 Compiling and Linking the Sample Application
To compile and link the program, take the following steps.
1. Copy the les lsample.c and Makefile from the directory /opt/sna/samples to a private directory.
2. In the private directory, type the following command:
make lsample
On a 64bit computer, use the following command:
make lsample_64
6.2.4 Running the Sample Application
This section assumes you have compiled and linked the sample application as described in Section 6.2.3, Compiling
and Linking the Sample Application.
The sample application uses the CSV interface as well as LUA; it includes calls to the CSV CONVERT verb to
translate user-supplied data from ASCII to EBCDIC before sending it to the host, and to translate data received from
the host into ASCII before displaying it on the screen. This translation uses a user-dened translation table (Table
G), which is stored in a le on the SNAplus2 computer. A suitable le, /opt/sna/samples/luatblg.dat,
is supplied with the LUA sample application program source.
To run the sample application, follow these steps:
1. Ensure that the SNAplus2 software is started, and that the LS to the host is active; contact your System
Administrator if necessary.
2. Set the environment variable SNATBLG to the name of the le containing the Table G translation table. Include
the full path of the le if it is not in the current directory.
3. Start the application by entering one of the following commands:
lsample luname
152