STORE
Store a record to an ISAM file
WTSupported in traditional Synergy on Windows
|
WNSupported in Synergy .NET on Windows
|
USupported on UNIX
|
VSupported on OpenVMS
|
STORE(channel, data_area[, GETRFA:new_rfa][, LOCK:lock_spec]) [[error_list]]
Arguments
channel
The number of the channel on which the ISAM file is open in update mode (U:I). (n)
data_area
The variable containing the record to be added. (a)
GETRFA
(optional) Returns the record’s RFA. See GETRFA for a complete description.
LOCK
(optional) Specifies whether a manual lock is applied. Automatic locking is not supported for STORE. See LOCK for a complete description.
error_list
(optional) An I/O error list. If any one of the specified errors occurs as part of the STORE, control is transferred to the associated label.
Discussion
The STORE statement stores or adds a record to an ISAM file. This statement is used exclusively with ISAM files.
Once it is determined that the STORE is valid, the appropriate indexes are updated and the data is added. If the data area is longer than the defined maximum length of a record in the ISAM file, an “Invalid record size” error ($ERR_IRCSIZ) occurs and no data is transferred to the file.
On a STORE operation, all indexes have the new record’s key values inserted, unless a key is null according to the definition of the key. See ISAMC. STORE ensures that new key values are unique for keys that don’t allow duplicates. If a duplicate key is encountered, a “Duplicate key specified” error ($ERR_NODUPS) occurs.
STORE does not change the sequential context of the file for this channel. A READS following a STORE returns the record following the last READ or FIND. By default, the newly inserted record is not locked after the STORE.
Caching records to improve performance with xfServer
To improve output performance, especially when multiple records are being stored at a time, you can enable buffering by opening the file with the OPTIONS=/bufstore option. This can improve performance considerably.
See also
Input and output statement qualifiers
Examples
The following subroutine gets new client information and stores it in an ISAM file.
subroutine getinfo a_sts ,d1 ;Returned with TRUE (successful), ;or FALSE (error) record customer last_name ,a20 first_name ,a20 crdt_limit ,a6 crdt_type ,a2 proc a_sts = %true display(TTCHN, $scr_clr(screen), $scr_pos(5, 10),"Last name: ") reads(TTCHN, last_name, done) display(TTCHN, $scr_pos(7, 10), "First name: ") reads(TTCHN, first_name, done) display(TTCHN, $scr_pos(9, 10), "Credit limit: ") reads(TTCHN, crdt_limit, done) display(TTCHN, $scr_pos(11, 10), "Credit type: ") reads(TTCHN, crdt_type, done) store(ISMCHN, customer) xreturn done, a_sts = %false xreturn endsubroutine