Skip to Content

How do I resolve "Error writing file: too many constants" error?

Estimated Reading Time: 1 Minutes

This error means that too many Java constants were created and the program cannot be compiled.
It is usually returned when compiling very huge source files.

To avoid the error, add the -big option to the Compiler options, but only for the programs that return this error.
Other programs might experience performance slowdown if they are unnecessarily compiled with the -big option.

The best way to set this option so it's only used on the programs that need it is to add the option to the top of the program using the ">>IMP OPTION" directive, like this:

   >>IMP OPTION "-big"
  IDENTIFICATION DIVISION.
  PROGRAM-ID. HugeProgram.

How do I resolve "Error writing file: too many constants" error?