Chapter 26 Key Takeaways
-
No language is an island. Modern enterprise systems are polyglot. COBOL excels at business logic and decimal arithmetic; C provides system utilities and portable libraries; Java enables web interfaces; assembler delivers maximum performance. Inter-language communication lets each language contribute its strengths.
-
The binary interface pattern is the golden rule. All cross-language parameters should use COMP (binary) data types. No COMP-3, no DISPLAY numeric, no packed decimal crosses a language boundary. COBOL converts internally.
-
BY REFERENCE vs. BY VALUE is the most critical distinction. COBOL defaults to BY REFERENCE (passes address). C scalars default to by-value. Mismatch causes silent data corruption. Be explicit in every CALL.
-
String handling requires explicit conversion. COBOL strings are fixed-length, space-padded, not null-terminated. C strings are variable-length and null-terminated. Build reusable conversion utilities and use them consistently.
-
The three-layer Java integration (Java → C JNI glue → COBOL) is the standard architecture for Java-COBOL interoperability on z/OS. Each layer handles type conversion appropriate to its role.
-
SPECIAL-NAMES provides CALL-CONVENTION (for specifying calling conventions), ALPHABET (for character encoding), and CURRENCY SIGN — all relevant to inter-language and international data exchange.
-
Design COBOL programs for external callers by using COMP parameters, GOBACK (not STOP RUN), and documenting the interface contract. A COBOL program called from C that uses STOP RUN will terminate the entire runtime.
-
The wrapper pattern isolates calling programs from the inter-language interface. When the underlying implementation changes (different C library version, switch from C to Java), only the wrapper changes.
-
Test at every boundary — language boundaries, data type boundaries, encoding boundaries, and edge-case boundaries. The most insidious inter-language bugs involve correct code on both sides with an incorrect interface between them.
-
Document every interface with a standard specification: parameter types on both sides, valid ranges, error codes, encoding expectations, compiler requirements, and library versions.
-
Mixed-language debugging is hard. Trace logging at every language boundary is the most effective strategy. Prevention (clear interface contracts, boundary testing) is better than diagnosis.
-
The human factor is decisive. Inter-language systems require cross-team communication. Monthly code reviews where each team explains their side of the interface to the others prevent the misunderstandings that cause interface bugs.