Compiler limits

Enterprise COBOL has the following limits for programs and class definitions.

Although the COBOL compiler supports addressing various memory areas in a compile unit up to the limits described in this appendix, a complete application, typically consisting of multiple compile units, is still restricted by the amount of private storage available in the address space in which it runs. In other words, an application might run out of storage before reaching the described limits.

Start of changeFor details about how to calculate the length of data items, see Finding the length of data items in the Enterprise COBOL Programming Guide.End of change

You can sum the length fields in the MAP (also requires either OFFSET or LIST) option output's PPA4 section for the static memory footprint of a compile unit. For automatic (local-storage) requirements, see Example: DSA memory map (stack storage map) in the Enterprise COBOL Programming Guide.

In general, the maximum size of tables and of elementary alphanumeric data items in LP(64) is 2,147,483,646 bytes. See the table below for more details.

The LOCAL-STORAGE SECTION is allocated on the Language Environment® stack. Its total size is limited by the settings in the Language Environment as well as the requirements of internal variables used by the compiler. The actual limit available for COBOL programs is less than 2,147,483,646 bytes.

The Language Environment STACK64 runtime option controls the allocation of stack storage for AMODE 64 applications. The default value is STACK64(1M,1M,128M). Use this runtime option to specify the maximum size of the stack required by your application.

The WORKING-STORAGE SECTION is allocated on the Language Environment heap. Its total size is limited by the 64-bit storage capacity of the machine.

Table 1. Compiler limits
Language element Compiler limit
Start of changeMaximum length of alphanumeric literalsEnd of change Start of change160 bytesEnd of change
Maximum length of user-defined words (for example, data-name, file-name, class-name) 30 bytes
Size of program 999,999 lines

Start of changeWith SOURCE(DEC): 999,999 linesEnd of change

Start of changeWith SOURCE(HEX): 16,777,215 linesEnd of change

Size of the following data types:
USAGE IS INDEX
USAGE IS POINTER
USAGE IS FUNCTION-POINTER
USAGE IS OBJECT-REFERENCE
With LP(32): 4 bytes
With LP(64): 8 bytes
Size of the following data types:
USAGE IS PROCEDURE-POINTER
With LP(32): 8 bytes
With LP(64): 8 bytes
LENGTH OF special register With LP(32): USAGE IS BINARY PICTURE 9(9)
With LP(64): USAGE IS BINARY PICTURE 9(18)
ADDRESS OF special register With LP(32): 4 bytes
With LP(64): 8 bytes
Number of literals 4,194,303(Note 1)
Total length of literals 4,194,303 bytes(Note 1)
Reserved word table entries 1536
COPY REPLACING . . . BY . . . (items per COPY statement) No limit
Number of COPY libraries No limit
Block size of COPY library 32,760 bytes
IDENTIFICATION DIVISION
ENVIRONMENT DIVISION
Configuration section
Special-names paragraph
mnemonic-name IS 18
UPSI-n . . . (switches) 0-7
alphabet-name IS . . . No limit
Literal THRU . . . or ALSO . . . 256
Input-Output section
File-control paragraph
SELECT file-name . . . A maximum of 65,535 file names can be assigned external names
ASSIGN system-name . . . No limit
ALTERNATE RECORD KEY data-name . . . 253
RECORD KEY length No limit(Note 3)
RESERVE integer (buffers) 255(Note 4)
I-O-control paragraph
RERUN ON system-name . . . 32,767
RERUN integer RECORDS 16,777,215
SAME RECORD AREA 255
SAME RECORD AREA FOR file-name . . . 255
SAME SORT/MERGE AREA No limit(Note 2)
MULTIPLE FILE file-name . . . No limit(Note 2)
DATA DIVISION
77 data item size With LP(32): 999,999,999 bytes
With LP(64): 2,147,483,646 bytes
01-49 data item size With LP(32): 999,999,999 bytes
With LP(64): 2,147,483,646 bytes
Total 01 + 77 (data items) No limit
88 condition-names . . . No limit
88 level VALUE clause . . . No limit
66 RENAMES . . . No limit
PICTURE clause, number of characters in character-string 50
PICTURE clause, numeric item digit positions With ARITH(COMPAT): 18

With ARITH(EXTEND): 31

PICTURE clause, numeric-edited character positions 249
Picture symbol replication ( ) With LP(32): 999,999,999 bytes
With LP(64): 2,147,483,646 bytes
Picture symbol replication (editing) 32,767
Picture symbol replication ( ), class DBCS items With LP(32): 499,999,999 bytes
With LP(64): 1,073,741,823 bytes
Picture symbol replication ( ), class national items With LP(32): 499,999,999 bytes
With LP(64): 1,073,741,823 bytes
Elementary item size With LP(32): 999,999,999 bytes
With LP(64): 2,147,483,646 bytes
OCCURS integer With LP(32): 999,999,999 bytes
With LP(64): 2,147,483,646 bytes
Total number of ODOs 4,194,303(Note 1)
Table size With LP(32): 999,999,999 bytes
With LP(64): 2,147,483,646 bytes
Table element size With LP(32): 999,999,999 bytes
With LP(64): 2,147,483,646 bytes
ASCENDING or DESCENDING KEY . . . (per OCCURS clause) 12 KEYS
Total length of keys (per OCCURS clause) 256 bytes
INDEXED BY . . . (index names per OCCURS clause) 12
Total number of indexes (index names) per class or program 65,535
Size of relative index 32,765
FILE SECTION
FD record description entry 1,048,575 bytes
FD file-name . . . 65,535
LABEL data-name . . . (if no optional clauses) 255
Label record length 80 bytes
BLOCK CONTAINS integer 2,147,483,647(Note 8)
RECORD CONTAINS integer 1,048,575(Note 5)
LINAGE clause values 99,999,999
SD file-name . . . 65,535
DATA RECORD data-name . . . No limit(Note 2)
LINKAGE SECTION
Total size With LP(32): 2,147,483,646 bytes
With LP(64): Unlimited, up to the available 64-bit addressing capacity of the machine.
LOCAL-STORAGE SECTION
Total size With LP(32): 2,147,483,646 bytes
With LP(64): 2,147,483,646 bytes
WORKING-STORAGE SECTION
Total size of items without the external attribute With LP(32): 2,147,483,646 bytes
With LP(64): Unlimited, up to the available 64-bit addressing capacity of the machine.
Total size of items with the external attribute With LP(32): 2,147,483,646 bytes
With LP(64): Unlimited, up to the available 64-bit addressing capacity of the machine.
PROCEDURE DIVISION
Procedure and constant area 4,194,303 bytes(Note 1)
PROCEDURE DIVISION USING identifier . . . 32,767
Procedure-names 1,048,575(Note 1)
Subscripted data-names per statement 32,767
Statements per line (TEST) 7
ACCEPT statement, record length on input device 32,760
ADD identifier . . . No limit
ALTER procedure-name-1 TO procedure-name-2 . . . 4,194,303(Note 1)
CALL . . . BY CONTENT identifier 2,147,483,647 bytes
CALL identifier or literal USING identifier or literal . . . 16,380
CALL literal . . . 4,194,303(Note 1)
Active programs in a run unit 32,767
Number of names called (DYN option) No limit
CANCEL identifier or literal . . . No limit
CLOSE file-name . . . No limit
COMPUTE identifier . . . No limit
DISPLAY identifier or literal  . . . No limit
DIVIDE identifier . . . No limit
ENTRY USING identifier or literal . . . No limit
EVALUATE . . . subjects 64
EVALUATE . . . WHEN clauses 256
GO procedure-name . . . DEPENDING 255
INSPECT TALLYING and REPLACING clauses No limit
MERGE file-name ASC or DES KEY . . . No limit
Total merge key length 4,092 bytes(Note 6)
MERGE USING file-name . . . 16(Note 7)
MOVE identifier or literal TO identifier . . . No limit
MULTIPLY identifier . . . No limit
OPEN file-name . . . No limit
PERFORM 4,194,303
PERFORM . . . TIMES identifier or literal 999,999,999
SEARCH ALL . . . maximum key length No limit
SEARCH ALL . . . total length of keys No limit
SEARCH . . . WHEN . . . No limit
SET index or identifier . . . TO No limit
SET index . . . UP/DOWN No limit
SORT file-name ASC or DES KEY No limit
Total sort key length 4,092 bytes(Note 6)
SORT USING file-name . . . 16(Note 7)
STRING identifier . . . No limit
STRING DELIMITED identifier or literal . . . No limit
UNSTRING DELIMITED identifier or literal  . . . No limit
UNSTRING INTO identifier or literal . . . No limit
USE . . . ON file-name . . . No limit
XML PARSE statement, maximum size of identifier 999,999,999 bytes
Intrinsic Function
LENGTH
UPOS
UVALID
ULENGTH
USUPPLEMENTARY
With LP(32): Return maximum 9-digit integer
With LP(64): Return maximum 18-digit integer
Notes:
  1. Items included in 4,194,303 byte limit for procedure plus constant area.
  2. Syntax checked, but has no effect on the execution of the program; there is no limit.
  3. No compiler limit, but VSAM limits it to 255 bytes.
  4. QSAM.
  5. Compiler limit shown, but QSAM limits it to 32,760 bytes.
  6. For QSAM and VSAM, the limit is 4088 bytes if EQUALS is coded on the OPTION control statement.
  7. SORT limit for QSAM and VSAM.
  8. Requires large block interface (LBI) support provided by OS/390® DFSMS 2.10.0 or later. On OS/390 systems with earlier releases of DFSMS, the limit is 32,760 bytes. For more information about using large block sizes, see Setting block sizes in the Enterprise COBOL Programming Guide.