 |
» |
|
|
 |
|  |  |
Reads a logical record in chronological sequence from KSAM file to user's stack.
I IV LA IV
lgth:=FREADC(filenum,target,tcount);
|
FREADC reads a logical record in chronological sequence. Chronological sequence means the sequence in which the records were originally written to the data file. When FREADC is executed, the key file is not accessed. This read is similar to the standard FREAD for non-KSAM files except that FREADC skips any data records that are marked for deletion. Following execution, the chronological pointer remains positioned at the same record. FUNCTIONAL RETURN |  |
The FREADC intrinsic returns a positive integer value to lgth showing the length of the information transferred. If the tcount parameter in the FREADC call is positive, the positive value returned represents a word count; if the tcount parameter is negative, the positive value returned is a byte count. PARAMETERS |  |
- filenum
integer by value (required) A word identifier supplying the file number of the file to be read in chronological sequence. - target
logical away (required) An array to which the record is to be transfered. This array should be large enough to hold all the information to be transferred. - tcount
integer by value (required) An integer specifying the number of words or bytes to be transferred. If this value is positive, it signifies the length in words; if negative, it signifies the length in bytes; if zero, no transfer occurs. If tcount is less than the size of the record, only the first tcount words are transfered from the record. If tcount is larger than the physical record size, transfer is limited to the length of the physical record.
CONDITION CODES |  |
- CCE
The information was read.
- CCG
The logical end-of-data was encountered during reading.
- CCL
The information was not read because an error occurred.
USING FREADC |  |
This intrinsic allows you to read the records in the data file in the order in which they are physically stored in the file. The end-of-data is encountered following the last record in the file. If any records have been marked for deletion (refer to the FREMOVE intrinsic), these records are not read; otherwise, this intrinsic reads the data from the data file exactly as it was stored. Following execution of FREADC, the chronological pointer remains positioned at the record just read, unless it is followed by another call to FREADC. In a series of calls to FREADC, the pointer is advanced automatically so you can read the file in chronological sequence without resetting the pointer for each record. Because FUPDATE only checks the logical pointer, you cannot update a record located by FREADC or FREADDIR. To update a record located by its chronological record number, you must precede the call to FUPDATE with a call to FPOINT. Unlike FREADC or FREADDIR, FPOINT sets the logical pointer as well as the chronological pointer. In Title not available, the FREADC intrinsic is used to read the data from the KSAM data file in chronological order. Compare this order to the sequential order by primary key in which the same file is read by FREAD. (Refer to Title not available for an example showing the chronological record number printed in association with each record listed in sequential key order.) Because FREADC is a chronological pointer-dependent procedure, you must call one of the procedures that position the pointer before calling FREADC. (Refer to Table 4-2 “Positioning the Pointers” for a list of the pointer-dependent and pointer-independent procedures.) When access is shared, it is essential that you lock the file before calling the procedure that positions the pointer, and then leave the file locked while it is being read by FREADC. This insures that no other user changes the information in the record. For example, the following sequence of calls guarantees that you will read the file in chronological sequence starting with a specified record number:
FLOCK <----------- lock file
FPOINT <------------- position the chronological pointer
FREADC loop <----------------- read records in chronological sequence
FUNLOCK <--------------- unlock file
|
|