Restriction: This directive affects native COBOL programs only.
The JAVA_SHAREABLE directive indicates whether the WORKING-STORAGE items in the current native COBOL program are accessible
to Java programs.
>>JAVA-SHAREABLE=ON|OFF
The default is OFF - no data shared.
If you are using this directive under DIALECT"ENTCOBOL", we recommend that you also compile with the NOFOLDCALLNAME directive,
to preserve the case of the PROGRAM-ID name.
Syntax rules:
- 01 groups must be unique.
- The following data types are not supported, that is, cannot be shared:
- pointer types and object reference types
- edited data types
- PIC G/N DISPLAY-1 items
- Non-integer COMP and COMP-5 items
- Micro Focus data types COMP-X and TYPEDEF
- COMP types from the following other dialects: ACU, RM
- PIC 1 items
- Items defined as USAGE CONSTANT
- Filler items
- PIC 9(n) USAGE NATIONAL items
- Items of dynamic length
- Sliding data items are treated at a fixed location. Any preceding ODO items are treated at the maximum number of occurrences.
- JAVA-SHAREABLE is not supported in nested programs.
- All identifiers must start with an alphabetical character.
- Hyphens within identifiers are represented as underscores within Java.
Example:
In the example below,
grp1 below would be accessible to a Java program, but
grp2 would not.
program-id. "demo".
...
working-storage section.
>>JAVA-SHAREABLE ON
01 grp1.
03 i1 pic 9(8) comp-5 value 88888889.
03 i2 pic 9(8) comp-5 value 01234578.
>>JAVA-SHAREABLE OFF
01 grp2.
03 i1 pic 9(8) comp-5 value 22222229.
03 i2 pic 9(8) comp-5 value 08765432.
...