LU 6.2 API Application Programmer's Reference Guide (30294-90008)
159
B Sample Programs
This appendix contains an example LU 6.2 application. The application
in this example enables a clerk in a retail store to check the credit of a
buyer before allowing the buyer to charge a purchase to a credit card.
The retail store has an HP 3000 running LU 6.2 API. The credit
information is stored in a VSAM database on an IBM processor running
CICS. The TP on the HP 3000 calls the MCAllocate intrinsic to allocate
the conversation, and the TP on the IBM processor is started up in
response to the allocate request.
The example TP on the HP 3000 is written in COBOL II and in Pascal.
It performs the following tasks:
1. It calls the TPStarted intrinsic to initialize the TP, and then it calls
the MCAllocate intrinsic to allocate a conversation with the CICS
TP on the IBM processor.
2. It prompts a terminal user for a social security number and name,
and then it reads the data from the terminal.
3. It translates the data to EBCDIC and sends it to the CICS TP on the
IBM processor.
4. It receives a data record from the CICS TP and translates it to
ASCII.
5. It interprets the information in the data record and displays “Credit
Approved” or “Credit Denied” on the terminal screen.
6. It asks the user whether he or she wants to quit. If the user responds
with “Y,” it deallocates the conversation; otherwise, it prompts the
user for another social security number and name.
The example TP on the IBM processor is written in PL/1. It performs
the following tasks:
1. It receives a social security number and name sent by the TP on the
HP 3000.
2. Using the social security number as a key, it searches the VSAM
database for credit information on the buyer.
3. It sends the information from the database to the TP on the
HP 3000, or it reports an error. The remote TP can return any of 3
error codes:
001 — The SS# is not in the database.
002 — The SS# is in the database, but the name does not match the
name sent by the HP 3000.
003 — Miscellaneous system errors.
4. It waits for another data record or a deallocate request from the TP
on the HP 3000.