File Access Methods
Access Methods are software units that control the data transfer between main memory (primary storage) and secondary storage devices. Secondary or auxiliary storage devices are independent of computer memory — for example - tape or disk.
Access method creates some techniques to store and retrieve the data from the dataset. An access method simplifies the application logic when the application requests I/O operations to z/OS. An access method is an optional function.
Application with EXCEP mode doesn't require an access method to run its I/O operations.
The access method has system-provided programs to define datasets, dataset structures to organize data, and utility programs to process datasets. Access methods are recognized based on dataset organization.
Access Method Types -
Frequently using access methods are specified below -
BSAM -
- BSAM is the short form of the Basic Sequential Access Method used in exceptional cases.
- BSAM allows the programs to read and write physical blocks of data.
- BSAM is an access method used for storing or retrieving data blocks in a continuous sequence using sequential (Example - tapes) or direct access devices(Example - disks).
- BSAM arranges records sequentially in the order of how they are entered.
- BSAM is available on OS/360, OS/VS2, MVS, z/OS, and high-end operating systems.
BSAM uses for the following dataset types -
- Basic format sequential datasets (flat files before z/OS 1.7).
- Large format sequential datasets (flat files).
- Extended-format datasets.
- z/OS UNIX files.
DSORG=PS in DCB (Data Control Block) specifies the declared dataset using BSAM. For example - Refer to the DSORG parameter in the below JCL.
//MTHUSRD JOB (123),'MTHUSR',CLASS=A,MSGCLASS=A,
// MSGLEVEL=(1,1),NOTIFY=&SYSUID
//****************************************************
//* ALLOCATE PS DATA SET USING IEFBR14 UTILITY
//****************************************************
//STEP10 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//DD1 DD DSN=MTHUSR.TEST.BSAMFILE,
// DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD2,
// SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
// DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//*
QSAM -
- QSAM is the short form of Queued Sequential Access Method and the most used access method.
- QSAM is the extended method of the Basic Sequential Access Method (BSAM).
- QSAM allows access to the logical records within the physical blocks of data.
- QSAM reads the records into storage before they are requested to improve the performance. This technique is called as queued access.
- QSAM organizes the records sequentially in the order of how they are inserted to form sequential datasets. The system is responsible for managing the records, among other records.
QSAM was used for the following datasets -
- Sequential datasets / flat files.
- Extended-format datasets.
- z/OS UNIX files.
Defining QSAM files and records in COBOL -
We can use the FILE-CONTROL entry below to define the file that uses QSAM in COBOL program -
FILE-CONTROL.
SELECT file-name ASSIGN TO disk-name.
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL.
DSORG=PS in DCB (Data Control Block) specifies the declared dataset uses QSAM (if the z/OS version is > 1.7). For example - Refer to the DSORG parameter in the below JCL.
//MTHUSRD JOB (123),'MTHUSR',CLASS=A,MSGCLASS=A,
// MSGLEVEL=(1,1),NOTIFY=&SYSUID
//****************************************************
//* ALLOCATE PS DATA SET USING IEFBR14 UTILITY
//****************************************************
//STEP10 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//DD1 DD DSN=MTHUSR.TEST.QSAMFILE,
// DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD2,
// SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
// DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//*
BDAM -
- BDAM is the short form of the Basic Direct Access Method and is becoming obsolete nowadays.
- BDAM organizes the records in any sequence based on the requirement and retrieves records by actual or relative address.
- If we do not know the exact location of a record, we have to specify the starting point in the dataset to begin the search. Datasets organized like this are called direct datasets.
- COBOL no longer supports BDAM. However, the BDAM function (most part) has been replaced by RRDS VSAM files.
- CICS supports access to keyed and non-keyed BDAM datasets.
- BDAM is used to create and format those datasets.
DSORG=DA in DCB (Data Control Block) specifies the declared dataset uses BDAM. For example - Refer to the DSORG parameter in the below JCL.
//MTHUSRD JOB (123),'MTHUSR',CLASS=A,MSGCLASS=A,
// MSGLEVEL=(1,1),NOTIFY=&SYSUID
//**************************************************
//* ALLOCATE PS DATA SET USING IEFBR14 UTILITY
//**************************************************
//STEP10 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//DD1 DD DSN=MTHUSR.TEST.PSFILE,
// DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD2,
// SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
// DCB=(DSORG=DA,RECFM=FB,LRECL=80,BLKSIZE=800)
//*
BPAM -
- BPAM is the short form of the Basic Partitioned Access Method.
- BPAM organizes the records as members of a partitioned dataset (PDS) or a partitioned dataset extended (PDSE) on DASD.
- BPAM is an access method for libraries with partitioned datasets (PDSes) structures.
- BPAM is used in OS/360, OS/VS2, MVS, z/OS, etc.
- A PDS is a single dataset on a disk-like windows folder, and members in it like PS (flat files).
DSORG=PO in DCB (Data Control Block) specifies the declared PDS uses BPAM. For example - Refer to the DSORG parameter in the below JCL.
//MTHUSRD JOB (123),'MTHUSR',CLASS=A,MSGCLASS=A,
// MSGLEVEL=(1,1),NOTIFY=&SYSUID
//******************************************************
//* ALLOCATE PS DATA SET USING IEFBR14 UTILITY
//******************************************************
//STEP10 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//DD1 DD DSN=MTHUSR.TEST.PDS,
// DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD2,
// SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
// DCB=(DSORG=PO,RECFM=FB,LRECL=80,BLKSIZE=800)
//*
VSAM -
- VSAM is the short form of the Virtual Storage Access Method.
- VSAM is an IBM-invented access method that allows us to access and organize the records in the disk dataset.
- VSAM is available under the z/OS and is one of the several access methods used in z/OS.
- VSAM works with the data that stores only on Direct Access Storage Devices (DASDs).
- VSAM record storage format is unique and not understandable by other access methods.
IDCAMS utility used to define the VSAM datasets. We will discuss VSAM more detail in further chapters.
VSAM has the below access method functions -
- Blocking (by storing several logical records in one physical block).
- Managing the buffer pool efficiently.
- Starting the I/O driver through an SVC (SuperVisor Call).
- Synchronizing tasks through the Wait function when the other job is running with the I/O operation.
- Writing virtual channel programs for accessing records that are organized on 3390 tracks.
- Start I/O error recovery.
There are dedicated access methods assigned for the specific dataset types. For example - BSAM or QSAM is used for sequential datasets.
There are cases where an access method is identified for one dataset type used for a dataset type. For example - a sequential dataset created by BSAM can be processed by BDAM.