Pathmaker Programming Guide

Modifying Requesters
Advanced Pathmaker Programming Topics
9–12 067868 Tandem Computers Incorporated
Example of a Requester Copy Library
Figure 9-1 is an example of one way you can modify your requester. This sample copy
library fragment is for an application that processes accounts. For this application:
Function key F4 invokes a service that reads an account record.
Function key F5 invokes a service that updates an account record.
UPDATE-COUNT is a display-only field that shows the number of updates
executed in the current session.
Figure 9-1. Requester Copy Library Sample Code
?SECTION USER-WS , TANDEM
01 SAVE-ACCOUNT-NUM PIC 9(6) VALUE ZEROS.
01 ERROR-MSG-1 PIC X(76)
VALUE “No account to update”.
01 ERROR-MSG-2 PIC X(76)
VALUE ”Account number cannot be changed prior to update”.
?SECTION USER-PRE-F4 , TANDEM
?SECTION USER-POST-F4 , TANDEM
*
* Save the account number after READ to prevent the user
* from changing it during update.
*
MOVE ACCOUNT-NUM OF ACCOUNT-INFO TO SAVE-ACCOUNT-NUM.
?SECTION USER-PRE-F5 , TANDEM
IF SAVE-ACCOUNT-NUM EQUAL ZEROS
MOVE ERROR-MSG-1 TO T9154-ADVISORY-MSG-TEXT
MOVE “E” TO T9154-ADVISORY-MSG-SEVERITY
MOVE “Y” TO T9154-USER-ERROR-SW
ELSE IF ACCOUNT-NUM OF ACCOUNT-INFO
NOT EQUAL SAVE-ACCOUNT-NUM
MOVE ERROR-MSG-2 TO T9154-ADVISORY-MSG-TEXT
MOVE “E” TO T9154-ADVISORY-MSG-SEVERITY
MOVE “Y” TO T9154-USER-ERROR-SW.
?SECTION USER-POST-F5 , TANDEM
*
* Keep track of the number of accounts updated.
*
IF T9154-ADVISORY-MSG-SEVERITY NOT EQUAL “E”
ADD 1 TO UPDATE-COUNT-1 OF UPDATE-COUNT.