| Directives |
|
| Format | READ
RECORD (chan[,fileopt])var$
|
|||||||||||||||||||||||||||||||||||||
| Description | READ
RECORD reads a record from a file (chan)
and returns the complete record's data portion to the
string variable (var). A READ RECORD statement
can be used when dealing with native-mode operating
system files, when exchanging data between ProvideX and
other applications, or to read a complete record,
including data field separators. The READ RECORD directive advances the file position to the next record (or the record you identify if you use the KEY= or IND= options) and, if you use the KNO= option, the current key access number will be changed accordingly. ProvideX supports use of the READ RECORD directive with *MEMORY* (a memory-resident file or queue of records). |
|||||||||||||||||||||||||||||||||||||
| See Also | RCD( ) Function, *MEMORY* Create & Use Memory File |
|||||||||||||||||||||||||||||||||||||
| Automatic Padding with KEY=Option | When
you use KEY=string$:string$[:string$][...]
ProvideX will automatically pad key segments. This is
valid only if you have Keyed files with segmented key
definitions. Then, ProvideX right-pads the key segment
using $00$ (nulls) to the segment's full length but does
not pad the last segment; e.g., KEYED "TEST", [1:1:5]+[2:1:6]+[3:1:8] READ (1,KEY=A$:B$:C$) is the same as READ (1,KEY=PAD(A$,5,$00$)+PAD(B$,6,$00$)+C$) Note that the last segment in a compound key will not be padded. |
|||||||||||||||||||||||||||||||||||||
| Example | 0010
OPEN (1) "OLDFIL" 0020 OPEN (2) "NEWFIL" 0030 LOCK (2) 0040 READ RECORD (1,END=1000) R$ 0050 WRITE RECORD (2) R$ 0060 GOTO 0040 1000 CLOSE (1); CLOSE (2) 1010 END |
|||||||||||||||||||||||||||||||||||||