READ-FILE

File 2
Statement FIND
Task This view makes it possible to read all or a selected set of records from a file or an LMS element. Using the SCAN fields, only those records containing the specified string are returned.

Relevant Error Codes

Code Text
530 Access denied by Security Facility.
531 Password missing or incorrect.
537 Time limit reached.
551 MEMBER not specified.
556 File is in use.
565 Syntax error in dataset name.
692 You are not permitted to access member.
699 Not enough main storage available.
700 Invalid value specified (DSORG RECFM/TYPE).
701 DSNAME missing.
772 Requested dataset not found.
798 Task was not started under TSOS.
799 Entire Systems Management Adapter internal error.
854 Permanent I/O error.
856 Operator unable to mount volume.
872 Record format not supported.
873 Record length missing.
874 Record length > LRECL.
881 Error occurred while opening file.
882 Error occurred while closing file.
899 Permanent I/O error while reading dataset.
981 Invalid value specified (BLKCTRL/BLKSIZE/LRECL).
982 Error during use of ISAM-key.
985 Access to tape file not allowed.
991 Unknown product.
998 Member not found.

Field Descriptions

Dictionary Field Name Format/

Length/

Desc/

Mu

Description

BLOCK-LENGTH (N5) Block length.
  D  
DIRECT (A3) Possible options:
  D NO Default. The block is not read directly.
    YES SAM files with RECFORM=F are read directly
    according to RECORD-NUMBER.
    PAM files and LMS elements are always read
    directly, if a RECORD-NUMBER is specified.
DIRECTION (A1) Possible values:
  D B Read backwards (ISAM files only).
    F Read forward.
DSNAME (A54) Required.
  D Name of the file to be read.
ELEMENT (A64) Name of LMS element to be read.
  D  
ELEMENT-TYPE (A8) Type of LMS element to be read.
  D Types C and L are not supported.
ELEMENT-PASSWORD (A8) Password, for protected LMS element.
  D  
ELEMENT-RECORD-TYPE (N3) Record type (LMS only).
  D  
ELEMENT-VERSION (A24) Version of LMS element to be read.
  D  
END-OF-FILE (A3) Contains YES, if the end of record is reached. The RECORD-NUMBER field then contains the number of records in the file.
KEY (A253) ISAM key.
  D  
PASSWORD (A8) Password for protected file.
  D  
POSITION (N5) Starting position within record. The RECORD field contains input record starting at this position.
  D  
PRODUCT (A1) Access method used:
  D M LMS
RECORD (A253) Gives the retrieved record. The length of this field as it appears in the format buffer determines the portion of the record retrieved each time a record is requested. Field SEGMENT-NUMBER contains the segment number within the record. For example, the record is 240 bytes long and the calling program requests 80 bytes (in Natural reporting mode: OBTAIN RECORD (A80)). The calling program will then receive three segments.
  D  
RECORD-LENGTH (N5) Length of entire record (not the segment length).
  D  
RECORD-NUMBER (N9) Record position within the file.
  D In case of a PAM file, the PAM block number must be specified here.
SCAN (A3) Specify YES to return the first record that meets all selection criteria and all subsequent records.
  D  
SCAN-COLUMN-FROM (N5) Relevant if SCAN-TYPE=A. Specifies the column number where the scan is to start. Default is 1.
  D  
SCAN-COLUMN-TO (N5) Relevant if SCAN-TYPE=A. Specifies the column number where the scan is to end. Default is the end of the record.
  D  
SCAN-LENGTH (N3) Relevant if SCAN-TYPE=A. Specifies the length of the scan string in field RECORD.
  D  
SCAN-LIMIT (N7) Specifies the maximum number of records to be scanned before the record is selected. If the limit is reached and no record found, error code 533 is issued.
  D  
SCAN-TYPE (A1) Specify A to perform an absolute scan. Wildcard symbols * (asterisk) and _ (underline) are treated as normal characters.
  D  
SEGMENT-LENGTH (N3) Length of segment.
  D  
SEGMENT-NUMBER (N5) Segment number within record.
  D  
TIME-LIMIT (N5) Specifies the maximum number of seconds a given record is to be scanned for.
  D  

Default Order of Data Returned

Records are returned in order from the start of the file.

Programming notes

Sequential files currently in creation are exclusively locked for the creating task and cannot be read by any other task. However, locked files can be accessed if the Entire Systems Management Adapter startup parameter READ-LOCKED-FILE is set to YES or was not specified, and class 2 system parameter SVC79 allows the usage of SVC 79. The Entire Systems Management Adapter will make a copy of the original data and use this file for READ-FILE. This technique is currently implemented for SAM files only.