Enscribe Programmer's Guide

The contents of the inventory file are:
• •
00002 HI-FI 0129.95 00050 A01 TAYLOR
00512 RADIO 0010.98 00022 G10 GRAND
00987 TV SET 0200.00 00122 A76 TAYLOR
02010 TOASTER 0022.50 00000 F22 ACME
03379 CLOCK 0011.75 00512 A32 ZARF
12950 TOASTER 0020.45 00010 C98 SMYTHE
20211 WASHER 0314.29 00005 B44 SOAPY
23167 ANTENNA 0022.50 00008 A01 TAYLOR
32767 IRON 0025.95 00051 A82 HOT
65535 DRYER 0299.50 00022 Z02 SOAPY
partno descr price availqty loc vendor
The sample TAL code shown later in this example finds all of the orders that are more than one
month old and then fills those orders; the code does so in five steps:
1. Using the date alternate-key field, read a record from the order file. The read loop terminates
upon encountering a record whose date field contains a value greater than or equal to a
specified order^limit date.
2. Using the name from the order record, read the appropriate customer record from the customer
file. Using information from both the order record and the customer record, print an order
header consisting of the order number and the customer name and address.
3. Using the order number from the order record, read the associated generic subset from the
order detail file.
4. Each record in the order detail file represents one line item. For each line item in the appropriate
generic subset, use the part number from the order detail record to read and update the
appropriate inventory record in the inventory file; then update the order detail record and
print the line item.
5. After all of the line items for the current order have been processed, update the total field of
the order record to reflect the total price of the order. Using the name from the order record,
update the current balance field in the appropriate customer record. Print the order total.
The sample TAL code is:
! position to beginning of file via date field
compare^len := 0;
CALL KEYPOSITION (order^filenum, key, "DT", compare^len);
order^eof := 0;
WHILE NOT order^eof DO
BEGIN ! reading order file via date field
Accessing Key-Sequenced Files 103