file control.
select fd-name
assign to "user.dat"
organization is indexed
access mode is dynamic
record key is fd-name-key.
...
file section.
fd fd-name.
record is varying in size
from 5 to 80 characters depending on ws-record-count.
01 fd-name-record.
05 fd-name-key pic x(5).
05 fd-name-data pic x(75).
...
working-storage section.
01 ws-record-count pic 99 comp-x.
この例では、5~80 バイトまでの可変長レコードを持つ索引付きファイルを定義しています。キーは、レコードの固定部分に指定する必要があるので注意してください。