CBACT02C
Source: cbl/CBACT02C.cbl
Type: Batch program
Purpose
This is a batch COBOL program that reads a card data file (VSAM KSDS) sequentially and prints each record to the job output. It appears to be a simple utility/extract program used to dump the contents of the card master file for review, auditing, or debugging purposes — it performs no calculations, updates, or business logic beyond reading and displaying records. It runs as part of job step READCARD.STEP05.
How it works
The main PROCEDURE DIVISION logic is a straightforward read loop:
-
0000-CARDFILE-OPEN — Opens CARDFILE-FILE for input. If the open fails (file status ≠ '00'), it displays an error, logs the I/O status, and abends the program.
-
Main loop — Repeatedly performs 1000-CARDFILE-GET-NEXT until END-OF-FILE is set to 'Y'. For each successfully read record, the program displays the record (DISPLAY CARD-RECORD) to standard output/job log.
-
1000-CARDFILE-GET-NEXT — Reads the next record from CARDFILE-FILE into CARD-RECORD (from copybook CVACT02Y). It translates the VSAM file status into an internal APPL-RESULT code:
-
Status '00' → success (APPL-RESULT = 0)
-
Status '10' → end-of-file (APPL-RESULT = 16, sets END-OF-FILE = 'Y')
-
Any other status → treated as an error (APPL-RESULT = 12), which triggers an error display, I/O status dump, and program abend.
-
9000-CARDFILE-CLOSE — Closes the file once the loop ends. Any non-zero close status also triggers an abend.
-
Error paths converge on two shared paragraphs:
-
9910-DISPLAY-IO-STATUS — Formats and displays the raw VSAM file status code (handles both numeric and non-numeric/'9' status values differently to render a readable 4-digit status).
-
9999-ABEND-PROGRAM — Sets an abend code (ABCODE = 999) and calls the LE runtime service CEE3ABD to terminate the program abnormally.
Start/end of execution are marked with DISPLAY messages for job log tracing.
Inputs & outputs
No CICS commands and no SQL/DB2 tables are used — this is a pure batch, file-only program.
Things to know
-
No business logic: this program only reads and prints; it does not validate, transform, or write card data anywhere. Treat it as a diagnostic/reporting utility rather than part of the core processing chain.
-
Hard-coded abend code: ABCODE is always set to 999 regardless of the actual error, and TIMING is always 0. This means all abends look identical from the return code alone — the real cause must be found in the preceding DISPLAY messages (error text + file status).
-
File status handling is coarse: any status other than '00' (success) or '10' (EOF) is collapsed into a generic APPL-RESULT = 12 "error" — the specific VSAM status code is only visible via the 9910-DISPLAY-IO-STATUS display, not through distinct handling logic.
-
Abend on any error: open, read, or close failures all immediately call 9999-ABEND-PROGRAM, terminating the whole job — there is no retry or graceful degradation.
-
Odd arithmetic idioms: 9000-CARDFILE-CLOSE uses ADD 8 TO ZERO GIVING APPL-RESULT and SUBTRACT APPL-RESULT FROM APPL-RESULT instead of simple MOVE statements. Functionally equivalent, but stylistically unusual — worth noting for maintainers unfamiliar with COBOL idioms.
-
Commented-out debug line: inside 1000-CARDFILE-GET-NEXT, a DISPLAY CARD-RECORD line is commented out — the actual display of each record happens instead in the main loop in PROCEDURE DIVISION, so this comment is legacy/dead and could be misleading during maintenance.
-
File status field reuse: IO-STATUS-04 and TWO-BYTES-BINARY/TWO-BYTES-ALPHA are used to reformat the 2-byte VSAM status into a 4-digit display string; the logic branches based on whether the status is numeric or the first byte is '9', indicating some VSAM status codes (e.g., extended status codes starting with '9') require special decoding — this is a common but non-obvious COBOL/VSAM pattern.
-
No dynamic file name/parameters: the file is statically assigned to DD CARDFILE; any change to the input file requires a JCL change, not a program change.
Files
| Logical file | DD name |
|---|---|
| CARDFILE-FILE | CARDFILE |
Copybooks
CVACT02Y
Calls
CEE3ABD
Executed by
READCARD.STEP05
Paragraph flow
flowchart TD
1000_CARDFILE_GET_NEXT["1000-CARDFILE-GET-NEXT"]
0000_CARDFILE_OPEN["0000-CARDFILE-OPEN"]
9000_CARDFILE_CLOSE["9000-CARDFILE-CLOSE"]
9999_ABEND_PROGRAM["9999-ABEND-PROGRAM"]
9910_DISPLAY_IO_STATUS["9910-DISPLAY-IO-STATUS"]
0000_CARDFILE_OPEN --> 9910_DISPLAY_IO_STATUS
0000_CARDFILE_OPEN --> 9999_ABEND_PROGRAM
1000_CARDFILE_GET_NEXT --> 9910_DISPLAY_IO_STATUS
1000_CARDFILE_GET_NEXT --> 9999_ABEND_PROGRAM
9000_CARDFILE_CLOSE --> 9910_DISPLAY_IO_STATUS
9000_CARDFILE_CLOSE --> 9999_ABEND_PROGRAM
Paragraphs
| Paragraph | Line | Performs |
|---|---|---|
| 1000-CARDFILE-GET-NEXT | 92 | 9910-DISPLAY-IO-STATUS, 9999-ABEND-PROGRAM |
| 0000-CARDFILE-OPEN | 118 | 9910-DISPLAY-IO-STATUS, 9999-ABEND-PROGRAM |
| 9000-CARDFILE-CLOSE | 136 | 9910-DISPLAY-IO-STATUS, 9999-ABEND-PROGRAM |
| 9999-ABEND-PROGRAM | 154 | |
| 9910-DISPLAY-IO-STATUS | 161 |