Skip to main content

Problem:

Can IDXFORMAT"8" files be variable length?

Resolution:

The following program demonstrates that it is generally possible to create an IDX8 file having variable length records:

000001$set idxformat"8"

000002  select file1 assign to "file1"

000003  organization indexed

000004  access dynamic

000005  record key file1-key1.

000006

000007  fd file1

000008   record contains 30 to 50 characters

000009   recording mode v.

000010  01 file1-rec1.

000011          05 file1-key1 pic x(10).

000012          05 file1-data pic x(20).

000013  01 file1-rec2.

000014          05 file1-key2 pic x(10).

000015          05 file1-data pic x(40).

000016

000017  open output file1.

000018  move all "a" to file1-rec1.

000019  write file1-rec1.

000020  move all "b" to file1-rec2.

000021  write file1-rec2.

After compiling and running this 21-line COBOL program, use the "rebuild -f" command to reveal the properties of the resulting output file which will be named "file1".

Old KB# 2183

#AcuCobol
#COBOL
#ServerExpress
#netexpress
#RMCOBOL