Language Reference

INFILE Statement

opens a file for input

INFILE operand <options>;

The inputs to the INFILE statement are as follows:
operand
is either a predefined filename or a quoted string containing the filename or character expression in parentheses referring to the pathname.

options
are explained in the following list.
You can use the INFILE statement to open an external file for input or, if the file is already open, to make it the current input file so that subsequent INPUT statements read from it.

The options available for the INFILE statement are described as follows.

LENGTH=variable
specifies a variable in which the length of a record is stored as IML reads it in.

RECFM=N
specifies that the file is to be read in as a pure binary file rather than as a file with record separator characters. To do this, you must use the byte operand (<) in the INPUT statement to get new records rather than use separate input statements or the new line (/) operator.

The following options control how IML behaves when an INPUT statement tries to read past the end of a record. The default is STOPOVER.

FLOWOVER
enables the INPUT statement to go to the next record to obtain values for the variables.

MISSOVER
tolerates attempted reading past the end of the record by assigning missing values to variables read past the end of the record.

STOPOVER
treats going past the end of a record as an error condition, which triggers an end-of-file condition.

Several examples of INFILE statements follow:
  
    filename in1 'student.dat';  /* specify filename IN1   */ 
    infile in1;                  /* infile pathname        */ 
  
    infile 'student.dat';        /* path by quoted literal */ 
  
    infile 'student.dat' missover;       /* using options  */
 
See Chapter 7 for further information.

Previous Page | Next Page | Top of Page