PreviousViewing and Editing Data Files Directory HandlingNext"

Chapter 10: Converting Files

You can convert files from one organization to another or one format to another using Rebuild or, if you have Workbench, Workbench File Loader (WFL). See your Workbench documentation for more information on WFL, and the chapter Maintaining Files for information about Rebuild.

WFL is not available on UNIX systems.

10.1 The Workbench File Loader (WFL)

DOS, Windows and OS/2:
The Workbench File Loader (WFL) provides a comprehensive file translation process. Using WFL, files can be converted from one file organization to another. You can convert files to or from the following organizations:

WFL can also convert downloaded mainframe files.

You can use WFL to rebuild a corrupt index file, by reading in the data file as a record sequential file, and converting it to an indexed file.

WFL can be used to convert indexed files built with LEVEL 11 V2.5 COBOL the new (performance-enhanced) indexed file format used by this COBOL system. To use WFL in this way, simply read in the old-format indexed file as a fixed length relative file, and specify the desired indexed format for the output file. For more details about WFL see your Workbench User Guide.

10.2 Reading Indexed Files as Sequential Files

There may be instances where you want to read an indexed file as a sequential file. For example, you may want to create a smaller, specialized indexed file from a larger, more comprehensive one. To do this, you could read the indexed file as a variable-length sequential file, and write out the new indexed file as fixed- or variable-length, depending on the application.

On 16-bit systems, to ensure that you are using the Callable File Handler, you must use the CALLFH Compiler directive .

On UNIX, this process only applies to IDXFORMAT"3" and IDXFORMAT"4" files.

An example, highlighting what is necessary for this process, is given below. In this example, big-isam.dat is read as a record sequential file and new-isam.dat is created with the same format, but containing only those records required by a more specialized application.


Extracting a subset of an indexed file:

$set callfh
     select big-isam
         assign to "bigisam.dat"
         access mode is sequential
         organization is record sequential.

     select new-isam
         assign to "newisam.dat"
         access mode is sequential
         organization is indexed
         record key is new-isam-key.

 fd big-isam
     recording mode is variable
     record is varying
         from 10 to 80 characters.
 01 big-isam-record              pic x(80).
 fd new-isam
     recording mode is fixed
     record contains 80 characters
 01 new-isam-record.
     05 new-isam-key         pic x(05).
     05 rest-of-record       pic x(75).

In the Procedure Division, some selection logic must be used to select only those records which are required in the new-isam.dat file.

Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousViewing and Editing Data Files Directory HandlingNext"