Chapter Contents |
Previous |
Next |
INFILE |
Valid: | in a DATA step |
CMS specifics: | file-specification, type,options |
Syntax | |
Details | |
Host Option Values | |
Examples | |
See Also |
Syntax |
INFILE
file-specification <options;>
|
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.
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.
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.
Note that if file specification includes concatenated files, all files must have the same attributes.
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:
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.
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. |
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.