Skip to content

COCRDSLC

Source: cbl/COCRDSLC.cbl

Type: CICS transaction program

COCRDSLC — Credit Card Detail Search Program

Purpose

COCRDSLC is a CICS transaction program (transaction ID CCDL) that lets a user look up and display the details of a single credit card — account ID, card number, embossed name, expiration date, and active status. It supports being entered directly (prompting the user for an account/card number) or being invoked from the Credit Card List screen (COCRDLIC) with search criteria already supplied. It presents its results on the CCRDSLA map (mapset COCRDSL) and hands off to the calling program or main menu (COMEN01C) on exit.

How it works

Processing is driven by 0000-MAIN, which sets up a CICS abend handler (HANDLE ABENDABEND-ROUTINE), initializes working storage, and restores the caller's commarea (CARDDEMO-COMMAREA plus a program-specific extension WS-THIS-PROGCOMMAREA) if one was passed in (EIBCALEN not zero).

  1. PF-key normalizationYYYY-STORE-PFKEY translates the AID key pressed into a standard value; only Enter and PF3 are considered valid (PFK-VALID/PFK-INVALID), otherwise Enter is assumed.
  2. Main dispatch (EVALUATE TRUE in 0000-MAIN):
  3. PF3 — builds return-to program/transaction info from CDEMO-FROM-* (falling back to the main menu literals if blank) and does an EXEC CICS XCTL to leave the program.
  4. First entry from the Credit Card List program (CDEMO-PGM-ENTER and CDEMO-FROM-PROGRAM = COCRDLIC) — trusts the incoming account/card number as already validated, calls 9000-READ-DATA to fetch the card, then 1000-SEND-MAP to display it, then returns.
  5. First entry from any other context (CDEMO-PGM-ENTER) — just sends the empty search screen via 1000-SEND-MAP prompting for input.
  6. Re-entry (CDEMO-PGM-REENTER, i.e., user pressed Enter on the screen) — performs 2000-PROCESS-INPUTS to receive and validate the map; if validation fails it re-displays the map with the error; otherwise reads the card data (9000-READ-DATA) and re-displays the map with results.
  7. Any other/unexpected combination — treated as a defensive/unreachable branch: sets up abend fields and calls SEND-PLAIN-TEXT (note: this paragraph is invoked but the abend is not actually raised via EXEC CICS ABEND in this branch — it only prepares abend variables and sends a text message).
  8. After the EVALUATE, if an input error is still flagged, the map is re-sent with the error message before falling through to COMMON-RETURN.
  9. COMMON-RETURN — copies the error message into the map's error field, reassembles the commarea (application commarea + program-specific data), and does EXEC CICS RETURN with TRANSID(CCDL), so the transaction re-enters itself pseudo-conversationally on the next user input.

Screen display is broken into four sub-steps under 1000-SEND-MAP: - 1100-SCREEN-INIT — clears the map, sets titles, transaction/program name, and current date/time. - 1200-SETUP-SCREEN-VARS — populates account ID, card number, embossed name, expiry date, and status fields from working storage; sets the informational prompt message. - 1300-SETUP-SCREEN-ATTRS — sets field protection (editable vs. protected) and cursor position depending on where the request came from and which fields failed validation; sets colors (red for invalid fields) and message coloring. - 1400-SEND-SCREEN — performs the actual EXEC CICS SEND MAP with ERASE/FREEKB, and marks the program state as CDEMO-PGM-REENTER so the next invocation is treated as continuation.

Input processing (2000-PROCESS-INPUTS) is: - 2100-RECEIVE-MAPEXEC CICS RECEIVE MAP into CCRDSLAI. - 2200-EDIT-MAP-INPUTS — normalizes */spaces into low-values, then calls 2210-EDIT-ACCOUNT and 2220-EDIT-CARD to validate each field individually (must be numeric, non-zero, correct length), and applies a cross-field check: if both account and card filters are blank, sets NO-SEARCH-CRITERIA-RECEIVED.

Data retrieval (9000-READ-DATA9100-GETCARD-BYACCTCARD, and an alternate 9150-GETCARD-BYACCT paragraph) reads the card file directly by RIDFLD (record ID built from account/card number in WS-CARD-RID) using EXEC CICS READ FILE(LIT-CARDFILENAME) RIDF(...). The source shown is truncated at the start of this READ, so full response-code handling for 9100-GETCARD-BYACCTCARD (and the logic of 9150-GETCARD-BYACCT, which is never called by any performed paragraph in this excerpt) is not visible.

Inputs & outputs

Name Type Purpose
DFHCOMMAREA CICS commarea (linkage) Carries CARDDEMO-COMMAREA (common cross-program navigation/context fields such as CDEMO-FROM-PROGRAM, CDEMO-TO-PROGRAM, CDEMO-ACCT-ID, CDEMO-CARD-NUM) plus a program-specific extension (CA-FROM-PROGRAM, CA-FROM-TRANID) appended after it.
CARDDAT (LIT-CARDFILENAME) CICS file (VSAM, via EXEC CICS READ) Card master file, read by RIDFLD built from card number/account ID (WS-CARD-RID) to fetch card details (embossed name, expiry, status).
CARDAIX (LIT-CARDFILENAME-ACCT-PATH) CICS file (alternate index path, literal defined but read logic not shown in excerpt) Presumably used by 9150-GETCARD-BYACCT for account-only lookup; not confirmed since that paragraph body is not shown and is not performed anywhere in the visible flow.
CCRDSL mapset / CCRDSLA map BMS screen (SEND MAP/RECEIVE MAP) The credit card detail search/display screen: account ID, card number, embossed name, expiry month/year, status, error/info messages.
Copybooks: COCOM01Y, CVCRD01Y, COCRDSL, COTTL01Y, CSDAT01Y, CSMSG01Y, CSMSG02Y, CSUSR01Y, CVACT02Y, CVCUS01Y, DFHAID, DFHBMSCA Copybook data Shared common commarea layout, card/customer record layouts, screen titles, date/time work fields, message/abend structures, signed-on user data, and IBM-supplied BMS/AID constants.
Downstream programs COCRDLIC (list screen), COMEN01C (main menu), or original calling program EXEC CICS XCTL target Program is exited via XCTL on PF3, returning to whichever program/transaction the commarea indicates as caller, defaulting to the main menu.

No SQL tables are used by this program (confirmed — sql_tables is empty); all persistent data access is via CICS file control (EXEC CICS READ).

Things to know

  • Hard-coded literals: transaction ID CCDL, program name COCRDSLC, mapset COCRDSL, map CCRDSLA, file names CARDDAT/CARDAIX, and the related program COCRDLIC/COMEN01C names/tranids are all embedded as WS-LITERALS constants rather than configuration — any rename requires a recompile.
  • Truncated source: the excerpt cuts off mid-statement inside 9100-GETCARD-BYACCTCARD (the EXEC CICS READ ... RIDF clause). Response code handling for this read, the full logic of 9100-GETCARD-BYACCTCARD-EXIT, and the entirety of 9150-GETCARD-BYACCT are not visible in the provided source, so their error paths/behavior cannot be confirmed from what's shown.
  • 9150-GETCARD-BYACCT appears unreachable: it is defined but not listed as performed by any other paragraph in the parsed call graph — its purpose (likely an account-only fallback lookup) is unconfirmed and may be dead code, or the call to it exists in the untruncated portion of the source not shown here.
  • Defensive WHEN OTHER branch: in 0000-MAIN's dispatch, an unexpected combination of flags sets up abend-style fields (ABEND-CULPRIT, ABEND-CODE '0001') and message text but only performs SEND-PLAIN-TEXT — it does not appear to actually invoke EXEC CICS ABEND in this branch, so the "abend" is really just a message display, not a hard abend. This is worth confirming against ABEND-ROUTINE.
  • Commarea size assumptions: the program manually slices DFHCOMMAREA/WS-COMMAREA using LENGTH OF CARDDEMO-COMMAREA and appends a fixed-size program extension. If CARDDEMO-COMMAREA layout changes elsewhere, this offset-based copy could silently misalign data.
  • Validation duplicates messages: SEARCHED-ACCT-ZEROES and SEARCHED-ACCT-NOT-NUMERIC are two different 88-level condition names mapped to the same text value — a cosmetic redundancy in the copybook-like message table.
  • Screen re-entry protocol: the program relies on CDEMO-PGM-REENTER/CDEMO-PGM-ENTER flags in the commarea to distinguish first-call vs. postback; the transaction is re-driven via EXEC CICS RETURN TRANSID(...), so it depends on CICS pseudo-conversational restart semantics rather than a single-shot call — care needed if reused outside CICS.
  • Input normalization: users can clear a filter field using * or spaces, which the program converts to LOW-VALUES internally — a UI convention that isn't obvious from the field definitions alone.

CICS commands

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

Copybooks

COCOM01Y, COCRDSL, 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_SEND_MAP["1000-SEND-MAP"]
    1000_SEND_MAP_EXIT["1000-SEND-MAP-EXIT"]
    1100_SCREEN_INIT["1100-SCREEN-INIT"]
    1100_SCREEN_INIT_EXIT["1100-SCREEN-INIT-EXIT"]
    1200_SETUP_SCREEN_VARS["1200-SETUP-SCREEN-VARS"]
    1200_SETUP_SCREEN_VARS_EXIT["1200-SETUP-SCREEN-VARS-EXIT"]
    1300_SETUP_SCREEN_ATTRS["1300-SETUP-SCREEN-ATTRS"]
    1300_SETUP_SCREEN_ATTRS_EXIT["1300-SETUP-SCREEN-ATTRS-EXIT"]
    1400_SEND_SCREEN["1400-SEND-SCREEN"]
    1400_SEND_SCREEN_EXIT["1400-SEND-SCREEN-EXIT"]
    2000_PROCESS_INPUTS["2000-PROCESS-INPUTS"]
    2000_PROCESS_INPUTS_EXIT["2000-PROCESS-INPUTS-EXIT"]
    2100_RECEIVE_MAP["2100-RECEIVE-MAP"]
    2100_RECEIVE_MAP_EXIT["2100-RECEIVE-MAP-EXIT"]
    2200_EDIT_MAP_INPUTS["2200-EDIT-MAP-INPUTS"]
    2200_EDIT_MAP_INPUTS_EXIT["2200-EDIT-MAP-INPUTS-EXIT"]
    2210_EDIT_ACCOUNT["2210-EDIT-ACCOUNT"]
    2210_EDIT_ACCOUNT_EXIT["2210-EDIT-ACCOUNT-EXIT"]
    2220_EDIT_CARD["2220-EDIT-CARD"]
    2220_EDIT_CARD_EXIT["2220-EDIT-CARD-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"]
    9150_GETCARD_BYACCT["9150-GETCARD-BYACCT"]
    9150_GETCARD_BYACCT_EXIT["9150-GETCARD-BYACCT-EXIT"]
    SEND_LONG_TEXT["SEND-LONG-TEXT"]
    SEND_LONG_TEXT_EXIT["SEND-LONG-TEXT-EXIT"]
    SEND_PLAIN_TEXT["SEND-PLAIN-TEXT"]
    SEND_PLAIN_TEXT_EXIT["SEND-PLAIN-TEXT-EXIT"]
    ABEND_ROUTINE["ABEND-ROUTINE"]
    0000_MAIN --> 1000_SEND_MAP
    0000_MAIN --> 2000_PROCESS_INPUTS
    0000_MAIN --> 9000_READ_DATA
    0000_MAIN -.-> COMMON_RETURN
    0000_MAIN --> SEND_PLAIN_TEXT
    1000_SEND_MAP --> 1100_SCREEN_INIT
    1000_SEND_MAP --> 1200_SETUP_SCREEN_VARS
    1000_SEND_MAP --> 1300_SETUP_SCREEN_ATTRS
    1000_SEND_MAP --> 1400_SEND_SCREEN
    2000_PROCESS_INPUTS --> 2100_RECEIVE_MAP
    2000_PROCESS_INPUTS --> 2200_EDIT_MAP_INPUTS
    2200_EDIT_MAP_INPUTS --> 2210_EDIT_ACCOUNT
    2200_EDIT_MAP_INPUTS --> 2220_EDIT_CARD
    2210_EDIT_ACCOUNT -.-> 2210_EDIT_ACCOUNT_EXIT
    2220_EDIT_CARD -.-> 2220_EDIT_CARD_EXIT
    9000_READ_DATA --> 9100_GETCARD_BYACCTCARD

Paragraphs

Paragraph Line Performs
0000-MAIN 248 YYYY-STORE-PFKEY, 9000-READ-DATA, 1000-SEND-MAP, 1000-SEND-MAP, 2000-PROCESS-INPUTS, 1000-SEND-MAP
COMMON-RETURN 394
0000-MAIN-EXIT 408
1000-SEND-MAP 412 1100-SCREEN-INIT, 1200-SETUP-SCREEN-VARS, 1300-SETUP-SCREEN-ATTRS, 1400-SEND-SCREEN
1000-SEND-MAP-EXIT 423
1100-SCREEN-INIT 427
1100-SCREEN-INIT-EXIT 453
1200-SETUP-SCREEN-VARS 457
1200-SETUP-SCREEN-VARS-EXIT 499
1300-SETUP-SCREEN-ATTRS 502
1300-SETUP-SCREEN-ATTRS-EXIT 559
1400-SEND-SCREEN 563
1400-SEND-SCREEN-EXIT 578
2000-PROCESS-INPUTS 582 2100-RECEIVE-MAP, 2200-EDIT-MAP-INPUTS
2000-PROCESS-INPUTS-EXIT 593
2100-RECEIVE-MAP 596
2100-RECEIVE-MAP-EXIT 605
2200-EDIT-MAP-INPUTS 608 2210-EDIT-ACCOUNT, 2220-EDIT-CARD
2200-EDIT-MAP-INPUTS-EXIT 643
2210-EDIT-ACCOUNT 647
2210-EDIT-ACCOUNT-EXIT 681
2220-EDIT-CARD 685
2220-EDIT-CARD-EXIT 722
9000-READ-DATA 726 9100-GETCARD-BYACCTCARD
9000-READ-DATA-EXIT 732
9100-GETCARD-BYACCTCARD 736
9100-GETCARD-BYACCTCARD-EXIT 775
9150-GETCARD-BYACCT 779
9150-GETCARD-BYACCT-EXIT 810
SEND-LONG-TEXT 820
SEND-LONG-TEXT-EXIT 831
SEND-PLAIN-TEXT 838
SEND-PLAIN-TEXT-EXIT 849
ABEND-ROUTINE 857