# Workflows

> [← Back to README](../README.md) | [Business Logic](./business-logic.md) | [Decision Logic →](./decision-logic.md)

## Regular User Journey

```
1. SIGN-ON (CC00/COSGN00C)
   ├─ Enter User ID + Password
   ├─ System validates against USRSEC
   └─ Success → Main Menu (CM00)

2. MAIN MENU (CM00/COMEN01C)
   ├─ Option 1: Account View (CAVW)
   ├─ Option 2: Account Update (CAUP)
   ├─ Option 3: Credit Card List (CCLI)
   │   ├─ Select card → Card Detail (CCDL)
   │   └─ Select card → Card Update (CCUP)
   ├─ Option 4: Bill Payment (CB00)
   ├─ Option 5: Transaction List (CT00)
   │   └─ Select → Transaction View (CT01)
   ├─ Option 6: Transaction Add (CT02)
   ├─ Option 7: Transaction Reports (CR00)
   ├─ Option 11: Pending Auth Summary (CPVS) [optional]
   │   └─ Select → Auth Detail (CPVD) [optional]
   ├─ PF3: Sign-off → Return to CC00
   └─ Invalid option → Error message

3. Each function screen:
   ├─ ENTER: Process/confirm action
   ├─ PF3: Return to Main Menu
   ├─ PF7/PF8: Page up/down (list screens)
   └─ PF5: Edit mode (from view screens)
```

## Admin User Journey

```
1. SIGN-ON (CC00/COSGN00C)
   ├─ Enter Admin ID + Password
   ├─ SEC-USR-TYPE = 'A' (admin)
   └─ Success → Admin Menu (CA00)

2. ADMIN MENU (CA00/COADM01C)
   ├─ Option 1: User List (CU00)
   │   ├─ Select → Update User (CU02)
   │   └─ Select → Delete User (CU03)
   ├─ Option 2: Add User (CU01)
   ├─ Option 5: Tran Type List (CTLI) [optional DB2]
   ├─ Option 6: Tran Type Add (CTTU) [optional DB2]
   └─ PF3: Sign-off
```

## Batch Processing Workflow — Daily

```
Step 1: CLOSEFIL   — Close VSAM files in CICS
Step 2: POSTTRAN   — Post daily transactions (CBTRN02C)
         ├─ Read DALYTRAN (daily input)
         ├─ Validate against XREFDAT
         ├─ Update ACCTDAT balances
         ├─ Write to TRANSACT master
         └─ Update TCATBALF category balances
Step 3: WAITSTEP   — Wait for file propagation
Step 4: OPENFIL    — Re-open VSAM files in CICS
```

## Batch Processing Workflow — Monthly

```
Step 1: CLOSEFIL   — Close VSAM files
Step 2: INTCALC    — Run interest calculations (CBACT04C)
         ├─ For each account via XREFDAT
         ├─ Lookup rates in DISCGRP
         ├─ Calculate interest per category
         ├─ Write interest transactions to TRANSACT
         └─ Update ACCTDAT and TCATBALF
Step 3: COMBTRAN   — Combine transaction files (SORT)
Step 4: CREASTMT   — Generate statements (CBSTM03A/B)
Step 5: WAITSTEP   — Wait
Step 6: OPENFIL    — Re-open files
```

## MQ Authorization Workflow (Optional)

```
1. External system sends auth request → MQ Request Queue
2. MQ trigger starts COPAUA0C
3. COPAUA0C:
   ├─ MQGET request message
   ├─ Validate card via VSAM CCXREF
   ├─ Read account from ACCTDAT
   ├─ Read customer from CUSTDAT
   ├─ Check/update IMS authorization database
   ├─ Log to DB2 AUTHFRDS (fraud check)
   └─ MQPUT reply message (approve/deny)
4. External system receives response from MQ Reply Queue
```

---

*See also: [Business Logic](./business-logic.md) | [Decision Logic](./decision-logic.md) | [Diagrams](../diagrams/behavioral/transaction-flows.md)*
