Skip to main content

Can IDXFORMAT be used to convert an existing file's format?

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

Background information:

Indexed files in Micro Focus COBOL can have different formats or organizations.  An indexed file's format is decided at the time the file is created, under the control of the IDXFORMAT compiler directive.

The default IDXFORMAT value is 1, meaning "C-ISAM", whereas the value 4 means, "an optimized form of Micro Focus indexed file format".  Here is a table summarizing common formats:

1   C-ISAM format.

3   Micro Focus indexed file format.

4   An optimized form of Micro Focus indexed file format, for fast duplicate key handling.

8   Large indexed.

For more information on indexed file formats, look in the main index of the Server Express documentation, under the keyword "IDXFORMAT", and check each of the references there.

The question in this case is:

An existing file is of type IDX4 (as shown by "rebuild -f <filename>"), but the file is expected to grow beyond 2 gig, so it will be necessary to convert it to IDX8.  If a person specifies the compiler directive IDXFORMAT"8" when compiling a program, then will the program begin regarding the indexed file as IDX8?  That is, can the IDXFORMAT compiler directive be used to convert file formats?

Resolution:

The answer is no, the IDXFORMAT compiler directive cannot be used to convert file formats.  Once a file is created with a certain format, it retains that format for life.  IDXFORMAT controls only the format of files created new for the first time by the program.  When the program opens an existing file, it will handle the file according to the file's original format, regardless of the IDXFORMAT compiler directive.

To convert an existing file to a new format, use the "rebuild" command and its conversion options.  For a quick start, just enter "rebuild" on the command line; it will display a usage screen summarizing its options.

Strictly speaking, even the "rebuild" command cannot change a file's format; the usage is "rebuild infile,outfile".  Rebuild reads the data from the original file and creates and populates a new file to perform the conversion.

For a complete explanation, look up "rebuild" in the index of the Server Express documentation and read each of the references cited there.

Old KB# 2025

#netexpress
#AcuCobol
#COBOL
#ServerExpress
#RMCOBOL