Note: Built-In Function Rules Usage Options
Reads records from any file in the system including files not known to LANSA.
Warning:When using this BIF ensure that the file and/or member exists. The job will fail if the file and/or member do not exist on the system.
The file must be opened before you can read records from it.
You cannot change a file/member once the file is open. To access a new file/member you must first close the open file/member.
If a library is not specified, the first file matching the requested file name in the library list will be used.
If a member is not specified the first member of the file will be used.
Arguments
|
Return Values
|
If the records on the file are longer than 256 bytes, bytes 1-256 of the record will be returned in data block 1, bytes 257-512 of the record in data block 2, bytes 513-768 of the record in data block 3, etc.
Example
To read the first 10 records from a requested file and member.
DEFINE FIELD(#FILENM) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#LIBRARY) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#MEMBER) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#RETCOD) TYPE(*CHAR) LENGTH(2)
DEFINE FIELD(#DATA1) TYPE(*CHAR) LENGTH(256)
**********
REQUEST FIELDS(#FILENM #LIBRARY #MEMBER)
USE BUILTIN(ACCESS_FILE) WITH_ARGS(OPEN #FILENM #LIBRARY
#MEMBER) TO_GET(#RETCOD)
DOUNTIL COND('(#I *GE 10) *OR (#RETCOD *NE OK)')
USE BUILTIN(ACCESS_FILE) WITH_ARGS(READ #FILENM)
TO_GET(#RETCOD #DATA1)
* < process data1 >
ENDUNTIL
USE BUILTIN(ACCESS_FILE) WITH_ARGS(CLOSE #FILENM....) TO_GET(#RETCOD)