Skip to content

CBACT03C

Source: cbl/CBACT03C.cbl

Type: Batch program

CBACT03C — Account Cross-Reference File Reader

Purpose

CBACT03C is a batch COBOL program in the CardDemo application that reads the account cross-reference data file (XREFFILE) sequentially and prints each record to the job log/output. It appears to be a simple extract/display utility, likely used for verifying or dumping the contents of the cross-reference VSAM file rather than performing any transformation or update logic. It runs as part of job step READXREF.STEP05.

How it works

The main PROCEDURE DIVISION logic (from line 70) follows a straightforward open-read-close pattern:

  1. Displays a start-of-execution message.
  2. 0000-XREFFILE-OPEN — opens XREFFILE-FILE for input. If the open fails (file status not '00'), it displays an error, calls 9910-DISPLAY-IO-STATUS to format the status code, and calls 9999-ABEND-PROGRAM to abnormally terminate.
  3. Enters a loop (PERFORM UNTIL END-OF-FILE = 'Y') that repeatedly calls 1000-XREFFILE-GET-NEXT:
  4. Reads the next record from XREFFILE-FILE into CARD-XREF-RECORD.
  5. On success (status '00'), displays the record (note: it is displayed twice — once inside this paragraph and again in the main loop after the call — see "Things to know").
  6. On end-of-file (status '10'), sets END-OF-FILE to 'Y' to stop the loop.
  7. On any other status, displays an error, formats the I/O status, and abends via 9999-ABEND-PROGRAM.
  8. Once end-of-file is reached, 9000-XREFFILE-CLOSE closes the file, abending on any non-zero close status.
  9. Displays an end-of-execution message and returns (GOBACK).

Error/status formatting is centralized in 9910-DISPLAY-IO-STATUS, which converts the raw two-byte VSAM file status into a human-readable 4-digit display string (handling both numeric and non-numeric status codes, e.g., the '9'xx extended status codes).

Abnormal termination is centralized in 9999-ABEND-PROGRAM, which sets a fixed abend code and calls the external routine CEE3ABD (a Language Environment service for abending an application) with a hard-coded abend code and zero timing value.

Inputs & outputs

Name Type Description
XREFFILE (XREFFILE-FILE) Input file (VSAM KSDS, indexed, sequential access, DD XREFFILE) Account cross-reference data. Keyed on FD-XREF-CARD-NUM (PIC X(16)); record also contains FD-XREF-DATA (PIC X(34)). The record layout used for processing (CARD-XREF-RECORD) is defined in copybook CVACT03Y.
Copybook CVACT03Y Data structure Provides the CARD-XREF-RECORD layout used to interpret and display the fields read from XREFFILE. Not shown in the excerpt, so exact field breakdown is not verified here.
Console/job log (DISPLAY statements) Output Each cross-reference record is written to the job log via DISPLAY CARD-XREF-RECORD. Status/error messages and abend messages are also written here. No output dataset/DD is defined for record output — this is a read/display-only program.
CEE3ABD External call (Language Environment abend service) Invoked only on unrecoverable I/O errors to terminate the program with abend code 999.

No SQL tables or CICS commands are used — this is a pure batch, file-based COBOL program.

Things to know

  • Duplicate record display: CARD-XREF-RECORD is displayed inside 1000-XREFFILE-GET-NEXT immediately after a successful read, and then displayed again in the main loop after the paragraph returns. This looks like unintentional duplication — every record is printed twice per read, which should be verified against the intended output format.
  • Hard-coded abend code: 9999-ABEND-PROGRAM always sets ABCODE to 999 regardless of the actual error, so the abend code does not distinguish between open, read, or close failures. The underlying file status is displayed beforehand (via 9910-DISPLAY-IO-STATUS), but the abend itself is generic.
  • File status interpretation is manual: The program checks for literal status values '00' (success) and '10' (end-of-file) using string comparisons on XREFFILE-STATUS, and treats any other status as a generic error (APPL-RESULT = 12). This is a common COBOL/VSAM pattern but is easy to get wrong if status codes change.
  • No explicit record counting or summary output — the program does not track or report the number of records read, unlike some similar batch utilities in this codebase.
  • Fixed, single-purpose flow: There is no parameterization (no runtime input file selection, no filtering logic) — it always reads XREFFILE from open to end-of-file and closes it. Any change in file scope requires a code/JCL change.
  • Abend via CEE3ABD: This is a Language Environment call that terminates the entire job step; there's no recovery/retry logic for I/O errors — any non-EOF error status immediately aborts processing.
  • File status field reuse: IO-STATUS is a shared 2-byte field reused across all three I/O routines (open, read, close) purely for display purposes — it does not persist any history between calls.

Files

Logical file DD name
XREFFILE-FILE XREFFILE

Copybooks

CVACT03Y

Calls

CEE3ABD

Executed by

READXREF.STEP05

Paragraph flow

flowchart TD
    1000_XREFFILE_GET_NEXT["1000-XREFFILE-GET-NEXT"]
    0000_XREFFILE_OPEN["0000-XREFFILE-OPEN"]
    9000_XREFFILE_CLOSE["9000-XREFFILE-CLOSE"]
    9999_ABEND_PROGRAM["9999-ABEND-PROGRAM"]
    9910_DISPLAY_IO_STATUS["9910-DISPLAY-IO-STATUS"]
    0000_XREFFILE_OPEN --> 9910_DISPLAY_IO_STATUS
    0000_XREFFILE_OPEN --> 9999_ABEND_PROGRAM
    1000_XREFFILE_GET_NEXT --> 9910_DISPLAY_IO_STATUS
    1000_XREFFILE_GET_NEXT --> 9999_ABEND_PROGRAM
    9000_XREFFILE_CLOSE --> 9910_DISPLAY_IO_STATUS
    9000_XREFFILE_CLOSE --> 9999_ABEND_PROGRAM

Paragraphs

Paragraph Line Performs
1000-XREFFILE-GET-NEXT 92 9910-DISPLAY-IO-STATUS, 9999-ABEND-PROGRAM
0000-XREFFILE-OPEN 118 9910-DISPLAY-IO-STATUS, 9999-ABEND-PROGRAM
9000-XREFFILE-CLOSE 136 9910-DISPLAY-IO-STATUS, 9999-ABEND-PROGRAM
9999-ABEND-PROGRAM 154
9910-DISPLAY-IO-STATUS 161