Chapter 13. Scenario 2: Using Debug Tool 393
13.2.3 Listing shares
If the field, TR-REQUEST-TYPE, contains the value, SHARE_vaLUE, the program uses
the value in the TR-CUSTOMER-NAME field to print a report that lists the shares held
by that customer in each company the customer owns.
A typical report is shown in Example 13-3.
Example 13-3 Batch Trader application List Shares Report
CUSTOMER : RB_DEMO 09/30/2002
-----------------------------------------------------------------
COMPANY SHARES SHARE TOTAL
HELD vaLUE COST
-----------------------------------------------------------------
Glass_and_Luget_plc 120 19.00 2,280.00
IBM 1890 163.00 308,070.00
Veck_Transport 925 36.00 33,300.00
13.2.4 Buying shares
If the field, TR-REQUEST-TYPE, contains the value, BUY_SELL, and the field,
TR-SUB-TYPE, contains a value of 1, the program processes a request to buy the
number of shares in TR-NO-OF-SHARES.
After the process completes successfully, the program updates the Customer
file, DEMOS.PDPAK.CUSTFILE.
The program also produces a transaction report, as shown in Example 13-4. This
report lists the transaction file input request and the status of the processing. The
STATUS column in the report lists how the request was processed. If the
processing is successful, the message PROCESSED is printed, otherwise the
message *ERROR* is printed.
Example 13-4 Batch Trader application Transaction report listing BUY shares
----------------------------------------------------------------------------
CUSTOMER COMPANY QTY REQ-TYP STATUS
----------------------------------------------------------------------------
RB_DEMO IBM 30 BUY PROCESSED
RB_DEMO Veck_Transport 25 BUY PROCESSED
13.2.5 Selling shares
If the field, TR-REQUEST-TYPE, contains the value, BUY_SELL, and the field,
TR-SUB-TYPE, contains a value of 2, the program processes a request to sell the
number of shares in TR-NO-OF-SHARES.