# Behavioral Diagrams — Sign-on and Navigation

> [← Back to README](../../README.md)

## Sign-on Sequence (COSGN00C)

```mermaid
sequenceDiagram
    participant U as User Terminal
    participant S as COSGN00C
    participant V as USRSEC VSAM

    U->>S: CC00 Transaction (initial)
    S->>U: Display sign-on screen (COSGN00.bms)
    U->>S: Enter UserID + Password
    S->>V: READ USRSEC by SEC-USR-ID
    alt User Found
        alt Password matches
            alt Admin user (SEC-USR-TYPE = 'A')
                S->>U: XCTL → COADM01C (Admin Menu)
            else Regular user
                S->>U: XCTL → COMEN01C (Main Menu)
            end
        else Password mismatch
            S->>U: "Invalid password" message
        end
    else User Not Found
        S->>U: "User ID not found" message
    end
```

## Menu Navigation Flow

```mermaid
flowchart TD
    CC00[CC00: Sign-on] --> |regular|CM00[CM00: Main Menu]
    CC00 --> |admin|CA00[CA00: Admin Menu]
    
    CM00 --> |1|CAVW[Account View]
    CM00 --> |2|CAUP[Account Update]
    CM00 --> |3|CCLI[Card List]
    CM00 --> |4|CB00[Bill Payment]
    CM00 --> |5|CT00[Transaction List]
    CM00 --> |6|CT02[Transaction Add]
    CM00 --> |7|CR00[Reports]
    CM00 --> |11|CPVS[Pending Auth]
    
    CCLI --> CCDL[Card Detail]
    CCLI --> CCUP[Card Update]
    CT00 --> CT01[Transaction View]
    CPVS --> CPVD[Auth Detail]
    
    CA00 --> |1|CU00[User List]
    CA00 --> |2|CU01[Add User]
    CA00 --> |5|CTLI[Tran Type List]
    CA00 --> |6|CTTU[Tran Type Add]
    
    CU00 --> CU02[Update User]
    CU00 --> CU03[Delete User]
```

## Batch Transaction Posting (CBTRN02C)

```mermaid
flowchart TD
    START[Open Files] --> READ[Read DALYTRAN record]
    READ --> |EOF|CLOSE[Close Files / Display Stats]
    READ --> XREF{XREF Exists?}
    XREF --> |No|REJECT[Write to Reject]
    XREF --> |Yes|ACCT{Account Exists?}
    ACCT --> |No|REJECT
    ACCT --> |Yes|ACTIVE{Account Active?}
    ACTIVE --> |No|REJECT
    ACTIVE --> |Yes|POST[Post Transaction]
    POST --> UPDBAL[Update Account Balance]
    UPDBAL --> UPDCAT[Update Category Balance]
    UPDCAT --> WRITE[Write to TRANSACT]
    WRITE --> READ
    REJECT --> READ
```

## Interest Calculation Flow (CBACT04C)

```mermaid
flowchart TD
    START[Accept Date Parameter] --> BROWSE[Browse XREFDAT]
    BROWSE --> |Next Record|RDACCT[Read ACCTDAT]
    BROWSE --> |EOF|DONE[End Processing]
    RDACCT --> RDCAT[Read TCATBALF for Account]
    RDCAT --> |Each Category|RDDISC[Read DISCGRP Rate]
    RDDISC --> |Found|CALC[Calculate Interest]
    RDDISC --> |Not Found|SKIP[Skip Category]
    CALC --> WRTTRAN[Write Interest Transaction]
    WRTTRAN --> UPDACCT[Update Account Balance]
    UPDACCT --> UPDCAT[Update Category Balance]
    UPDCAT --> RDCAT
    SKIP --> RDCAT
    RDCAT --> |Done|BROWSE
```

---

*See also: [Workflows](../../behavior/workflows.md) | [Business Logic](../../behavior/business-logic.md)*
