Specifies the current output file for PUT statements
| Valid: |
in a DATA step
|
| CMS specifics: |
file-specification, host-options
|
|
FILE file-specification
<options> ;
|
|
FILE file-specification LOG | PRINT
|
|
FILE
'pipe-specification' PIPE <options>;
|
-
file-specification
-
identifies the external file. See Identifying an External File
for details on the following possible forms of the file-specification argument:
-
'filename filetype <filemode |
*>'
-
specifies the filename, filetype, and filemode,
respectively.
-
fileref
-
specifies the logical name associated with
an external file, using 1-8 characters; the first character is either
a letter (A-Z) or an underscore (_).
- fileref(filename <filetype>)
- specifies a member of the aggregate external file identified
by the fileref. The aggregate must be an SFS directory or a CMS minidisk;
it cannot be a MACLIB. If the filetype is not specified, the filename is used
as the CMS filename and the filetype is assumed to be DATA.
-
LOG
-
specifies that lines produced by PUT statements
are to be written in the SAS log. LOG is the default destination for output
lines. Options cannot be specified with FILE LOG statements.
-
'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, or route output to any pipeline device driver. Use of the CMS
pipeline specification requires, as a minimum, CMS Release 12 or level 1.1.9
of the CMS Pipelines Runtime Library. You cannot specify any options if you
specify PIPE. For details on using pipeline specifications in your SAS programs,
see Using CMS Pipelines
.
-
PRINT
-
specifies that lines produced by PUT statements
are to be written to the same file as the output produced by SAS procedures.
When the PRINT argument is the fileref, SAS uses carriage-control characters
and writes the line with the characteristics of a print file. Options cannot
be specified with FILE PRINT statements.
-
options
-
The options specified in a
FILE statement control how SAS writes data into a file. In the CMS environment,
the FILE statement accepts the following host options. When specifying more
than one option, use a blank space to separate each option. Options are not
accepted with FILE LOG, FILE PRINT, or FILE PIPE statements. Valid keywords
are:
See
Host Option Values
for the values that can be assigned to the preceding keywords.
For information on portable options, see
SAS Language Reference: Dictionary.
This section provides examples of FILE statement usage
and describes the values available for FILE host-options.
Examples of using the FILE statement to write to CMS
files follow.
data _null_;
file 'mydata data *';
put 'Test: writing to an external file';
run;
In the preceding example, the FILE statement creates
the file MYDATA DATA on the first R/W disk with these default characteristics:
LRECL=80, RECFM=FB, and BLKSIZE=960.
filename mydata 'old mydata a';
data _null_;
file mydata;
put 'Test: writing to an external file';
run;
In the preceding example, a fileref is assigned to create
the file OLD MYDATA A with these default characteristics: LRECL=80, RECFM=FB,
AND BLKSIZE=960. The fileref MYDATA is assigned by a FILENAME statement.
The following file characteristics can be specified
in the options argument in a FILE statement. Multiple options
are separated by blank spaces.
See
SAS Language Reference: Dictionary for information on portable options.
Note that options cannot be specified if you use FILE
LOG, FILE PRINT, or FILE PIPE.
-
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:
-
Blocking is not supported for a device-type of
READER.
-
Blocking sizes specified for device-type of TAPE,
and MVS-shared DASD files must match the block size of the existing file.
-
When RECFM=FB, the value of the LRECL= option
is the length of the longest record, and BLKSIZE is an integer multiple of
LRECL. For example, if the longest record is 70 bytes, LRECL=70, and BLKSIZE=70 x n , where n is an
integer.
-
When RECFM=VB, the value of the LRECL= option
is the length of the longest record plus 4 bytes, which holds record descriptor
information. The value of the BLKSIZE= option can be any value up to 32,760,
as long as it is at least 4 bytes longer than the value of the LRECL= option.
(These 4 bytes are the block descriptor information.)
-
Any time the value of RECFM= option includes A,
which specifies a PRINT file, add 1 to the value of the LRECL= option to allow
for the column containing carriage-control characters.
-
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. Acceptable values are
-
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.
- PRINT | NOPRINT
- PRINT writes records to the file with ANSI printer control
characters, making the output file a "print" file. Page headings
are also produced. NOPRINT writes records without page headings or ANSI printer
control characters.
-
RECFM=format
-
specifies the format of records in the file.
You can choose one of the following record formats:
You can use the following values in any of the previously
listed formats except U.
-
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 truncates the file at that
point. No message is given. The next read to that file returns EOF.
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.