pub struct Keyed {
pub keying: Keying,
pub last_read: Option<Vec<u8>>,
/* private fields */
}Expand description
An indexed or relative file, or a sequential file opened I-O, held in memory from OPEN to CLOSE. The DD holds the records in key (or record-number) order, as an IDCAMS REPRO unload of a KSDS or RRDS does, and CLOSE writes them back that way when they changed.
Fields§
§keying: Keying§last_read: Option<Vec<u8>>The key of the record the last statement on the file, a successful READ, returned: what a sequential REWRITE or DELETE acts on.
Implementations§
Source§impl Keyed
impl Keyed
pub fn prime_key(&self, record: &[u8]) -> Option<Vec<u8>>
pub fn highest_key(&self) -> Option<&Vec<u8>>
pub fn record(&self, key: &[u8]) -> Option<&Vec<u8>>
Sourcepub fn get(&self, which: usize, value: &[u8]) -> Option<Found>
pub fn get(&self, which: usize, value: &[u8]) -> Option<Found>
The record whose key which is value: for an alternate key, the first of any duplicates.
Sourcepub fn insert(
&mut self,
key: Vec<u8>,
record: Vec<u8>,
) -> Result<bool, &'static str>
pub fn insert( &mut self, key: Vec<u8>, record: Vec<u8>, ) -> Result<bool, &'static str>
Adds a record: Err with status 22 when its prime key, or a unique alternate key, is already there; Ok(true) when it shares an alternate key that allows duplicates (status 02).
Sourcepub fn replace(
&mut self,
key: Vec<u8>,
record: Vec<u8>,
) -> Result<bool, &'static str>
pub fn replace( &mut self, key: Vec<u8>, record: Vec<u8>, ) -> Result<bool, &'static str>
Replaces a record: Err with status 23 when none has its key, 22 as for Keyed::insert.
pub fn remove(&mut self, key: &[u8]) -> Option<Vec<u8>>
Sourcepub fn start(
&mut self,
which: usize,
wanted: Ordering,
or_equal: bool,
value: &[u8],
) -> bool
pub fn start( &mut self, which: usize, wanted: Ordering, or_equal: bool, value: &[u8], ) -> bool
START: positions at the first record whose key which, compared over the length of value
(a longer value is cut to the key’s length), is wanted to value, or equal when
or_equal. False, and no position, when there is none.
Sourcepub fn lose_position(&mut self)
pub fn lose_position(&mut self)
After a READ that found nothing: READ NEXT has no valid next record.
Sourcepub fn read_at(&mut self, which: usize, key: &[u8])
pub fn read_at(&mut self, which: usize, key: &[u8])
Makes the record just read by key which the one READ NEXT goes on from.