| United States-English |
|
|
|
![]() |
Using KSAM XL and KSAM 64: 900 Series HP 3000 Computer Systems > Appendix B BASIC/V IntrinsicsBKWRITE |
|
Writes data from a BASIC program to a KSAM file.
A call to procedure BKWRITE writes a record to a KSAM file from a BASIC program. This call provides the only way to create a KSAM record from a BASIC program. The file must have been opened with an access mode that allows writing. If access is shared, the file also must be opened for dynamic locking (lock = 1), and the file locked with BKLOCK before any records are written.
After calling BKWRITE, you should always check the status parameter to ensure that the write was successful. Upon successful completion of BKWRITE, one record containing the values specified in parameterlist is written to the opened KSAM file. Two parameters that are set when the file is opened affect how BKWRITE operates. These are the access and sequence parameters. In order to write to a file, the file must be opened with access greater than 0. If the access parameter is set to 1, all existing data in the file is cleared before the first record is written to the file. If access is set to 2 or greater, the first record written by BKWRITE immediately follows any existing records; the file is not cleared. The sequence parameter determines whether records must be written in primary key sequence, or not. If sequence is 0, records can be written in any order; no check is made on the sequence of the primary key field. If sequence is set to 1, you must write each record with a value in the primary key field that is greater than the primary key value in the previous record. Primary key values may equal the previous primary key value only if the file was created with duplicate key values permitted.
Figure B-13 “Writing to a KSAM File with BKWRITE” is an example of writing one string and one integer array to each record of the KSAM file. Figure B-13 Writing to a KSAM File with BKWRITE
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||