Chapter Contents

Previous

Next
INFILE

INFILE



Specifies an external file to read with an INPUT statement

Valid: in a DATA step
CMS specifics: file-specification, type,options


Syntax
Details
Host Option Values
Examples
See Also

Syntax

INFILE file-specification <options;>
INFILE LOG | PRINT;
INFILE 'pipe-specification' PIPE;

file-specification
identifies the file. It can have the following forms:

'filename filetype <filemode | SFS-directory | *>'
specifies the filename, filetype, and filemode, respectively. For details, see Identifying an External File.

fileref
specifies the fileref. See Identifying an External File for details.

fileref(filename <filetype>)
gives the fileref of an aggregate external file. The filename given must be enclosed in parentheses. The aggregate can be a CMS MACLIB, SFS directory, or CMS minidisk. The default filetype for files in SFS directories or CMS minidisks is DATA. When referring to members of a MACLIB, do not specify a filetype.

If your CMS installation supports the access of OS/390 data sets from CMS (shared DASD), a member of an OS/390 partitioned data set can be read with this file specification, but the fileref must be assigned using the CMS FILEDEF command.

options
See Host Option Valuesfor the values that can be assigned to these host options:
BLKSIZE=
DENSITY=
DISP=
FILEVAR=
LABEL=
LRECL=
PRINT|NOPRINT
RECFM=
TRACK=
VOLID=

For information about other options that are available in the INFILE statement, see SAS Language Reference: Dictionary.

'pipe-specification' PIPE
specifies a standard CMS pipeline specification, which you can use to receive input from any CP or CMS command or pipeline device driver. You cannot specify any options if you specify PIPE. For details on using pipeline specifications in your SAS programs, see Using CMS Pipelines .


Details

The INFILE statement identifies the file to be read; therefore, it must execute before the INPUT statement. The INPUT statement reads from the file pointed to by the most recently executed INFILE statement.

When you read from more than one external file in a DATA step, you can partially process one file, go to a different file, and return to the original file. An INFILE statement must be executed each time you want to access a different file, even if you are returning to a file previously accessed.

Host Option Values

Note that if file specification includes concatenated files, all files must have the same attributes.

BLKSIZE=value
specifies the buffer size allocated to contain records. Valid values are 1 through 65535.

Records do not have to be blocked; however, because disk or tape activity is reduced when records are blocked, it is more efficient to use blocks. Blocking records is different when using CMS Native I/O Services than when using OS/MVS Simulation Services.

For CMS Native I/O Services, the following apply:

For MVS Simulated I/O Services, the following apply:

DENSITY=value
specifies tape density in bits per inch. Valid values include 200, 556, 800, 1600, 6250, 38K.

DISP=value
specifies the status (disposition) of the file. The single acceptable value is OLD, which specifies that any output lines are to be read from an existing file.

FILEVAR=variable
allows you to dynamically change input and output files in the middle of a DATA step.

LABEL=value
indicates the type of label processing for a tape file. LABOFF is the default. Valid values are

If LABEL=SL, NL, or BLP is specified, an additional label value n can be specified after the SL, NL, or BLP. The value of n indicates the file position in a multifile volume. The default value is 1.

LEAVE=YES
indicates that a multifile tape is not repositioned at open for LABOFF or BLP processing. For SL tapes, LEAVE=YES does not reposition before label processing. Omitting LEAVE or specifying LEAVE=NO causes a tape to be rewound and repositioned each time a file is opened. (See Working with SAS Files on Tape for details on tape processing.)

LRECL=value
specifies the logical record length in bytes. Valid values are 1 through 65,535.

RECFM=format
specifies the format of records in the file.

You can choose one of the following record formats:
F specifies fixed-length records, unblocked.
FB specifies fixed-length records, blocked.
V specifies variable-length records, unblocked.
VB specifies variable-length records, blocked.
U specifies undefined-record format. For CMS disk files, this is the same as V.

You can use the following values in any of the previously listed formats except U.
A specifies that the first byte of each record is an ANSI printer control character and that the file is to be handled as a print file.
S specifies that the file contains spanned records (V), or the file contains standard blocks (F). FS, FBS, VS, and VBS files must be assigned with a CMS FILEDEF command.

SYSPARM=value
passes an option string to a tape management system for standard label tapes. Entering a question mark (?) causes SAS to prompt you for option settings.

TRACK=value
specifies the tape setting. Valid values are

VOLID=value
specifies the volume serial number to be verified in the tape. If the value contains any special characters, it must be enclosed in single quotes.

See the FILEDEF command entry in VM/ESA CMS Command Reference, for more information about these options.

For more information about other options available in the FILE statement, see SAS Language Reference: Dictionary.

SAS does not interfere with FILEDEF options that are already specified. Therefore, TAPE options that are specified in the FILE, FILENAME, or INFILE statements that conflict with an existing FILEDEF to TAPE are ignored. See the appendix "Accessing SAS Data Libraries and External Files on Tape" in SAS Companion for the CMS Environment for more information.

If a variable-length file is opened for update (possibly in the DATA step) and if the replacement line is not the same length as the existing line, the standard CMS file system action is to fail the write attempt and return an error.


Examples

This example assigns a fileref to a disk file and then uses the fileref in the INFILE statement.

filename food 'my data a';
data calories;
   infile food;
   input x y;
run;

In this example, member ONE is read from a MACLIB identified by a fileref.

filename mymaclib 'use1 maclib';
data banquet;
   infile mymaclib(one);
   input line $char80.;
run;

This example reads data from a TAPE.

filename x tape 'tap1';
data budget;
   infile x;
   input x y;
run;

See Also


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.