Object-Oriented COBOL & Modern Extensions
COBOL Intermediate/Advanced
Chapter 8 · Object-Oriented COBOL & Modern Extensions
Every real program across both courses so far has been procedural — divisions, paragraphs, CALL. A real, genuinely significant turning point arrived decades after COBOL's own 1959 origin: COBOL 2002 added object-oriented syntax and free-format source together, in the same single revision.
A Real, Traceable Turning Point
Work on object-oriented COBOL began in the early 1990s, with real features drawn directly from C++ and Smalltalk, finally approved and published in late 2002 — driven substantially by a genuine, practical need: real interoperability with newer platforms like .NET and Java.
CLASS-ID & METHOD-ID: A Real Class Definition
A real COBOL class lives in its own source, headed by CLASS-ID instead of PROGRAM-ID. Reworking Fundamentals' own BALCHECK subprogram as a genuine method shows the real shape:
The real logic inside IS-VALID-BALANCE is identical to Fundamentals' own BALCHECK — the genuine change is structural: a method now belongs to a real class, callable on a real object, rather than existing as a standalone subprogram.
INVOKE: The Real OO Counterpart to CALL
INVOKE genuinely acts like Chapter 9's own CALL, but targets a real method on a real object instead of a standalone program:
A real, genuine shorthand also exists for inline invocation — calling a method directly as part of an ordinary statement, without a separate INVOKE:
INHERITS: Real Class Inheritance
A real subclass genuinely extends an existing class with a plain INHERITS clause on its own CLASS-ID line:
Free-Format Source: A Genuine Departure
The same real 2002 revision that added object orientation also introduced free-format code — real COBOL that no longer has to respect the strict, punch-card-era column positions every earlier chapter's own examples have implicitly followed. Free-format lines can genuinely start in any column at all, matching the visual style of newer languages.
XML & JSON: Real, Later Data-Interchange Extensions
Hands-On Exercises
Using this chapter's own real CUSTOMER-VALIDATOR example and Fundamentals' own Chapter 9 material, explain in your own words what genuinely changed and what genuinely stayed the same between BALCHECK as a standalone subprogram and IS-VALID-BALANCE as a class method.
📄 View solutionUsing this chapter's own real material, explain in your own words why PREMIUM-CUSTOMER-VALIDATOR INHERITS CUSTOMER-VALIDATOR genuinely gives the new class access to IS-VALID-BALANCE without that method needing to be rewritten or copied into the new class at all.
📄 View solutionUsing this chapter's own real material, explain in your own words why object orientation, free-format source, and later XML/JSON support are each described as genuinely separate real additions to COBOL, layered on at different points, rather than one single unified redesign of the language.
📄 View solutionChapter 8 Quick Reference
- CLASS-ID / METHOD-ID — real class and method definitions, introduced in COBOL 2002, drawing on C++ and Smalltalk
- INVOKE object "method" USING ... — the real OO counterpart to Chapter 9's own CALL
- object::"method" — a real, genuine inline shorthand for method invocation
- INHERITS — real class inheritance on a CLASS-ID line
- Free-format source — real column-position freedom, added in the same 2002 revision
- XML/JSON — real, later interchange extensions (XML via Technical Reports 2003-2009) letting COBOL talk to modern web-facing systems