Multiple choice technology mainframe

What happens when the access mode of an indexed file is DYNAMIC?

  1. The records will be accessed one after the other in order of primary key

  2. The file will be accessed one record at a time and for each access an exact value for the primary key will be specified

  3. Both 1 and 2

  4. None of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

DYNAMIC access mode for indexed files in COBOL allows both sequential and random access patterns. This means programs can read records in order of the primary key (sequential) OR access specific records by providing an exact key value (random), providing maximum flexibility for file operations.

AI explanation

DYNAMIC access mode on an indexed (VSAM KSDS-type) file lets a program freely mix both access styles within the same run: sequential reads that proceed key-by-key from wherever positioned (like SEQUENTIAL mode), and direct/random reads where an exact primary key value is supplied for each access (like RANDOM mode). The program chooses which style to use for each I/O statement (READ NEXT vs READ ... KEY). So DYNAMIC is effectively the union of options 1 and 2, making 'Both 1 and 2' correct. Option 1 alone describes SEQUENTIAL mode, and option 2 alone describes RANDOM mode — neither captures the flexibility DYNAMIC provides.