Compiler limits

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

Start of changeAlthough 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.End of change

Start of changeYou 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 the AUTOMATIC MAP section.End of change

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
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 999,999,999 bytes
01-49 data item size 999,999,999 bytes
Total 01 + 77 (data items) No limit
88 condition-names . . . No limit
Start of change88 level VALUE clause . . .End of change Start of changeNo limitEnd of change
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 ( ) 999,999,999 bytes
Picture symbol replication (editing) 32,767
Picture symbol replication ( ), class DBCS items 499,999,999 bytes
Picture symbol replication ( ), class national items 499,999,999 bytes
Elementary item size 134,217,727 bytes
OCCURS integer 999,999,999
Total number of ODOs 4,194,303(Note 1)
Table size 999,999,999 bytes
Table element size 999,999,999 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 No limit
LOCAL-STORAGE SECTION
Total size 2,147,483,646 bytes
WORKING-STORAGE SECTION
Total size of items without the external attribute 2,147,483,646 bytes
Total size of items with the external attribute 2,147,483,646 bytes
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
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 Version 2 Release 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.