Previous Page Contents Page Next Page

6 Sample Transaction Programs

The SNAP-IX APPC sample transaction programs (TPs) illustrate the use of APPC verbs in a mapped conversation.

The programs are provided with SNAP-IX as asample1.c and asample2.c, in the directory /opt/sna/samples.

The following information is provided in this chapter:

6.1 Processing Overview

The TPs presented in this chapter enable a user to browse through a file on another system. The user is presented with a single data block at a time, in hexadecimal and character format. After each block, a user can request the next block, request the previous block, or quit.

asample1 (the invoking TP) sends a file name to asample2 (the invoked TP). If asample2 locates the file, it returns the first data block to asample1; otherwise, it deallocates the conversation and ends.

If asample1 receives a block, it displays the block on the screen and waits for the user to enter F for forward, B for backward, or Q for quit. If the user selects forward or backward, asample1 sends the request to asample2, which in turn sends the appropriate block. This process continues until the user selects the quit option, at which time asample1 deallocates the conversation and both programs end.

If the user asks for the next block and asample2 has sent the last one, asample2 wraps to the beginning of file. Similarly, asample2 wraps to send the last block if the user requests the previous one and the first block is displayed.

Neither program attempts to recover from errors. A bad return code from APPC causes the program to terminate with an explanatory message.

Previous Page Contents Page Top of Page Next page