Skip to content

COCRDUPC

Source: cbl/COCRDUPC.cbl

Type: CICS transaction program

COCRDUPC — Credit Card Detail Update

Purpose

COCRDUPC is a CICS-BMS transaction (mapset COCRDUP, map CCRDUPA, transaction ID CCUP) that lets a card-services user look up a single credit card by account number and/or card number, review its embossed name, expiry date and active status, and submit changes to that record. It supports a multi-step conversational flow: enter search keys → review fetched data → edit fields → confirm → commit the update, with a distinct message shown to the user at each step. This is the "update" counterpart to a card-list/inquiry screen (COCRDLIC) and hands off to a menu program (COMEN01C) or the card-list program on exit.

How it works

The program is pseudo-conversational: it re-enters via CICS RETURN/XCTL, using DFHCOMMAREA to carry state (CARDDEMO-COMMAREA plus a program-specific area WS-THIS-PROGCOMMAREA) between calls.

  1. 0000-MAIN sets up an abend handler (HANDLE ABENDABEND-ROUTINE), initializes working storage, and restores state from DFHCOMMAREA (or initializes fresh state if EIBCALEN = 0 or the caller was the menu program and this is a first entry).
  2. YYYY-STORE-PFKEY normalizes/records which PF key the user pressed. Main then validates that the pressed key is one of the allowed ones (Enter, PF3, PF5-when-changes-pending, PF12-when-details-fetched); if not, it's forced to "Enter" behavior.
  3. A large EVALUATE TRUE in 0000-MAIN decides the path:
  4. PF3 pressed, or update completed/failed and caller was the card-list screen — sets up CDEMO-TO-PROGRAM/TRANID, does a SYNCPOINT, and XCTLs back to the calling program (falls back to the menu program/tranid if none recorded).
  5. Entered from the card-list program (fresh or via PF12) — treats the incoming account/card number as the search key, calls 9000-READ-DATA to fetch the card, marks details as "show", and sends the map, then returns.
  6. Fresh entry from the menu, details not yet fetched — initializes the program commarea and sends a blank input screen prompting for search keys.
  7. Update just completed or failed — resets keys/storage, re-prompts for a new search.
  8. All other cases (normal user interaction on the screen) — runs 1000-PROCESS-INPUTS (receive & edit the map), 2000-DECIDE-ACTION (read data or write the update), then 3000-SEND-MAP to redraw the screen with results/messages.
  9. 1000-PROCESS-INPUTS calls 1100-RECEIVE-MAP to pull the fields off the BMS map into working storage (treating * or blank input as "not supplied"/low-values), then 1200-EDIT-MAP-INPUTS.
  10. 1200-EDIT-MAP-INPUTS behaves differently depending on state:
  11. If details haven't been fetched yet, it validates only the search keys (1210-EDIT-ACCOUNT, 1220-EDIT-CARD) and exits early — no other field edits run at this stage.
  12. Otherwise it compares the new field values to the previously-fetched values; if identical (case-insensitive) or if the record was already confirmed/committed, it skips validation and treats the record as unchanged.
  13. If changes are detected, it runs 1230-EDIT-NAME, 1240-EDIT-CARDSTATUS, 1250-EDIT-EXPIRY-MON, 1260-EDIT-EXPIRY-YEAR, and sets the record's change-state to "OK, not yet confirmed" if all pass.
  14. 2000-DECIDE-ACTION performs 9000-READ-DATA (which calls 9100-GETCARD-BYACCTCARD) to (re)fetch the card, or 9200-WRITE-PROCESSING (which calls 9300-CHECK-CHANGE-IN-REC) to commit an update, invoking ABEND-ROUTINE on unrecoverable errors.
  15. 3000-SEND-MAP rebuilds the screen: 3100-SCREEN-INIT (blank/init the map), 3200-SETUP-SCREEN-VARS (populate fields), 3250-SETUP-INFOMSG (pick an informational message via WS-INFO-MSG 88-levels), 3300-SETUP-SCREEN-ATTRS (set field attributes, e.g., protect/color), and 3400-SEND-SCREEN (the actual SEND MAP).
  16. COMMON-RETURN copies the error message into the map's error field, reassembles the combined commarea (CARDDEMO-COMMAREA + WS-THIS-PROGCOMMAREA), and issues EXEC CICS RETURN TRANSID(...) COMMAREA(...) to await the next user interaction.

Inputs & outputs

Resource Type Purpose
DFHCOMMAREA CICS commarea (linkage section) Carries CARDDEMO-COMMAREA (shared navigation/context data) plus this program's own state (WS-THIS-PROGCOMMAREA, holding old/new card field values and change-status flags) between conversational turns.
CCRDUPAI / map CCRDUPA, mapset COCRDUP BMS map (RECEIVE MAP / SEND MAP) Screen I/O: account ID, card number, name, status, expiry month/year/day, and error/info message fields.
Card data file (via 9100-GETCARD-BYACCTCARD, literal CARDDAT) VSAM/file (accessed through copybook CVACT02Y layout) Source of the card record read/updated by account+card key (WS-CARD-RID); no direct SELECT/FD is shown in the parsed facts, only the record layout and file-name literal, so the exact I/O statements (READ/REWRITE) live inside 9100-GETCARD-BYACCTCARD/9200-WRITE-PROCESSING, not shown in the excerpt provided.
Card account-index path (literal CARDAIX) Alternate index file name literal Referenced as LIT-CARDFILENAME-ACCT-PATH; likely used for account-based lookup, but no parsed file/SQL facts confirm how it's opened — unclear from given facts.
COCOM01Y (CARDDEMO-COMMAREA), CVCRD01Y, CVCUS01Y, CVACT02Y copybooks Data layouts Shared navigation fields, card-processing work fields, customer and card record layouts.
COTTL01Y, CSDAT01Y, CSMSG01Y, CSMSG02Y, CSUSR01Y copybooks Common working storage Screen titles, current date, common message text, abend info, signed-on user data.
DFHBMSCA, DFHAID IBM copybooks BMS attribute and AID (PF key) constants.
Program COCRDLIC (XCTL) Outbound program call Card-list screen, one possible return target after PF3/complete/fail.
Program COMEN01C (XCTL) Outbound program call Main menu, default return target when no prior caller is known.
sql_tables: [] No embedded SQL is present in the parsed facts; all data access appears to be via CICS file control (not shown in the excerpt) rather than DB2.

Things to know

  • Truncated source: the provided source cuts off mid-paragraph (1210-EDIT-ACCOUNT, ends at "IF W..."), so the exact numeric/length validation logic for account and card numbers, and the full bodies of 9100-GETCARD-BYACCTCARD, 9200-WRITE-PROCESSING, 9300-CHECK-CHANGE-IN-REC, and ABEND-ROUTINE are not shown here — described behavior for those paragraphs is inferred from names/flow, not verified in detail.
  • No SQL / file facts extracted: the parser found zero SQL tables and an empty files list, even though the code clearly reads/writes a card file (literal CARDDAT) and references an alternate index (CARDAIX). Treat file-access details as unconfirmed until the missing paragraph bodies are reviewed.
  • * as a wildcard/clear convention: user input of * or spaces in account, card, name, month, or year fields is treated as "not supplied" and mapped to LOW-VALUES — a hard-coded UI convention that could silently clear a field if a user types * unintentionally.
  • State-driven branching via 88-levels on a single-byte flag (CCUP-CHANGE-ACTION with values LOW-VALUES/SPACE, S, E, N, C, L, F): the whole workflow (fetch/edit/confirm/commit/fail) hinges on this one field carried in the commarea across transactions — easy to misinterpret without the 88-level legend.
  • Change detection by full-record comparison: 1200-EDIT-MAP-INPUTS treats the update as "no change" only if the entire new card-data group matches the old one case-insensitively; a single differing subfield forces full re-validation of name/status/month/year even if the user only meant to change one field.
  • Hard-coded literals: program name, transaction ID, mapset/map names, and target program names (COCRDLIC, COMEN01C, COCRDSLC) are all hard-coded in WS-LITERALS — any rename of these programs/transactions requires a code change here.
  • PF key gating logic is strict and silently overridden: any AID not matching the allowed list (Enter, PF3, PF5-with-pending-confirm, PF12-with-fetched-details) is forced to behave like Enter (PFK-INVALIDSET CCARD-AID-ENTER TO TRUE) rather than producing an explicit error — this could confuse users who press an unsupported key expecting feedback.
  • SYNCPOINT before XCTL on exit: the program explicitly commits work (EXEC CICS SYNCPOINT) before transferring control on PF3/completion — meaning any update must already be durably applied prior to this point (consistent with 9200-WRITE-PROCESSING running earlier in the same transaction).
  • Abend handling: ABEND-ROUTINE is registered up front via HANDLE ABEND, and 2000-DECIDE-ACTION explicitly performs ABEND-ROUTINE in at least one path — but the routine's actual behavior (message construction, EXEC CICS ABEND) is outside the given source excerpt.
  • Optimistic-concurrency style messages (DATA-WAS-CHANGED-BEFORE-UPDATE, COULD-NOT-LOCK-FOR-UPDATE, LOCKED-BUT-UPDATE-FAILED) suggest the update path checks for concurrent modification before committing, via 9300-CHECK-CHANGE-IN-REC, but the actual locking/compare mechanism isn't visible in the supplied code.

CICS commands

HANDLE ABEND, XCTL, RETURN, RECEIVE MAP, SEND MAP, READ, SEND, ABEND

Copybooks

COCOM01Y, COCRDUP, COTTL01Y, CSDAT01Y, CSMSG01Y, CSMSG02Y, CSUSR01Y, CVACT02Y, CVCRD01Y, CVCUS01Y, DFHAID, DFHBMSCA

Paragraph flow

flowchart TD
    0000_MAIN["0000-MAIN"]
    COMMON_RETURN["COMMON-RETURN"]
    0000_MAIN_EXIT["0000-MAIN-EXIT"]
    1000_PROCESS_INPUTS["1000-PROCESS-INPUTS"]
    1000_PROCESS_INPUTS_EXIT["1000-PROCESS-INPUTS-EXIT"]
    1100_RECEIVE_MAP["1100-RECEIVE-MAP"]
    1100_RECEIVE_MAP_EXIT["1100-RECEIVE-MAP-EXIT"]
    1200_EDIT_MAP_INPUTS["1200-EDIT-MAP-INPUTS"]
    1200_EDIT_MAP_INPUTS_EXIT["1200-EDIT-MAP-INPUTS-EXIT"]
    1210_EDIT_ACCOUNT["1210-EDIT-ACCOUNT"]
    1210_EDIT_ACCOUNT_EXIT["1210-EDIT-ACCOUNT-EXIT"]
    1220_EDIT_CARD["1220-EDIT-CARD"]
    1220_EDIT_CARD_EXIT["1220-EDIT-CARD-EXIT"]
    1230_EDIT_NAME["1230-EDIT-NAME"]
    1230_EDIT_NAME_EXIT["1230-EDIT-NAME-EXIT"]
    1240_EDIT_CARDSTATUS["1240-EDIT-CARDSTATUS"]
    1240_EDIT_CARDSTATUS_EXIT["1240-EDIT-CARDSTATUS-EXIT"]
    1250_EDIT_EXPIRY_MON["1250-EDIT-EXPIRY-MON"]
    1250_EDIT_EXPIRY_MON_EXIT["1250-EDIT-EXPIRY-MON-EXIT"]
    1260_EDIT_EXPIRY_YEAR["1260-EDIT-EXPIRY-YEAR"]
    1260_EDIT_EXPIRY_YEAR_EXIT["1260-EDIT-EXPIRY-YEAR-EXIT"]
    2000_DECIDE_ACTION["2000-DECIDE-ACTION"]
    2000_DECIDE_ACTION_EXIT["2000-DECIDE-ACTION-EXIT"]
    3000_SEND_MAP["3000-SEND-MAP"]
    3000_SEND_MAP_EXIT["3000-SEND-MAP-EXIT"]
    3100_SCREEN_INIT["3100-SCREEN-INIT"]
    3100_SCREEN_INIT_EXIT["3100-SCREEN-INIT-EXIT"]
    3200_SETUP_SCREEN_VARS["3200-SETUP-SCREEN-VARS"]
    3200_SETUP_SCREEN_VARS_EXIT["3200-SETUP-SCREEN-VARS-EXIT"]
    3250_SETUP_INFOMSG["3250-SETUP-INFOMSG"]
    3250_SETUP_INFOMSG_EXIT["3250-SETUP-INFOMSG-EXIT"]
    3300_SETUP_SCREEN_ATTRS["3300-SETUP-SCREEN-ATTRS"]
    3300_SETUP_SCREEN_ATTRS_EXIT["3300-SETUP-SCREEN-ATTRS-EXIT"]
    3400_SEND_SCREEN["3400-SEND-SCREEN"]
    3400_SEND_SCREEN_EXIT["3400-SEND-SCREEN-EXIT"]
    9000_READ_DATA["9000-READ-DATA"]
    9000_READ_DATA_EXIT["9000-READ-DATA-EXIT"]
    9100_GETCARD_BYACCTCARD["9100-GETCARD-BYACCTCARD"]
    9100_GETCARD_BYACCTCARD_EXIT["9100-GETCARD-BYACCTCARD-EXIT"]
    9200_WRITE_PROCESSING["9200-WRITE-PROCESSING"]
    9200_WRITE_PROCESSING_EXIT["9200-WRITE-PROCESSING-EXIT"]
    9300_CHECK_CHANGE_IN_REC["9300-CHECK-CHANGE-IN-REC"]
    9300_CHECK_CHANGE_IN_REC_EXIT["9300-CHECK-CHANGE-IN-REC-EXIT"]
    ABEND_ROUTINE["ABEND-ROUTINE"]
    ABEND_ROUTINE_EXIT["ABEND-ROUTINE-EXIT"]
    0000_MAIN --> 1000_PROCESS_INPUTS
    0000_MAIN --> 2000_DECIDE_ACTION
    0000_MAIN --> 3000_SEND_MAP
    0000_MAIN --> 9000_READ_DATA
    0000_MAIN -.-> COMMON_RETURN
    1000_PROCESS_INPUTS --> 1100_RECEIVE_MAP
    1000_PROCESS_INPUTS --> 1200_EDIT_MAP_INPUTS
    1200_EDIT_MAP_INPUTS -.-> 1200_EDIT_MAP_INPUTS_EXIT
    1200_EDIT_MAP_INPUTS --> 1210_EDIT_ACCOUNT
    1200_EDIT_MAP_INPUTS --> 1220_EDIT_CARD
    1200_EDIT_MAP_INPUTS --> 1230_EDIT_NAME
    1200_EDIT_MAP_INPUTS --> 1240_EDIT_CARDSTATUS
    1200_EDIT_MAP_INPUTS --> 1250_EDIT_EXPIRY_MON
    1200_EDIT_MAP_INPUTS --> 1260_EDIT_EXPIRY_YEAR
    1210_EDIT_ACCOUNT -.-> 1210_EDIT_ACCOUNT_EXIT
    1220_EDIT_CARD -.-> 1220_EDIT_CARD_EXIT
    1230_EDIT_NAME -.-> 1230_EDIT_NAME_EXIT
    1240_EDIT_CARDSTATUS -.-> 1240_EDIT_CARDSTATUS_EXIT
    1250_EDIT_EXPIRY_MON -.-> 1250_EDIT_EXPIRY_MON_EXIT
    1260_EDIT_EXPIRY_YEAR -.-> 1260_EDIT_EXPIRY_YEAR_EXIT
    2000_DECIDE_ACTION --> 9000_READ_DATA
    2000_DECIDE_ACTION --> 9200_WRITE_PROCESSING
    2000_DECIDE_ACTION --> ABEND_ROUTINE
    3000_SEND_MAP --> 3100_SCREEN_INIT
    3000_SEND_MAP --> 3200_SETUP_SCREEN_VARS
    3000_SEND_MAP --> 3250_SETUP_INFOMSG
    3000_SEND_MAP --> 3300_SETUP_SCREEN_ATTRS
    3000_SEND_MAP --> 3400_SEND_SCREEN
    9000_READ_DATA --> 9100_GETCARD_BYACCTCARD
    9200_WRITE_PROCESSING -.-> 9200_WRITE_PROCESSING_EXIT
    9200_WRITE_PROCESSING --> 9300_CHECK_CHANGE_IN_REC
    9300_CHECK_CHANGE_IN_REC -.-> 9200_WRITE_PROCESSING_EXIT

Paragraphs

Paragraph Line Performs
0000-MAIN 367 YYYY-STORE-PFKEY, 9000-READ-DATA, 3000-SEND-MAP, 3000-SEND-MAP, 3000-SEND-MAP, 1000-PROCESS-INPUTS
COMMON-RETURN 546
0000-MAIN-EXIT 560
1000-PROCESS-INPUTS 564 1100-RECEIVE-MAP, 1200-EDIT-MAP-INPUTS
1000-PROCESS-INPUTS-EXIT 575
1100-RECEIVE-MAP 578
1100-RECEIVE-MAP-EXIT 638
1200-EDIT-MAP-INPUTS 641 1210-EDIT-ACCOUNT, 1220-EDIT-CARD, 1230-EDIT-NAME, 1240-EDIT-CARDSTATUS, 1250-EDIT-EXPIRY-MON, 1260-EDIT-EXPIRY-YEAR
1200-EDIT-MAP-INPUTS-EXIT 717
1210-EDIT-ACCOUNT 721
1210-EDIT-ACCOUNT-EXIT 758
1220-EDIT-CARD 762
1220-EDIT-CARD-EXIT 802
1230-EDIT-NAME 806
1230-EDIT-NAME-EXIT 841
1240-EDIT-CARDSTATUS 845
1240-EDIT-CARDSTATUS-EXIT 874
1250-EDIT-EXPIRY-MON 877
1250-EDIT-EXPIRY-MON-EXIT 910
1260-EDIT-EXPIRY-YEAR 913
1260-EDIT-EXPIRY-YEAR-EXIT 945
2000-DECIDE-ACTION 948 9000-READ-DATA, 9200-WRITE-PROCESSING, ABEND-ROUTINE
2000-DECIDE-ACTION-EXIT 1029
3000-SEND-MAP 1035 3100-SCREEN-INIT, 3200-SETUP-SCREEN-VARS, 3250-SETUP-INFOMSG, 3300-SETUP-SCREEN-ATTRS, 3400-SEND-SCREEN
3000-SEND-MAP-EXIT 1048
3100-SCREEN-INIT 1052
3100-SCREEN-INIT-EXIT 1078
3200-SETUP-SCREEN-VARS 1082
3200-SETUP-SCREEN-VARS-EXIT 1135
3250-SETUP-INFOMSG 1138
3250-SETUP-INFOMSG-EXIT 1165
3300-SETUP-SCREEN-ATTRS 1168
3300-SETUP-SCREEN-ATTRS-EXIT 1319
3400-SEND-SCREEN 1324
3400-SEND-SCREEN-EXIT 1338
9000-READ-DATA 1343 9100-GETCARD-BYACCTCARD
9000-READ-DATA-EXIT 1372
9100-GETCARD-BYACCTCARD 1376
9100-GETCARD-BYACCTCARD-EXIT 1415
9200-WRITE-PROCESSING 1420 9300-CHECK-CHANGE-IN-REC
9200-WRITE-PROCESSING-EXIT 1494
9300-CHECK-CHANGE-IN-REC 1498
9300-CHECK-CHANGE-IN-REC-EXIT 1521
ABEND-ROUTINE 1531
ABEND-ROUTINE-EXIT 1554