Skip to main content

Problem:

When reading a sequential file that contains tab characters( x'09' ASCII), Micro Focus COBOL  is inserting multiple spaces and pushes the remaining characters out and they spill over and are read as a subsequent record.

Is there a way to easily remove the tabs?

Resolution:

One way to get around this is to set the external file handler configuration option:

EXPANDTAB=OFF

in the extfh.cfg file.  For how to set up the extfh.cfg file see the Server Express documentation for File Handling and look for Configuration File in the Table of Contents.

Alternatively, if the tab characters are not needed for further processing of the file they can be removed permanently using the UNIX translate command. The tr command will translate strings of characters throughout a file. (See the UNIX "man" pages for tr)

Here is an example:

tr '\\011' '\\040\\' <filea >fileb

The numbers are the Octal symbols; 011 is tab and 040 is null. Filea is the input file and fileb is the output. The tabs will be removed and the record length will be unchanged.

Old KB# 2094