COPAUS0C
Source: app-authorization-ims-db2-mq/cbl/COPAUS0C.cbl
Type: CICS transaction program
COPAUS0C — Pending Authorization Summary Screen
Purpose
This CICS program displays a paginated summary list of pending card authorizations (approved/declined transactions awaiting settlement) for a given account. It shows account and customer identification details plus summary counts/amounts of authorizations, and lets a call-center or operations user page through the list (5 records per screen) or drill into a single authorization's detail screen. It is the "list" screen in a Authorization inquiry workflow, paired with a detail program (COPAUS1C).
How it works
Entry (MAIN-PARA)
- If invoked with no COMMAREA (EIBCALEN = 0), it's a fresh start from the menu: the program initializes the commarea, blanks the map, and sends the empty screen (SEND-PAULST-SCREEN).
- If invoked with a COMMAREA but not yet "re-entered" (CDEMO-PGM-REENTER off — i.e., coming from another program such as a menu with an account ID pre-populated), it copies in the account ID, calls GATHER-DETAILS to pull data for that account, and sends the screen.
- On subsequent invocations (user pressed a key), it receives the screen (RECEIVE-PAULST-SCREEN) and dispatches based on EIBAID:
- ENTER → PROCESS-ENTER-KEY (validates account id, handles row selection, re-sends screen)
- PF3 → RETURN-TO-PREV-SCREEN (XCTL back to menu program)
- PF7 → PROCESS-PF7-KEY (page backward)
- PF8 → PROCESS-PF8-KEY (page forward)
- other keys → sets an error flag/message ("Invalid key") and re-sends the screen
- The paragraph always ends with EXEC CICS RETURN TRANSID('CPVS') COMMAREA(...) — pseudo-conversational CICS, resuming on the next user interaction under transaction CPVS.
Enter key (PROCESS-ENTER-KEY)
- Validates the entered account ID is present and numeric; sets error messages/cursor position (ACCTIDL = -1) otherwise.
- If a row was selected with S/s in one of the 5 selection fields (SEL0001I–SEL0005I), it captures the corresponding stored authorization key (CDEMO-CPVS-AUTH-KEYS) and does an EXEC CICS XCTL to the detail program COPAUS1C, passing the commarea forward (context/tranid set for the transfer).
- Otherwise re-runs GATHER-DETAILS to refresh the list for the (possibly newly entered) account.
Gathering data (GATHER-DETAILS → GATHER-ACCOUNT-DETAILS → GET-AUTH-SUMMARY → PROCESS-PAGE-FORWARD)
- GATHER-ACCOUNT-DETAILS looks up the Card Cross-Reference (GETCARDXREF-BYACCT), then Account Master (GETACCTDATA-BYACCT), then Customer Master (GETCUSTDATA-BYCUST) via CICS READ, populating name/address/phone/credit-limit fields on the map.
- GET-AUTH-SUMMARY schedules the IMS PSB (SCHEDULE-PSB) and issues a GU (Get Unique) DL/I call against the PAUTSUM0 root segment keyed by account ID, retrieving approved/declined counts and balances into the summary section of the screen.
- If a summary segment is found, PROCESS-PAGE-FORWARD retrieves up to 5 child detail segments (PAUTDTL1, authorization details) via GET-AUTHORIZATIONS (DL/I GNP — Get Next within Parent), populating each row through POPULATE-AUTH-LIST, and tracks page boundaries (first/last key per page) in the commarea (CDEMO-CPVS-PAUKEY-PREV-PG, CDEMO-CPVS-PAUKEY-LAST).
Paging (PF7 / PF8)
- PROCESS-PF7-KEY (page back): if not already on page 1, repositions to the saved key for the previous page (GET-AUTH-SUMMARY re-fetches summary, then re-scans forward from that key).
- PROCESS-PF8-KEY (page forward): if a "last key" exists, re-fetches the summary and repositions (REPOSITION-AUTHORIZATIONS, DL/I GNP ... WHERE) to resume from where the previous page left off; otherwise shows a "top/bottom of page" message and does not move.
Screen I/O
- SEND-PAULST-SCREEN always de-schedules any active IMS PSB via SYNCPOINT first, populates header info (title, date/time via POPULATE-HEADER-INFO), and sends the BMS map COPAU0A/mapset COPAU00, either erasing the screen or not depending on WS-SEND-ERASE-FLG.
- RECEIVE-PAULST-SCREEN reads back the operator's input into COPAU0AI.
Inputs & outputs
| Resource | Type | Access | Purpose |
|---|---|---|---|
CXACAIX (Card Cross-Reference, accessed by account-ID alt index) |
VSAM/CICS file | READ | Resolve account ID → customer ID and card number (GETCARDXREF-BYACCT) |
ACCTDAT (Account Master) |
VSAM/CICS file | READ | Retrieve account details: credit limit, cash credit limit (GETACCTDATA-BYACCT) |
CUSTDAT (Customer Master) |
VSAM/CICS file | READ | Retrieve customer name, address, phone (GETCUSTDATA-BYCUST) |
IMS database via PSB PSBPAUTB, PCB #1 |
IMS DL/I | GU / GNP | PAUTSUM0 root segment = per-account authorization summary (counts, balances); PAUTDTL1 child segment = individual pending authorization records, keyed by PAUT9CTS |
BMS map COPAU0A / mapset COPAU00 |
CICS terminal I/O | SEND/RECEIVE | The authorization summary list screen (header, account/customer info, summary totals, 5-row auth list, selection fields, error message line) |
DFHCOMMAREA / CARDDEMO-COMMAREA (via COCOM01Y + local CDEMO-CPVS-* fields) |
CICS commarea | pass-through | Carries account ID, navigation state (page number, prior-page keys, last key, selected auth key/flag), and program-to-program routing info across pseudo-conversational turns and to/from COPAUS1C/menu |
Called/target programs: COPAUS1C (detail), COMEN01C/COSGN00C (menu/signon) |
CICS XCTL | outbound | Drill into a selected authorization's detail, or return to the menu (PF3) |
No DB2 tables are used (sql_tables is empty) — all authorization data comes from IMS.
Things to know
- Pseudo-conversational error handling relies on
WS-MESSAGEand cursor positioning (ACCTIDL = -1) — every file/DB error path sets an error flag, builds a message string with response/reason codes, and re-sends the screen; the program does not abend on typical NOTFND/system errors, it displays them to the user instead. - IMS PSB scheduling/de-scheduling is tightly coupled to screen sends:
SCHEDULE-PSBis called before each summary/detail read, andSEND-PAULST-SCREENunconditionally issuesSYNCPOINTand de-schedules the PSB if one is active. This means every screen send commits the current unit of work — a pattern to watch when refactoring, since it affects transaction boundaries. PSB-SCHEDULED-MORE-THAN-ONCEis handled by force-terminating and rescheduling the PSB (EXEC DLI TERMthen re-SCHD) — a workaround for a specific IMS condition, not a normal error path.- Hard-coded values: program names (
COPAUS0C,COPAUS1C,COMEN01C, fallbackCOSGN00C), transaction IDCPVS, PSB namePSBPAUTB, PCB number+1, file DD/dataset names (ACCTDAT,CUSTDAT,CARDDAT,CXACAIX,CCXREF— noteWS-CCXREF-FILEis defined but appears unused in the shown logic). These would need central configuration if ported off mainframe. - Fixed page size of 5 rows — the screen and all list-handling logic (
POPULATE-AUTH-LIST,INITIALIZE-AUTH-DATA, selection fields SEL0001–SEL0005) are hard-wired to exactly 5 authorization rows per page; changing page size requires touching the map, working storage, and multipleEVALUATE WS-IDXblocks. - Only 20 "previous page" keys are retained (
CDEMO-CPVS-PAUKEY-PREV-PGOCCURS 20 TIMES) — paging backward beyond 20 pages is not supported by this structure (behavior beyond that limit is not shown/clear from the code). - Selection validation is minimal: only
'S'/'s'are accepted as valid selection values; anything else in a non-blank selection field yields "Invalid selection. Valid value is S" without further guidance on the correct row/field. - Account ID handling: an invalid/non-numeric account ID resets
WS-ACCT-IDtoLOW-VALUESand blanks the account field on screen; downstream logic (GATHER-DETAILS) only proceeds ifWS-ACCT-IDis notLOW-VALUES, silently skipping data gathering otherwise. - Date/time formatting is manual byte-slicing (e.g.,
PA-AUTH-ORIG-TIME(1:2)etc. into a HH:MM:SS template) rather than using intrinsic date functions — fragile if source segment layouts change. GET-AUTH-SUMMARYhas a commented-out alternate key source (XREF-ACCT-IDvsCDEMO-ACCT-ID) left in the code — worth flagging to confirm which account ID is intended to key the IMS summary lookup, since both exist in working storage.- No SQL/DB2 usage despite this being in a DB2/IMS/MQ-named application folder; all authorization data is IMS-only for this program, which is a useful fact for anyone assuming DB2 involvement based on the repo path.
CICS commands
RETURN, SYNCPOINT, SEND, RECEIVE, READ
Copybooks
CIPAUDTY, CIPAUSMY, COCOM01Y, COPAU00, COTTL01Y, CSDAT01Y, CSMSG01Y, CSMSG02Y, CVACT01Y, CVACT02Y, CVACT03Y, CVCUS01Y, DFHAID, DFHBMSCA
Paragraph flow
flowchart TD
MAIN_PARA["MAIN-PARA"]
PROCESS_ENTER_KEY["PROCESS-ENTER-KEY"]
GATHER_DETAILS["GATHER-DETAILS"]
PROCESS_PF7_KEY["PROCESS-PF7-KEY"]
PROCESS_PF8_KEY["PROCESS-PF8-KEY"]
PROCESS_PAGE_FORWARD["PROCESS-PAGE-FORWARD"]
GET_AUTHORIZATIONS["GET-AUTHORIZATIONS"]
REPOSITION_AUTHORIZATIONS["REPOSITION-AUTHORIZATIONS"]
POPULATE_AUTH_LIST["POPULATE-AUTH-LIST"]
INITIALIZE_AUTH_DATA["INITIALIZE-AUTH-DATA"]
RETURN_TO_PREV_SCREEN["RETURN-TO-PREV-SCREEN"]
SEND_PAULST_SCREEN["SEND-PAULST-SCREEN"]
RECEIVE_PAULST_SCREEN["RECEIVE-PAULST-SCREEN"]
POPULATE_HEADER_INFO["POPULATE-HEADER-INFO"]
GATHER_ACCOUNT_DETAILS["GATHER-ACCOUNT-DETAILS"]
GETCARDXREF_BYACCT["GETCARDXREF-BYACCT"]
GETACCTDATA_BYACCT["GETACCTDATA-BYACCT"]
GETCUSTDATA_BYCUST["GETCUSTDATA-BYCUST"]
GET_AUTH_SUMMARY["GET-AUTH-SUMMARY"]
SCHEDULE_PSB["SCHEDULE-PSB"]
GATHER_ACCOUNT_DETAILS --> GET_AUTH_SUMMARY
GATHER_ACCOUNT_DETAILS --> GETACCTDATA_BYACCT
GATHER_ACCOUNT_DETAILS --> GETCARDXREF_BYACCT
GATHER_ACCOUNT_DETAILS --> GETCUSTDATA_BYCUST
GATHER_DETAILS --> GATHER_ACCOUNT_DETAILS
GATHER_DETAILS --> INITIALIZE_AUTH_DATA
GATHER_DETAILS --> PROCESS_PAGE_FORWARD
GET_AUTH_SUMMARY --> SCHEDULE_PSB
GET_AUTH_SUMMARY --> SEND_PAULST_SCREEN
GET_AUTHORIZATIONS --> SEND_PAULST_SCREEN
GETACCTDATA_BYACCT --> SEND_PAULST_SCREEN
GETCARDXREF_BYACCT --> SEND_PAULST_SCREEN
GETCUSTDATA_BYCUST --> SEND_PAULST_SCREEN
MAIN_PARA --> GATHER_DETAILS
MAIN_PARA --> PROCESS_ENTER_KEY
MAIN_PARA --> PROCESS_PF7_KEY
MAIN_PARA --> PROCESS_PF8_KEY
MAIN_PARA --> RECEIVE_PAULST_SCREEN
MAIN_PARA --> RETURN_TO_PREV_SCREEN
MAIN_PARA --> SEND_PAULST_SCREEN
PROCESS_ENTER_KEY --> GATHER_DETAILS
PROCESS_PAGE_FORWARD --> GET_AUTHORIZATIONS
PROCESS_PAGE_FORWARD --> POPULATE_AUTH_LIST
PROCESS_PAGE_FORWARD --> REPOSITION_AUTHORIZATIONS
PROCESS_PF7_KEY --> GET_AUTH_SUMMARY
PROCESS_PF7_KEY --> INITIALIZE_AUTH_DATA
PROCESS_PF7_KEY --> PROCESS_PAGE_FORWARD
PROCESS_PF8_KEY --> GET_AUTH_SUMMARY
PROCESS_PF8_KEY --> INITIALIZE_AUTH_DATA
PROCESS_PF8_KEY --> PROCESS_PAGE_FORWARD
PROCESS_PF8_KEY --> REPOSITION_AUTHORIZATIONS
REPOSITION_AUTHORIZATIONS --> SEND_PAULST_SCREEN
SCHEDULE_PSB --> SEND_PAULST_SCREEN
SEND_PAULST_SCREEN --> POPULATE_HEADER_INFO
Paragraphs
| Paragraph | Line | Performs |
|---|---|---|
| MAIN-PARA | 178 | SEND-PAULST-SCREEN, GATHER-DETAILS, SEND-PAULST-SCREEN, RECEIVE-PAULST-SCREEN, PROCESS-ENTER-KEY, SEND-PAULST-SCREEN |
| PROCESS-ENTER-KEY | 261 | GATHER-DETAILS |
| GATHER-DETAILS | 342 | GATHER-ACCOUNT-DETAILS, INITIALIZE-AUTH-DATA, PROCESS-PAGE-FORWARD |
| PROCESS-PF7-KEY | 362 | GET-AUTH-SUMMARY, INITIALIZE-AUTH-DATA, PROCESS-PAGE-FORWARD |
| PROCESS-PF8-KEY | 388 | GET-AUTH-SUMMARY, REPOSITION-AUTHORIZATIONS, INITIALIZE-AUTH-DATA, PROCESS-PAGE-FORWARD |
| PROCESS-PAGE-FORWARD | 415 | REPOSITION-AUTHORIZATIONS, GET-AUTHORIZATIONS, POPULATE-AUTH-LIST, GET-AUTHORIZATIONS |
| GET-AUTHORIZATIONS | 458 | SEND-PAULST-SCREEN |
| REPOSITION-AUTHORIZATIONS | 488 | SEND-PAULST-SCREEN |
| POPULATE-AUTH-LIST | 522 | |
| INITIALIZE-AUTH-DATA | 608 | |
| RETURN-TO-PREV-SCREEN | 665 | |
| SEND-PAULST-SCREEN | 681 | POPULATE-HEADER-INFO |
| RECEIVE-PAULST-SCREEN | 712 | |
| POPULATE-HEADER-INFO | 726 | |
| GATHER-ACCOUNT-DETAILS | 750 | GETCARDXREF-BYACCT, GETACCTDATA-BYACCT, GETCUSTDATA-BYCUST, GET-AUTH-SUMMARY |
| GETCARDXREF-BYACCT | 812 | SEND-PAULST-SCREEN, SEND-PAULST-SCREEN |
| GETACCTDATA-BYACCT | 865 | SEND-PAULST-SCREEN, SEND-PAULST-SCREEN |
| GETCUSTDATA-BYCUST | 915 | SEND-PAULST-SCREEN, SEND-PAULST-SCREEN |
| GET-AUTH-SUMMARY | 966 | SCHEDULE-PSB, SEND-PAULST-SCREEN |
| SCHEDULE-PSB | 1001 | SEND-PAULST-SCREEN |