HP-UX SNAplus2 R7 APPC Programmer's Guide
Sample Transaction Programs
Testing the TPs
get user prompt (F, B, or Q)
if prompt = F or B /* Not Q */
mc_send_data (data = prompt), send type p_to_r_flush
endif
endif
end do
mc_deallocate
TP_ended
6.2.2 asample2 (Invoked TP)
The pseudocode for asample2 (the invoked TP) is as follows:
receive_allocate
do while conversing
mc_receive_and_wait (return status with data)
if data received and send indication received
if first time (data = filename)
open file
if file not found
mc_deallocate
set conversing false
endif
else (data = prompt)
read and store prompt
endif
if (conversing)
read file block
mc_send_data (file block)
endif
else if deallocate received
set conversing false
endif
end while conversing
close file
tp_ended
6.3 Testing the TPs
After examining the source code for the two programs, you may want to test the programs.
Although APPC is normally used for communications between a local and a remote computer, you may find it
convenient to run both TPs on the same SNAplus2 computer for testing purposes.
To compile and link the TPs for a HP-UX system, take the following steps.
1. Copy the three files asample1.c, asample2.c, and Makefile from the directory /opt/sna/samples
to a private directory.
2. In the private directory, type the following commands:
make asample1
make asample2
On a 64–bit computer, use the following commands:
make asample1_64
make asample2_64
268