Accessing Nonstandard Files

Accessing BSAM Files in Random Access Mode

Users of SAS 9.2 with IBM z/OS V1R7.0 or later can use random access (byte-addressable) techniques to read and create BSAM files. For example, fonts files, which previously conformed to certain restrictive rules (LRECL=1, RECFM=F, FS, or FBS) can now be read regardless of their format, including existing as members of a PDS or PDSE. Also, graph procedures can now be used to write image files as BSAM data sets.
Random access (byte addressability) to BSAM files is achieved by copying or creating files in 64-bit storage. The size of this storage is determined by the value of MEMLIMIT, which is determined by the systems programmer at your site. The value set for MEMLIMIT can be overridden in the JCL or by SMF parameters, commands, or exits.
For input files, SAS BSAM allocates 64-bit storage by determining the size of the existing file. For output files, SAS BSAM allocates 64-bit storage by using information for the space allocation request. If no space allocation request is made, then default values from SAS system options FILESPPRI, FILESPSEC and FILEUNIT are used. It is possible that SAS might not be able to use 64-bit storage for a file because of one of the following reasons:
  • MEMLIMIT is not set, or it is too small for the file.
  • Insufficient 64-bit storage is available due to other uses of this storage.
In cases like these, SAS attempts to open and process the file on disk, if it is an input file and conforms to the file characteristics described. Otherwise the attempt to open the file for random processing fails. In addition to existing ERROR messages, the following explanatory note is issued:
Note: Random access to sequential file dataset-name: storage array
could not be allocated, and mode or file characteristics do not permit
opening file as binary.
To avoid possible confusion caused by trailing blank spaces or nulls in the last record, BSAM random access files that are created with a RECFM, other than V, VS, VB, or VBS, have their RECFM changed to VB. A message is then issued to the SAS log.
Output data is written from above-the-bar storage to disk when the file is closed. If there is more data in the storage array than has been allowed for in the disk space allocation for the file, then an undetermined I/O error occurs. The following message is then issued:
Note: Random access file <name>: output file might be incomplete.
Normal file definitions do not apply to a BSAM file resident in an above-the-bar storage array. Certain characteristics are assigned while the file resides in that location (LRECL=1, RECFM=fbs, BLKSIZE=total filesize) to enable seamless processing. If you display the file's definition during this period, it returns those characteristics.

Accessing IMS and CA-IDMS Databases

Both the SAS/ACCESS interface to IMS and the SAS/ACCESS interface to CA-IDMS include a DATA step interface. Extensions for certain SAS statements (such as INFILE, FILE, PUT, and INPUT) enable you to format database-specific calls in a SAS DATA step. Therefore, you can access the IMS or CA-IDMS data directly, without using SAS/ACCESS view descriptors. If your site licenses these interfaces, see SAS/ACCESS(R) 9.3 Interface to IMS: Reference and SAS/ACCESS DATA Step Interface to CA-IDMS: Reference for more information.
Note: The DATA step interface for IMS-DL/I is a read and write interface. The DATA step interface for CA-IDMS is read only.

Accessing ISAM Files

To read an ISAM file sequentially, include the ISAM keyword in the INFILE statement as in the following example:
data newdata;
   infile isamfile isam;
   input;
   /*  SAS statements  */
run;

Accessing VSAM Data Sets

Overview of Accessing VSAM Data Sets

Use the VSAM option to indicate that a fileref points to a VSAM external file.
Note: Many VSAM-specific options are available with the INFILE and FILE statements. For more information, see VSAM Options for the FILE and INFILE Statements under z/OS. For information about accessing VSAM data sets, see the SAS VSAM Processing for z/OS.

Reading a VSAM File

To read a VSAM file with an INPUT statement, specify the VSAM option in an INFILE statement:
filename in1 'prod.payroll';
data mydata;
   infile in1 vsam;
   input ...;
   /* SAS statements */
run;
Note: A VSAM file can be read sequentially without your having to specify the VSAM option.

Writing to an Empty VSAM File

To write to an empty VSAM file with a PUT statement, specify the VSAM option in a FILE statement:
filename out 'myid.newdata' disp=old;
data current;
   file out vsam;
   put ...;
   /* SAS statements */
run;

Updating a VSAM Data Set

To update a VSAM data set, include an INFILE statement and a FILE statement that point to the same fileref, and specify the VSAM type option in the DATA step:
filename mydata 'myid.newdata' disp=old;
data newdata;
   file mydata vsam;
   infile mydata vsam;
   /* SAS statements */
run;

Using Record-Level Sharing with VSAM

SAS provides support for the record-level sharing (RLS) access feature for VSAM data sets. For the RLS access feature to work, you must define your VSAM clusters as eligible for RLS access.
RLS eligible data sets must be SMS data sets that were defined with a LOG specification. The details of RLS definition, restrictions, and use are contained in the IBM Data Facility Storage Management Subsystem (DFSMS) documentation.
SAS determines whether a VSAM data set is RLS eligible when it opens the data set. If the data set is RLS eligible, SAS automatically opens it in RLS mode. You can override this action by specifying the NRLS option in the INFILE statement that you use to define the data set to be opened. The SAS system option VSAMRLS can be used to specify RLS processing for all VSAM data sets that are accessed during a SAS session. Opening the data set in non-RLS mode might generate the following results:
  • If you are opening the data set for output, then the OPEN operation will fail if another application has the data set open. Alternatively, an attempt to subsequently open the data set by another application will fail while the data set is open in non-RLS output mode by SAS.
  • If you are opening the data set for input, the OPEN operation will succeed, even though the data set is open by another application, as long as you specify SHAREOPTIONS(2) when you define the VSAM cluster.
The operation of RLS is essentially transparent to users. However, make sure you specify DISP=SHR in the statement that defines the VSAM file that you are opening.

Extended-Format VSAM Data Sets

SAS supports extended-format VSAM data sets. These data sets are managed with SMS, and they are defined as extended format with the data class DSNTYPE=EXT parameter and sub-parameters.
Extended-format data sets are the basis for many new VSAM functions, such as data striping, host data compression for key-sequenced data sets, system-managed buffering, and extended addressability for data sets greater than 4 gigabytes in size.
See the IBM DFSMS documentation for information about defining these functions to SMS and for any restrictions for using these functions.

Accessing the Volume Table of Contents (VTOC)

To access a disk's Volume Table of Contents (VTOC), specify the VTOC option in an INFILE statement. For more information about VTOC options for the INFILE statement, see VTOC Options for the INFILE Statement under z/OS.