Enscribe Programmer's Guide
name address region curbal limit
ADAMS
BROWN, A
BROWN, B
EVANS
HARTLEY
HEATHCLIFF
KOTTER
RICHARDS
ROGERS
SANFORD
SMITH
MIAMI, FL
REEDLEY, CA
BOSTON, MA
BUTTE, MT
CHICAGO, IL
PORTLAND, OR
NEW YORK, NY
MINNEAPOLIS, MN
BOISE, ID
LOS ANGELES, CA
DAYTON, OH
SO
WE
EA
WE
NO
WE
EA
NO
WE
WE
NO
0000.00
0256.95
0301.00
0010.00
0433.29
0000.00
0089.00
0000.00
1024.00
0301.00
0010.00
0500.00
0300.00
1000.00
0100.00
0500.00
0500.00
0500.00
0500.00
1500.00
1000.00
0500.00
Inserted
JONES
DALLAS, TX SO 1234.56 2000.00
Example 8: Random Update
This example shows how to select a single data record and then change the content of one of the
fields in that record.
The KEYPOSITION call sets the current position at the record that contains the value HARTLEY in
the primary-key field. The READUPDATE call reads the data record into the application buffer
without altering the file pointers.
! blank the key
key ':=' " ";
key[1] ':=' key FOR name^len - 1 BYTES;
key ':=' "HARTLEY";
CALL KEYPOSITION (cust^filenum, key);
IF <> THEN ...
CALL READUPDATE (cust^filenum, cust^rec, $LEN(cust^rec) );
IF <> THEN ...
The data record read from the disk file into the application buffer is:
HARTLEY CHICAGO, IL NO 0433.29 0500.00
This sample TAL code changes the value in the current balance field of the record in the application
buffer and then writes the updated record from the buffer to the disk without altering the file pointers.
:
cust^rec.cust^curbal := cust^rec.cust^curbal + 30.00F
:
CALL WRITEUPDATE (cust^filenum, cust^rec, $LEN(cust^rec) );
IF <> THEN ...
96 Key-Sequenced Files