Chapter 3: System Limits and Programming Restrictions

This chapter gives information on the limits this COBOL system places on the size or number of various parameters. It also describes restrictions concerning COBOL syntax and programming areas you should be aware of when creating applications. The COBOL system limits equal or exceed all those listed in the X/Open CAE, COBOL Language (XPG4).

3.1 COBOL System Limits

This section lists, by category, the maximum size or number of various parameters used in Micro Focus COBOL. The left-hand column gives the affected parameter, and the right-hand column notes the maximum value allowable in the indicated unit of measure.

There are three levels or categories of limit which must be taken into account for any particular environment: COBOL Compiler limits; COBOL run-time system limits; and external limits.

The COBOL Compiler and the intermediate code that it produces are environment independent. The limits associated with the Compiler are environment independent also and cannot be exceeded in any environment. However, at run time, the operating system or hardware can indirectly affect the design or 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 might directly impose limits that are lower than those of both the Compiler and the run-time system.

3.1.1 Command Line Length

16-bit:
On the 16-bit COBOL system, the maximum length of command lines is 128 characters. The name of the program being called will take up some of this,leaving a lower limit for the parameters to be passed to the program.

32-bit:
On 32-bit COBOL systems the maximum length of a command line is determined by the operating system.


Note: Some Micro Focus tools do limit the command line length to 128 characters. However, user applications should be able to use the operating system limit.


3.1.2 Compiler Limits

The COBOL Compiler and the intermediate code that it produces are environment independent. The limits associated with the Compiler are environment independent also and cannot be exceeded in any environment. Use this table of limits in conjunction with the later two tables of run time and operating system dependent limits which might well be lower than those of the Compiler.

For limits on files and records and their sizes, see your Programmer's Guide to File Handling.

Data items (sizes)

Alphanumeric/Group 256 Mbytes
Alphanumeric Edited/ Numeric Edited Can consist of 32 parts, each of which can contain up to 16 occurrences of a single edited character type subject to total size of 512 bytes
Numeric 18 digits
COMP/COMP-5 format 8 bytes
EXTERNAL data item No specifiable limit
File record size 62 Kbytes
ACCEPT FROM CONSOLE Limits (if any) are imposed by the operating system (See the chapter Device Handling and Terminfo for UNIX systems)
UNIX:
Full screen DISPLAY/ACCEPT
On the UNIX COBOL system: one screen less one character (the last character position on the screen is not usable)
ANSI DISPLAY No limit

Index keys

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
   (using COBOL syntax)
   (with Extfh interface)


252
252

Language (sizes)

Alphanumeric literals 160 bytes
PICTURE character string 30 characters
PICTURE replication (for example, n in PIC X(n)) 256,000,000
Program-ID name 30 characters
Entry point names 30 characters
Programmer defined words 30 characters
External filenames (for program source and object files, copyfiles, data files) 100 characters (see the section Filenames later in this chapter)
Dynamically loadable program names 100 characters or your system limit, whichever is the smaller. The first 30 characters must be unique.

Number of parameters to USING phrase

CALL statement 255
PROCEDURE DIVISION header 255
ENTRY statement 255

Program object (sizes)

Total No limit
Data Division 256 Mbytes
Procedure Division 816 Mbytes

16-bit:
16 Mbytes per COBOL segment (up to 50 segments plus root segment)

COBOL segment 16 Mbytes
Records in a file (all file types) No limit

Program source file (numbers)

Source lines 999,999
Data and procedure-names 64,000
Host variables 8,000 or database system limit if lower
Literals No limit
Words within COPY pseudo-text 65,000
BY clauses within a COPY REPLACING statement 65,000

Program source file (sizes)

Actual fixed format line 80 bytes
Effective fixed format line 72 bytes
Free format line 160 bytes

USE GLOBAL AFTER statement

Number of USE GLOBAL AFTER statements in program 20

Table dimensions

Total size No limit
Nesting of OCCURS clause No limit
Within Screen Section No specifiable limit
Number of subscripts 16
OCCURS in Screen Section Limited by the number of fields and/or the levels of occurrence. It is not possible to give an actual limit, but exceeding the limit will result in an error when you compile your program.

3.1.3 Run-time System Limits

Depending on the operating system or the hardware on which your COBOL application runs, the design and operational limitations of the COBOL run-time system might be lower than those of the Compiler. These limits, which are listed below, should be used in conjunction with any operating system limits.

For limits on files and records and their sizes, see your Programmer's Guide to File Handling.

Nesting

IFs (compiled code only) 255
PERFORMs At least 22
See the section PERFORM Nesting
CALLs No specifiable run-time system limit. However, this is limited by the stack space allocated by the operating system.

Simultaneously loaded subprograms

DOS, Windows and OS/2:
At program run time

200 (Subject to such things as memory and stack constraints)
400 If the P3 switch is set
32-bit:
At program run time and animation time

Configurable on 32-bit COBOL systems via COBCONFIG tunable

3.1.4 Operating System and Environment Variable Limits

The operating system or hardware configurations and parameter settings directly impose limits on your COBOL application. You need to check your operating system and hardware to determine the actual values for any limits, but the following items might be affected:

CALL nesting Limited by stack space allocated by operating system
Total data and procedure size Limited by available free memory
Simultaneously loaded subprograms Number might be limited by available free memory
Environment variables Limited to a maximum of 64 Kilobytes (or the machine's free space, whichever is smaller) of written environment variables at any one time during the run of an application.

For operating system limits on files and records, see your Programmer's Guide to File Handling.

3.1.5 Maximum core heap size

16-bit on DOS:
The maximum core heap size on the 16-bit COBOL systems for DOS is:

16-bit on Windows and OS/2:
The maximum core heap size on the 16-bit COBOL systems for Windows and OS/2 is:

32-bit:
On the 32-bit COBOL systems the maximum core heap size is limited only by disk space.

3.2 Programming Restrictions

This section gives details of items of COBOL syntax that are not implemented, areas of programming you should use with care, and programming restrictions.

3.2.1 COBOL Syntax Not Implemented

The following COBOL syntax documented in the Language Reference is not supported:

Neither of these items is defined in the ANSI standard.

The following OS/VS COBOL syntax is not supported:

3.2.2 Areas to Avoid

This section describes areas of programming that you should avoid or use with care. Unpredictable results might occur when using the following items.

ALTER In a segmented program, you must not alter code outside the current segment. However, if you do this, the Compiler does not report an error. The Compiler alters the code when the segment is entered.
DOS, Windows and OS/2:
ACCEPT identifier FROM LINE NUMBER .

This syntax is only suitable for use with operating systems that typically support many terminal lines. On DOS, Windows or OS/2, it will always return zero.

3.2.3 CHAIN Statement

16-bit:
On the 16-bit COBOL system, the implementation of CHAIN in Micro Focus COBOL might cause " memory full" errors to occur when chaining between programs linked with the static-linked run-time system. The initial program of a set is always retained in memory because it contains the global data used by the run-time system. Hence, if the initial program is large, and the program to be chained to is large, there might be insufficient memory.

To avoid the problem, if your system uses CHAIN, create a dummy initial program which simply chains to the first real program in the system. If any of the programs chained to are in separate executable files, the dummy program should also be in its own executable file.

3.2.4 ENTRY Statement

Entry points defined using the ENTRY statement can only be accessed after the main entry point (identified by the program-ID) has been called, unless the program is statically linked.

A nested program cannot contain ENTRY statements.

An entry point is an alternative route into a program; an entry point is not treated as a separate program. For more details on entry points, see the chapterWriting Programs, and for UNIX users also the The COBOL Interfacing Environment, both in your Object COBOL User's Guide.

16-bit Windows and OS/2:
On 16-bit Windows and OS/2, the basename of the .dll file is restricted to a maximum of eight characters.

3.2.5 Filenames

A file is identified within a COBOL program by a filename, a user-defined word. Outside the COBOL system it is identified by a filename which must be in an external, operating-system format. DOS, Windows, and OS/2 use the same format; UNIX uses a similar but different format. The DOS format recognizes four components: a drive, a path, a base-name and an extension. The UNIX format recognizes two components: a path and a name.

Micro Focus COBOL imposes a limit of 100 characters on the size of an external filename. COBOL imposes no other limits, but in order for the operating system to handle the filename correctly, any operating system limits must be observed at run time. Some operating systems allow filenames to exceed 100 characters, but such filenames cannot be directly used by a COBOL application.

In the UNIX environment, it is often found convenient to adopt a convention for constructing names for files that simulates the DOS base-name and extension format. It is a convention that a COBOL application can use or ignore. The utilities of the COBOL system use such a convention when they run, and the library routines CBL_SPLIT_FILENAME and CBL_JOIN_FILENAME also support the convention which has been designed to ease portability of applications between DOS, Windows, OS/2 and UNIX (see the chapter Library Routines (Call-by-name) for details). The convention splits a filename into three components: a path, a base-name and an extension.

16-bit:
For the DOS file format used by the 16-bit COBOL system, the path is considered to include the drive. The limits assumed by the convention are:

and 8 characters for the base-name and 3 characters for the extension.

32-bit:
For the file format used by the 32-bit COBOL system for UNIX, Windows NT and OS/2 V2, the limits are 100 characters for the path, 100 characters for the base-name and 100 characters for the extension.

These COBOL limits will be subject to any lower operating system limits that may be in effect. See your operating system documentation for details.

3.2.6 Floating-point Literals

DOS, Windows and OS/2:
Floating-point literals must have values between 0.54E-78 and 0.72E+76. See the section Numeric Literals in the chapter Concepts of the COBOL Language, in your Language Reference .

3.2.7 Local-Storage Section

The maximum size of the Local-Storage Section is platform specific. To ensure good performance and efficiency we recommend you keep the size to an absolute minimum.

A nested program cannot have a Local-Storage Section.

3.2.8 PERFORM Nesting

16-bit:
Because of the mechanism used for controlling the nesting of PERFORM statements, the maximum nesting of PERFORMs is variable according to the following rules:

By default, the PERFORM stack is 2048 bytes in size for the static linked run-time system, and 8192 bytes for the shared run-time system, although this is configurable at link time or at run time. See the section Linker Options in the chapter Linking and Library Management on the 16-bit COBOL System.

The depth of PERFORM nesting applies to a whole called suite of programs; any PERFORMs active at a CALL remain active. Each call requires 142+4p+2q+d bytes on the PERFORM stack, where:

p The number of parameters
q The number of 64K segments required to hold the program's Data Division
d The size of any Local-Storage Section rounded up to a multiple of 2.

32-bit:
The maximum number of levels for standard PERFORM nestings in a 32-bit COBOL system is 100 in .int code. The maximum for .gnt code depends on the amount of memory allocated by your operating system environment.

All environments:
The maximum level of PERFORM nesting when animating is 254. If your program exceeds this level, then Animator will only Step, even if Zoom mode is specified.

3.2.9 Program Size

Size of code and data areas

16-bit:
On the 16-bit COBOL system, the theoretical maximum size for a program is 256Mb for data, and 4096Mb for code.

On the 16-bit COBOL system, programs created with linked systems may have a smaller maximum size. The maximum size of a single program achievable with linked systems is limited by the maximum of 255 segments in an .obj file. With Micro Focus COBOL, standard segment usage limits this to 242 user segments, each being up to 64K in size, and each containing either code or data. Hence, a single linked program can contain no more than 15Mb of data. In practice, the size of code and data in a program is further restricted by the amount of memory available. Within these guidelines, there are the following restrictions:

Number of relocation entries

UNIX:
Each named procedure within an object program requires a relocation entry in an executable file. When building an executable COBOL application, there will be at least one named procedure in the COBOL object program, plus many more in the COBOL system libraries. Additional object programs held in .o files or within .a library files can be specified to the cob command in order to build an executable file and will contain many more procedure-names. In cases where many object files are linked together, the number of procedure-names might exceed the limit of the system linker.

The maximum number of relocation entries in a COFF object is operating system dependent. In practice, this usually limits the number of relocation entries for code or for data to 65535.

If you exceed this limit, the system linker returns an error message or quits, returning an error code to the shell. The number of names that could cause an error is operating system dependent, and the error message returned depends on how the operating system detects the overflow.

With Micro Focus COBOL, there are two ways in which you can avoid this limit to relocation entries:

3.2.10 Screens Utility

16-bit and UNIX:
On the 16-bit and UNIX COBOL systems, the maximum number of data entries a screen can contain is 200. This can be any combination of fields or groups. If you attempt to use more than 200 entries on a screen the following message appears:

Field table full

and the results on the existing fields are undefined. You should, however, use groups to avoid using this many entries and to make the generated code smaller and easier to maintain.

3.2.11 Size of Numbers

According to the ANSI standard, numbers are limited to 18 significant decimal digits. All significant digits must be within 18 digits of the decimal point.

Micro Focus COBOL gives an ON SIZE ERROR if either of the following conditions occur:

3.2.12 Segmented Programs

16-bit:
On the 16-bit COBOL system, to allow a segmented program to call another segmented program, the called program must be compiled with the NOREALOVL directive, and linked using the resulting .lnk response file.


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