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;
|
- 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 route output to any 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
.
- 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:
| BLKSIZE= |
| DENSITY= |
| DISP= |
| FILEVAR= |
| LABEL= |
| LEAVE= |
| LRECL= |
| PRINT|NOPRINT |
| RECFM= |
| SYSPARM= |
| TRACK= |
| VOLID= |
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:
- No blocking of records is performed in
variable-length
files. The BLKSIZE= option is ignored, and RECFM=VB is treated the same as
RECFM=V.
- For fixed-length files, BLKSIZE= specifies the
maximum buffer size to contain records. The default block size is the value
of LRECL= times the number of logical-record-length records that fit into
1,024 bytes. For example, a fixed-length file with LRECL=80 by default has
BLKSIZE=960. Twelve 80-byte records can fit into 1,024 bytes, taking up 960
bytes.
- CMS does not support blocking for a device-type
of TERMINAL.
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
MOD |
specifies that output lines are to
be written after any existing lines in the file. |
OLD |
specifies that any output lines are
to be written at the beginning of the file. This is the default. For CMS,
this option is identical to the NEW option. |
NEW |
specifies that any output lines are
to be written at the beginning of the file. For CMS, this option is identical
to the OLD option. |
-
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:
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
- 7TRACK
- 9TRACK
- 18TRACK
- 3490B
- 3490C
- 3590B
- 3590C
- XF
-
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.
-
SAS Language Reference: Dictionary
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.