# lifeisox/cobol-project-4 architecture

> Architecture diagram of the GitHub repository lifeisox/cobol-project-4, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lifeisox/cobol-project-4
- Repository: https://github.com/lifeisox/cobol-project-4

## Overview

##### Project type and purpose
- This is a COBOL‐based batch and online business programming project that manipulates an inventory master file, transaction file, suppliers file, and produces reports.
- It consists of several standalone COBOL programs (batch update, file conversion, online update, reporting) plus shared copybooks and called modules.

##### File structure
- Top‐level COBOL sources:
- BatchUpdate.cbl – Master file batch update
- ConvertToIndex.cbl – Conversion to indexed sequential files
- OnlineUpdate.cbl – Interactive (online) updates via screen I/O
- InventReport.cbl – Inventory report from indexed master
- ComputeValue.cbl – Called routine to compute inventory value
- Shared record definitions:
- InventRecord.cpy – Inventory record copybook
- README.md defines file names, sequencing, and processing requirements.

##### Main components of the system
a. Batch Update Program (BatchUpdate.cbl)
- Reads: INVENT4.txt (Master), TRANSACTIONS.TXT (Transaction)
- Uses EVALUATE to route transaction types
- Writes: INVENT5.txt (Updated Master)
b. File Conversion Program (ConvertToIndex.cbl)
- Reads: INVENT5.txt, SUPPLIERS.txt
- Writes: INVENT6 (Indexed Master), SUPPLIERI (Indexed Suppliers)
c. Online Update Program (OnlineUpdate.cbl)
- Screen Section for user input (interactive transactions)
- Reads/Writes: INVENT6 (Indexed Master), SUPPLIERI
d. Reporting Programs
- InventReport.cbl – Reads INVENT6, calls ComputeValue.cbl, outputs inventory report
- Re‐Order Report – (can be added or integrated) reads INVENT6 + SUPPLIERI to join and display re‐order data
e. Shared Libraries
- ComputeValue.cbl – business logic module (called via CALL)
- InventRecord.cpy – COPY’d into programs for record layouts

##### Relationships and data flows
- BatchUpdate → updates flat master → output INVENT5
- ConvertToIndex reads INVENT5 & SUPPLIERS.txt → outputs two indexed files
- OnlineUpdate uses indexed files for CRUD‐style updates
- InventReport and Re‐Order Report both read indexed files; reports call ComputeValue

##### Architectural patterns and design principles
- Modularization: each COBOL program implements one major function
- Reuse via COPY (for record definitions) and CALL (for ComputeValue logic)
- Single source of truth for files, sequential→indexed transitions
- Batch vs. online separation: scheduled batch + interactive module

##### Relevant technologies, frameworks, libraries
- COBOL 85 (or above) runtime
- Indexed Sequential Access Method (ISAM) for INVENT6/SUPPLIERI
- Screen Section for CICS‐like interactive I/O in OnlineUpdate

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Batch Layer
    subgraph "Batch Layer"
        BU["BatchUpdate.cbl"]:::batch
        INV4[(INVENT4.txt)]:::file
        TX[(TRANSACTIONS.TXT)]:::file
        INV5[(INVENT5.txt)]:::file
    end

    %% Conversion Layer
    subgraph "Conversion Layer"
        CV["ConvertToIndex.cbl"]:::conversion
        SUP[(SUPPLIERS.txt)]:::file
        INV6[(INVENT6)]:::file
        SUPI[(SUPPLIERSI)]:::file
    end

    %% Online & Reporting Layer
    subgraph "Online & Reporting Layer"
        OU["OnlineUpdate.cbl"]:::online
        IR["InventReport.cbl"]:::report
        ROR["Re-Order Report"]:::report
    end

    %% Shared Libraries
    COMP["ComputeValue.cbl"]:::shared
    COPY["InventRecord.cpy"]:::shared
    README["README.md"]:::doc

    %% Data Flows - Batch
    INV4 -->|"READ"| BU
    TX -->|"READ"| BU
    BU -->|"WRITE"| INV5

    %% Data Flows - Conversion
    INV5 -->|"READ"| CV
    SUP -->|"READ"| CV
    CV -->|"WRITE"| INV6
    CV -->|"WRITE"| SUPI

    %% Data Flows - Online
    INV6 -->|"READ/WRITE"| OU
    SUPI -->|"READ/WRITE"| OU

    %% Data Flows - Reporting
    INV6 -->|"READ"| IR
    IR -->|"CALL"| COMP
    INV6 -->|"READ"| ROR
    SUPI -->|"READ"| ROR

    %% Shared Copy and Documentation links
    COPY -.-> BU
    COPY -.-> CV
    COPY -.-> OU
    COPY -.-> IR
    README -.-> BU

    %% Click Events
    click BU "https://github.com/lifeisox/cobol-project-4/blob/master/BatchUpdate.cbl"
    click CV "https://github.com/lifeisox/cobol-project-4/blob/master/ConvertToIndex.cbl"
    click OU "https://github.com/lifeisox/cobol-project-4/blob/master/OnlineUpdate.cbl"
    click IR "https://github.com/lifeisox/cobol-project-4/blob/master/InventReport.cbl"
    click COMP "https://github.com/lifeisox/cobol-project-4/blob/master/ComputeValue.cbl"
    click COPY "https://github.com/lifeisox/cobol-project-4/blob/master/InventRecord.cpy"
    click README "https://github.com/lifeisox/cobol-project-4/blob/master/README.md"

    %% Styles
    classDef batch fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef conversion fill:#90EE90,stroke:#333,stroke-width:1px
    classDef online fill:#FFA500,stroke:#333,stroke-width:1px
    classDef report fill:#DDA0DD,stroke:#333,stroke-width:1px
    classDef shared fill:#fff,stroke:#444,stroke-dasharray: 5 5
    classDef file fill:#f0f0f0,stroke:#555
    classDef doc fill:#ffffe0,stroke:#555,stroke-dasharray: 2 2
```
