Statements under z/OS |
Valid: | in a DATA step |
z/OS specifics: | file-specification, type, host-options |
See: | INFILE Statement in SAS Language Reference: Dictionary |
Syntax |
INFILE file-specification <type><ENCODING=encoding-value> <options>; |
INFILE DATALINES | CARDS <options>; |
identifies a file in one of the following forms:
specifies the assigned fileref or the allocated ddname of the file. A fileref must conform to the rules for ddnames. That is, it can consist of up to eight letters, numbers, or national characters ($, @, and #) and underscores (_). The first character must be either a letter or a national character.
specifies a member of a partitioned data set, where the PDS or PDSE is specified by the assigned fileref or allocated ddname.
If you specify a fileref that is not allocated, then SAS attempts to construct a data set name with the following three qualifiers:
the value of the SYSPREF= option (usually the user ID)
the specified fileref
DATA
The value of the FILEEXT= system option can affect the way SAS interprets PDS and PDSE member names. See FILEEXT= System Option: z/OS for details.
specifies a physical file, which can be a member of a partitioned data set (PDS), an extended partitioned data set (PDSE), or a UNIX System Services file, using the following syntax:
a fully qualified data set name. For example:
'myid.raw.datax'
a fully qualified data set name with a member in parentheses. For example:
'sas.raw.data(mem1)'
a partially qualified data set name with a period preceding it. For example:
'.raw.data'
a partially qualified data set name with a period preceding it and a member name in parentheses. For example:
'.raw.data(mem1)'
for PDS members, a fully or partially qualified data set name with a wildcard name in parentheses. For example:
'.raw.data(mem*)'
'.raw.data(*mem1)'
'.raw.data(*)'
a UNIX System Services file. For example:
'/u/userid/raw'or
'HFS:raw'or
'/u/userid/data/*'
The * wildcard character indicates a concatenation of UNIX System Services files. For more information about the use of the wildcard, see Concatenating UNIX System Services Files.
The value of the FILEEXT= system option can affect the way SAS interprets file specifications for PDS and PDSE files. See FILEEXT= System Option: z/OS for details.
See Specifying Physical Files for more information about partially qualified data set names.
specifies the encoding to use when reading from the input file. Typically, you would specify a value for ENCODING= that indicates that the input file has a different encoding from the current session encoding. However, you can also specify the same encoding for the input file as the encoding of the current session. You must enclose the value in quotation marks if it contains a dash.
If you specify an encoding value different from the session encoding, SAS transcodes the data from the session encoding to the specified encoding when you read data from the input file. The default encoding is the session encoding, which is the value of the ENCODING= SAS system option.
For valid encoding values, see Encoding Values in SAS Language Elements in the SAS National Language Support (NLS): Reference Guide.
specifies that input data immediately follows a DATALINES or CARDS statement in your SAS program.
specifies the type of file. When you omit type, the default is a standard external file. Nonstandard (host-specific) file types that you can specify for z/OS are
for IMS-DL/I databases. For information about IMS-DL/I options for the FILE statement, see SAS/ACCESS Interface to IMS: Reference.
for files in UNIX System Services. See Accessing UNIX System Services Files.
for z/OS data sets.
for files in UNIX System Services, opens a pipe to issue UNIX System Services commands from within the statement. See Piping Data from SAS to a UNIX System Services Command.
for CA-IDMS files. For information about CA-IDMS options for the INFILE statement, see SAS/ACCESS DATA Step Interface to CA-IDMS: Reference.
for ISAM files. See Accessing ISAM Files.
for VSAM files. See Accessing Nonstandard Files.
are either portable or host-specific. See SAS Language Reference: Dictionary for information about portable options.
You can specify portable options and host options in any order. When you specify more than one option, separate the options with a blank space.
The host-options that you can specify depend on which type of external file is being accessed. See the following sections for details:
Standard Options for the INFILE Statement under z/OS |
You can use the following standard options with all standard external files under z/OS.
specifies the block size of the file. Block size is discussed in more detail in DCB Attribute Options.
specifies a character variable to which the physical address (cylinder head record) of a record is returned. This applies to files on CKD disks only.
indicates how a tape volume is positioned at the end of the DATA step. Values for keyword are
REREAD |
positions the tape at the logical beginning of the data set. |
LEAVE | |
REWIND | |
FREE | |
DISP |
specifies that you want to use the CSRCESRV services (available with z/OS) to decompress data on input. For example:
data; infile myfile csrc; input; run;
specifies the fileref of an external file that was referenced in an earlier FILE or INFILE statement in the same DATA step. SAS uses that file's RECFM=, LRECL=, and BLKSIZE= information for the current file.
works with LRECL to specify the maximum number of characters per line or record in print files, nonprint files, and the SAS log. Under z/OS, the range of acceptable values of LINESIZE= is 64 to 256. The default value of the LINESIZE= system option under z/OS is 132. This default applies only to print files (with carriage returns) or to the SAS log. For nonprint files (without carriage returns), the value of LRECL= is used in place of the default value for LINESIZE=.
specifies the logical record length of the file. The specified value depends on the access method and the device type. For more information, see the discussion of LRECL= in DCB Option Descriptions and in MVS JCL Reference.
specifies the record format of the file. Valid values are
F | |
V | |
FB | |
VB | |
U |
The following values can be appended to the RECFM= values:
The following value stands alone; no other values can be appended:
N |
indicates that the file is in binary format. The file is processed as a stream of bytes with no record boundaries, which includes the default value of LRECL. This record format is specific to SAS. |
Host Options for Retrieving Information about Data Sets |
For information about options that retrieve information about a data set from operating environment control blocks, see Host Options for Retrieving Information about Data Sets.
VTOC Options for the INFILE Statement under z/OS |
The following options are used only in INFILE statements that involve VTOC (Volume Table of Contents) access:
defines a SAS character variable of length 5 whose value is set to the CCHHR of the last VTOC record that was read by SAS. The returned value is in hexadecimal format; it can be printed by using the $HEX10. SAS format.
tells SAS to use the Common VTOC Access Facility (CVAF) of the IBM program product Data Facility/Device Support (DF/DS) for indexed VTOCs. If the VTOC is not indexed, or if your installation does not have CVAF, this option is ignored.
Note: When you use CVAF and CCHHR=, values that are returned for Format-5 DSCB records are not valid, because indexed VTOCs do not have Format-5 DSCB records.
Host-Specific Options for UNIX System Services Files |
The following table shows which host-specific options are recognized by the FILENAME, FILE, and INFILE statements for UNIX System Services files and pipes. No other options are recognized, including such options specific to z/OS as DISP, CLOSE, and DCB. Descriptions of the options follow the table.
Option | FILENAME | FILE | INFILE | %INCLUDE |
---|---|---|---|---|
BLKSIZE= | X | X | X | X |
FILEDATA= | X | X | X |
|
OLD | X | X |
|
|
MOD | X | X |
|
|
LRECL= | X | X | X | X |
RECFM= | X | X | X | X |
TERMSTR= | X | X | X |
|
specifies the number of bytes that are physically read or written in an I/O operation. The default is 8K. The maximum is 1M.
The FILEDATA= option specifies that the file being processed is expected to contain one of the following:
data without record separator character sequences.
data with records terminated by the EBCDIC newline character. The EBCDIC newline character is defined at code point x'15' and is typically represented as NL or \n.
Note: The FILEDATA= option is meant to be similar to the FILEDATA= parameter on the DD JCL statement, but is evaluated at run time by SAS. The JCL parameter is used by z/OS to set an attribute of the file when the file is created by the JCL
replaces the previous contents of the file. This option is the default. This option has no effect on a pipe.
appends the output lines to the file. This option has no effect on a pipe.
specifies the maximum number of characters in a line (unless the file has been opened with RECFM=N). The default is 255. Lines longer than value are truncated. value must be between 1 and 65,535, inclusive.
specifies the record format of the file. Valid values are
F |
specifies that all lines in the file have the length specified in the LRECL= option. In output files, lines that are shorter than the LRECL= value are padded on the right with blanks. |
V | D |
specifies that the lines in the file are of variable length, ranging from one character to the number of characters specified by LRECL=. This option is the default. |
P |
specifies that the file has variable-length records and is in print format. |
N |
specifies that the file is in binary format. The file is treated as a byte stream. That is, line boundaries are not recognized. |
The TERMSTR= option specifies the type of record separator character sequences to use to terminate records in the file. TERMSTR= accepts the following parameters:
NONE |
Record terminators are not used. This parameter provides the same function as FILEDATA=BINARY. |
NL |
The newline character (x'15') is used as the record terminator. This parameter provides the same function as FILEDATA=TEXT. |
CR |
The carriage return character (x'0C') is used as the record terminator. |
LF |
The line feed character (x'25') is used as the record terminator. |
CRLF |
The sequence CR followed by LF is used as the record terminator. |
LFCR |
The sequence LF followed by CR is used as the record terminator. |
CRNL |
The sequence CR followed by NL is used as the record terminator. |
All of the above specifications (x'15', x'0C', and x'25') assume that the files use an ENCODING= value whose short (12 byte) name is in the form open_ed-nnnn and whose long (32 byte) name contains (OpenEdition), for example, open_ed-1047 or Western(OpenEdition). These characters are automatically transcoded to or from the file's encoding if they are required by the ENCODING= or LOCALE= options.
The last occurrence of FILEDATA= or TERMSTR= takes precedence. Specification of one or the other of these options on a FILE or INFILE statement takes precedence over the specification in a related FILENAME statement.
The full precedence order is as follows:
Specification of FILEDATA= or TERMSTR= on a FILE or INFILE statement.
Specification of FILEDATA= or TERMSTR= on a FILENAME statement.
Specification of FILEDATA= on a DD JCL statement when the file was created by that DD statement
Implied by the RECFM= option in effect for the file.
The RECFM= option in the FILENAME, FILE, and INFILE statement can imply the value assumed for the termination sequence. This implication is always overridden by the presence of a TERMSTR= or FILEDATA= option for the file. Here are the default values:
RECFM=V|D |
TERMSTR=NL is implied. (This option is the default.) |
RECFM=F |
TERMSTR=NONE is implied. |
RECFM=P |
TERMSTR=NL implied, along with other formatting control characters. |
RECFM=N |
TERMSTR=NONE is implied. |
Note: The FILEDATA= parameter on the DD JCL statement is used only by z/OS when the file is being created by that JCL statement. For existing files, the FILEDATA= parameter is ignored by z/OS, and SAS is informed of its value at file creation time. Therefore, SAS cannot detect a change in the JCL. However, SAS will honor the values of FILEDATA= or TERMSTR= that are specified in the FILENAME, INFILE, or FILE statements when you replace an existing file or read a file.
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.