PreviousAdvanced Language Features Handling Protection Violation ErrorsNext

Chapter 4: 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).

4.1 COBOL System Limits

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. Their limits are also environment independent 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.

For limits on files and records, and their sizes, see the chapter File Handling Limits in your File Handling book.

The following sections list the Compiler, run-time system and external limits. Each section lists, by category, the maximum size or number of various parameters used in this COBOL system. In each section, the left-hand column gives the affected parameter, and the right-hand column notes the maximum value allowable in the indicated unit of measure.

4.1.1 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.

As the limits imposed by the run-time system or the operating system might be lower than the Compiler limits, you should use the following table in conjunction with the tables of run-time system and operating-system limits, which are listed in the following two sections.


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 Terminfo Database and Terminal Devices in the Server Express User's Guide
Full screen DISPLAY/ACCEPT One screen less one character (the last character position on the screen is not usable)
ANSI DISPLAY No limit

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
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.

4.1.2 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.


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

At program run time and animation time Configurable using the COBCONFIG tunable

4.1.3 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.
Command line length The maximum length of a command line is determined by the operating system.
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

4.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.

4.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:

4.2.2 ALTER Statement

You should avoid using the ALTER statement, or use it with care; unpredictable results might occur otherwise. 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.

4.2.3 ENTRY Statement

An entry point is an alternative route into a program; an entry point is not treated as a separate program. 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.

For more details on entry points, see the chapters Calling Programs and Mixed-language Programming.

4.2.4 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 basename and an extension. The UNIX format recognizes two components: a path and a name.

Server Express imposes a limit of 100 characters on the size of an external filename. It 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 convenient to adopt a convention for constructing names for files that simulates the DOS basename 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 for details). The convention splits a filename into three components: a path, a basename and an extension.

Filenames are limited to 100 characters for the path, 100 characters for the basename and 100 characters for the extension.

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

4.2.5 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.

4.2.6 PERFORM Nesting

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

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.

4.2.7 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.

This COBOL system gives an ON SIZE ERROR if either of the following conditions occur:

4.2.8 Maximum Core Heap Size

The maximum core heap size is limited only by disk space.


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

PreviousAdvanced Language Features Handling Protection Violation ErrorsNext