HiLMAs reference
Back

Input/Output instructions

Next

FREAD

FREAD numfile,string[,KEY=key,KEYLEN=key-length,

RECLEN=rec-length,UPDATE=NO]

 

Description

This statement read a record from the file numfile; string will contain this record and its length must be greater or equal than record length
numfile is a numeric constant (from 1 to 20) used in FOPEN statement to handle the file.
key is the variable containing the read-key if the file is a KSDS or a RRDS
key-length is the length of this key
rec-length is the maximum record length: if a record is greater, the value in string is truncated

Let's summarize now how to use this instruction:

For a VSAM file (MVS/TSO/DOS/CICS):

For a sequential (SAM) file (MVS/TSO/DOS):

For a CMS file (CMS):

RECLEN= is an optional parameter that simply overrides the length of string.

The only Return code filled in every environment are $EOF (End Of File, that can be 'F' false or 'T' true) and $RCFILE; $RCVSAM is filled only managing VSAM files.

 

Parameter specifications

Parameter Name  Mode Type coding Remark
1 numfile Input numeric constant from 1 to 20
2 string Output String C or X Read record
  KEY= Input String C or X If file is a KSDS
  KEY= Input Integer F If file is a RRDS or a CMS file
  KEYLEN= Input Integer F or H for a partial key
  RECLEN= Input Integer F or H or const. overrides the length of string
  UPDATE=NO/YES fixed string   YES only for a following FDELETE

 

Examples

 


Back Start Next
FCLOSE Top FWRITE