Defining VSAM file organization and records

Use an entry in the FILE-CONTROL paragraph in the ENVIRONMENT DIVISION to define the file organization and access modes for the VSAM files in your COBOL program.

In the FILE SECTION of the DATA DIVISION, code a file description (FD) entry for the file. In the associated record description entry or entries, define the record-name and record length. Code the logical size of the records by using the RECORD clause.

Important: You can process VSAM data sets in Enterprise COBOL programs only after you define them by using access method services.
Table 1. VSAM file organization, access mode, and record format
File organization Sequential access Random access Dynamic access Fixed length Variable length
VSAM sequential (ESDS) Yes No No Yes Yes
VSAM indexed (KSDS) Yes Yes Yes Yes Yes
VSAM relative (RRDS) Yes Yes Yes Yes Yes