CUCO study materials
CUCO study resources

CUCO: Modern COBOL and Integration

CUCO · Work through your exam, one topic at a time.

All guide sections

Modern COBOL and Integration

This domain tests how current COBOL programs interact with modern platforms: newer language features, JSON and XML generation, SQL and transaction processing, and cross-language calls. Items often ask which clause is required for a valid JSON name or what SQLCODE 100 means.

Language evolution

COBOL 85 added scope terminators and intrinsic functions. COBOL 2002 added free format, object-oriented COBOL, user-defined functions, recursion and locale handling. Later standards and compiler releases added conditional compilation directives, dynamic table capacity, and native JSON/XML support in some compilers. Free-format source uses *> comments and has no Area A/B columns, but the division and sentence rules are unchanged.

Data interchange

IBM Enterprise COBOL provides JSON GENERATE and JSON PARSE, and XML GENERATE and XML PARSE. JSON GENERATE converts a group item to JSON text; NAME OF changes an output name, COUNT IN receives the number of fields generated, and ON EXCEPTION handles conversion errors. XML GENERATE similarly supports NAME OF, TYPE OF and SUPPRESS. NATIONAL and UTF-8 fields carry Unicode; mixing them with DISPLAY fields requires conversion, not a plain MOVE.

Database and transaction integration

Embedded SQL uses EXEC SQL ... END-EXEC, host variables prefixed with a colon, and an SQLCA declared with INCLUDE SQLCA. SQLCODE 0 means success, 100 means no row found, and negative values are errors. COMMIT and ROLLBACK end or undo a unit of work. CICS programs use EXEC CICS commands, COMMAREA or channels for parameter passing, and RETURN with TRANSID for pseudo-conversational flow. COBOL can also be called from Java and can call Java through compiler-specific interfaces.

Worked example. A program runs JSON GENERATE WS-JSON FROM WS-CUSTOMER COUNT IN WS-COUNT NAME OF WS-CUST-ID IS "customerId" ON EXCEPTION DISPLAY WS-COUNT END-JSON. The NAME OF clause is needed because WS-CUST-ID contains hyphens, which are not valid in JSON names. Without it, the generated name would be invalid or the statement would fail, depending on compiler rules.

Traps

  • Assuming JSON or XML names may contain hyphens without NAME OF.
  • Mixing NATIONAL and DISPLAY data in one MOVE without conversion.
  • Treating SQLCODE 100 as a hard error instead of no row found.
  • Forgetting COMMIT, so updates are rolled back at session end.
  • Passing a COMMAREA layout that does not match the called transaction.