PreviousFile Status Code Tables

Chapter 16: File Handling Limits

The following limits affect file handling:

The limits associated with the COBOL Compiler cannot be exceeded. However, at run time, the operating system or hardware can affect the operation of the COBOL run-time system, thereby imposing limits that are lower than those of the Compiler. In addition, the particular configuration of the operating system or hardware environment can directly impose limits that are lower than those of both the Compiler and the run-time system.

16.1 File Handles

A file handle is an identifier assigned by the operating system when a file is opened. Every file that your application has open requires at least one file handle. The FILES parameter in config.sys specifies the maximum number of files that can be open at any one time. The maximum value for FILES is 255. When you are running COBOL, the FILES parameter is set by default to 100. Some applications require more file handles, and some less. Some factors that can determine how many file handles are needed are the number of open files and the number of levels of called programs.

Indexed files Because the processing of indexed files requires that two files be open (the data and the index file), two file handles are used for each indexed file that is open.
Overlays Whenever an overlay is loaded, a file handle is used. Statements that can cause overlays to be loaded include CALL, GOTO and PERFORM. Overlays are produced whenever you specify them by dividing your program into sections (numbered 50 and above) and can be produced when the Procedure Division of a program is greater than 64K.

Note: When overlays are loaded from Micro Focus library files (.lbr), the file handle used is the one for the .lbr file.

Sorts When a COBOL SORT is performed a work file is created and a file handle is assigned to the work file.
Animation During animation, a certain number of control files are opened; each of these uses a file handle.
Networks Some networks have limits built in that are more restrictive than the default maximum of 255. If you are running on a network, see the documentation for your network system to find out the maximum number of files that you can have open at one time.

16.2 COBOL Compiler Limits

Remember that run-time limits and operating system limits might be lower than those of the COBOL Compiler.

Index Key Limits

Per file (including split-key components) 255 keys
Length of any one key, including split-key 1016 bytes (performance best below 512)
Number of components in a split key 62
Number of alternate keys 252

SORT/MERGE Operation Limits

Number of USING/GIVING files:
    (using default module)

    (using Callable Sort Module) 255

16.3 Run-time Limits

You should be aware that run-time limits might be lower than those imposed by the COBOL Compiler.

Files Open Simultaneously

Sequential files, line sequential files Specified by the environment variable MAX_FILE_HANDLES
Indexed sequential and relative files Half the number specified by the environment variable MAX_FILE_HANDLES

Note that these maximum figures include any libraries that might be open at the time.

File Sizes (Number of Records)

All file organizations No specifiable limit; depends on record size and file size

Index Keys (Numbers)

Records containing the same duplicate key value in:
    Standard file
    With IDXFORMAT"4" or IDXFORMAT"8" directive

Components in a split key
    (using Micro Focus format file)
    (using C-ISAM format file)


Record Sizes

All file types 62 kilobytes

Sort Keys

Sort key size 4096
Number of sort keys 64

16.4 File Size Limits

The COBOL file handler imposes some limits on file size, and some UNIX platforms impose a file size limit of two gigabytes. Consequently, you might need to use file striping. Even on UNIX platforms that support larger file sizes, often the default kernel settings impose a two-gigabytes limit.

Note: If you intend porting your application to a Windows operating system, you should be aware that the limits to file sizes might be different to those on UNIX. Check the Net Express help for information on Windows file size limits.

16.4.1 Indexed File Size Limits

The following file size limits affect indexed files:

The default is IDXFORMAT 1 (C-ISAM) for fixed record length files and IDXFORMAT 3 for variable record length files. To create files of a different format, use the IDXFORMAT configuration option or compiler directive setting. To convert existing files to other formats, use the Rebuild utility.

IDXFORMAT Exclusive# Exclusive with Duplicate Key Compression on Shared with Default Locking
1 4 Gb 2 Gb 1 Gb
2 4 Gb 2 Gb 1 Gb
3 4 Gb 2 Gb 1 Gb
4 4 Gb 2 Gb 1 Gb
8 (default) 128 Tb 128 Tb 128 Tb
8* 8 MTb 8 MTb 4 MTb


* IDXFORMAT 8 with extfh.cfg setting FILEPOINTERSIZE=8 (specified in bytes, i.e. 8 bytes = 64 bits)
# Either accessing files exclusively or accessing shared files with the extfh.cfg or compiler directive setting of LOCKTYPE 1 or 2. That is, file size is not affected when using LOCKTYPE 1 or 2.


16.4.2 Sequential and Relative File Size Limits

The following file size limits affect sequential and relative files:

8 MTb 4 MTb

16.5 Operating System Limits

The operating system and hardware configuration impose direct limits which can be lower than those imposed by either the COBOL Compiler or the COBOL run-time. You must check your operating system and hardware to discover the actual values for any limits, but you should consider the following items:

You should also be aware that the number and size of index keys can be limited if you are using a non-standard file handler and that the number and size of sort keys can be limited if you are using a non-standard SORT module.

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

PreviousFile Status Code Tables