COBCH2364 Perform range starting from entry <entry_name> cannot be split to conform with JVM method size restraints

JVM method cannot be created due to the size of a perform range in the source program.

The structure of JVM class files imposes a limit of 64KB on the size of any method. When compiling with JVMGEN, disjoint perform ranges in a COBOL program are split into separate methods, which helps to mitigate this problem. However, if a particular perform range requires a code size of more than 64KB, the Compiler attempts to split up the method into smaller methods, each of which have a size less that the 64KB limit.

However, there are rare situations in which this splitting process does not work.

One such situation arises when the program makes use of the DECLARE syntax to declare a local variable in-line within a section. If such a variable is declared at the start of the section, and is then followed by more than 64KB of code, this error will occur. To overcome this issue, it is possible to minimize the scope of the variable by enclosing it within PERFORM/END-PERFORM delimiters.

For example, the following will produce the error:

My-section section.
    declare my-var as binary-long = 1
    … (code occupying more than 64KB of compiled JVM byte code)

You can mitigate this by limiting the scope of the variable to the PERFORM statement:

My-section section.
    Perform
        Declare my-var as binary-long = 1
        … (code making use of the my-var variable)
    End-perform
    …  (code occupying more than 64KB of compiled JVM byte code)