READLAST, READLASTLK


 

The READLAST instruction retrieves information from disk and transfers that information into data variables. It is exactly like the AAM READ instruction except that the READ instruction returns the first matching record, whereas READLAST returns the last matching record. The instruction uses the following formats:

 

(1)

[label]

READLAST

{afile},{key};{list}[;]

(2)

[label]

READLASTLK

{afile},{key};{list}[;]

 

Where:

label

Optional. A Program Execution Label.

afile

Required. A previously defined and opened AFILE variable from which data is read.

key

Required. One or more previously defined Character String Variables, Numeric Variables, or VARLISTs of string or numeric variables that select the record to read.

list

Optional. Any combination of previously defined Character String Variables, or Numeric Variables, string or numeric ARRAYS, individual array elements, VARLISTs of string or numeric variables, or valid Disk I/O List Controls.

;

Optional. A semicolon indicating Partial I/O.

Flags Affected: LESS, OVER, ZERO

Note the following:

  1. If the manual record locking mode is in effect, the READLASTLK form locks the record as it is read.

  2. If the automatic record locking mode is in effect, all forms of this instruction lock the record as it is read.

  3. This instruction operates by positioning to the end of file and reading backwards.

  4. See the AAM READ instruction for all other details.

  5. When using the single unlocking mode, a read to a record that is not locked unlocks the currently locked record before the read is attempted.

  6. If a locking conflict occurs, the read fails and the following actions take place:

  7. Record Locking was added in version 8.2 and is not available when using the PLBCE runtime.

 

 

See Also: Disk I/O Instructions

 



PL/B Language Reference READKS, READKSTB, READKSLK RENAME