# Modernizing a Cobol accounting system to a Node.js application using GitHub Copilot
[](https://github.com/math974/modernize-legacy-cobol-app/actions/workflows/test.yml)
[](https://github.com/math974/modernize-legacy-cobol-app/actions/workflows/test.yml)
[](https://github.com/math974/modernize-legacy-cobol-app/actions/workflows/test.yml)
[](https://github.com/math974/modernize-legacy-cobol-app/actions/workflows/test.yml)
[](https://pypi.org/project/legacy-cobol-modernization/)
[](https://pypi.org/project/legacy-cobol-modernization/)
[](https://www.python.org/)
[](https://gnucobol.sourceforge.io/)
[](https://github.com/astral-sh/ruff)
[](https://opensource.org/licenses/MIT)
This repo contains COBOL code for a simple accounting system. You can use GitHub Copilot to transform this code to a Node.js accounting system.
**Note: Keep in mind GitHub Copilot is an AI pair programmer that helps you write code. It is not a code generator and is using generative
models trained on public code. It may provide completions that are not perfect, safe, or otherwise suitable for production. Always review suggestions
and take a trust but verify approach.**
<img src="images/cobol_to_nodejs.png" alt="Cobol to Node.js" width="800"/>
## 📦 Quick Installation via PyPI
Install the modernized COBOL accounting system directly from PyPI:
```bash
# Install the package
pip install legacy-cobol-modernization
# Run the application
legacy-accounting
```
### Alternative Installation Methods
```bash
# Install with development tools
pip install legacy-cobol-modernization[dev]
# Install with testing tools only
pip install legacy-cobol-modernization[test]
# Install from source
git clone https://github.com/math974/modernize-legacy-cobol-app.git
cd modernize-legacy-cobol-app
pip install -e .
```
### Usage After Installation
```bash
# Run the accounting system
legacy-accounting
# Or use the alternative command
cobol-accounting
```
## Prerequisites
- Basic understanding of programming concepts.
- Basic understanding of the COBOL programming language.
- GitHub Copilot or GitHub Copilot Chat installed in your IDE or GitHub Codespace.
## Setup the development environment
### Option 1: Use an IDE that supports GitHub Copilot
- IDE options for both GitHub Copilot and Copilot Chat:
- <img src="images/ide-vscode.png" alt="Visual Studio Code" width="20"/> Visual Studio Code
- <img src="images/ide-vs.png" alt="Visual Studio" width="20"/> Visual Studio
- <img src="images/ide-jetbrains.png" alt="JetBrains IDE" width="20"/> JetBrains IDE
#### For Visual Studio Code
- Install the GitHub Copilot and GitHub Copilot Chat extensions for Visual Studio Code.
- Install the COBOL extension for Visual Studio Code.
### Option 2: Use a GitHub codespace
- Create a new codespace in this repository. </br>

- The configuration for the codespace is already set up with the required extensions.
- GitHub Copilot
- GitHub Copilot Chat
- COBOL
- Markdown All in One
- Mermaid Markdown
- python
## About the program
This COBOL program simulates an account management system. This program will involve multiple COBOL source files and perform various operations like crediting, debiting, viewing the balance, and even exiting the program. Here’s how you its structured:
- Main Program (main.cob): The main program will handle the user interface and call subprograms for different operations.
- Operations Program (operations.cob): This program will handle the actual operations like credit, debit, and view balance.
- Data Storage Program (data.cob): This program will manage the storage of the account balance.
## Steps to Compile and Run the Program
- Option 1: Install COBOL compiler on MaC
If you don't already have a COBOL compiler, you'll need to install one. Common COBOL compiler is GnuCOBOL: An open-source COBOL compiler. To Install , use brew:
```bash
brew install gnucobol
```
- Option 2: Open the terminal in the GitHub codespace or Ubuntu Linux system and run the following command to install the COBOL compiler:
```bash
sudo apt-get update && \
sudo apt-get install gnucobol
```
reference: [gnucobol](https://formulae.brew.sh/formula/gnucobol)
- Compile, link and create executable: Link the object files together to create the final executable:
```bash
cobc -x main.cob operations.cob data.cob -o accountsystem
```
- Run the Program: Run the executable to start the account management system:
```bash
./accountsystem
```
## Program Interaction Example
- Program starts with user input menu
```bash
--------------------------------
Account Management System
1. View Balance
2. Credit Account
3. Debit Account
4. Exit
--------------------------------
Enter your choice (1-4):
```
- User Chooses to View Balance:
```bash
Current balance: 1000.00
```
- User Chooses to Credit:
```bash
Enter credit amount:
200.00
Amount credited. New balance: 1200.00
```
- User Chooses to Debit:
```bash
Enter debit amount:
300.00
Amount debited. New balance: 900.00
```
- User Chooses to Exit:
```bash
Exiting the program. Goodbye!
```
## Explanation
- main.cob: This is the main interface where users select operations.
- operations.cob: It handles specific operations such as viewing, crediting, and debiting the account balance.
- data.cob: This program acts as a simple data storage, handling reading and writing of the balance.
This multi-file structure introduces modularity, making it easier to manage and extend the program. Each file has a clear responsibility, and the program flow is driven by user interaction.
### Data flow
```text
@workspace can you create a sequence diagram of the app showing the data flow of the app. Please create this in mermaid format so that I can render this in a markdown file.
```
```mermaid
sequenceDiagram
participant User
participant MainProgram
participant Operations
participant DataProgram
User->>MainProgram: Start Application
MainProgram->>User: Display Menu
User->>MainProgram: Select Option (1-4)
alt View Balance
MainProgram->>Operations: CALL 'Operations' USING 'TOTAL'
Operations->>DataProgram: CALL 'DataProgram' USING 'READ', FINAL-BALANCE
DataProgram-->>Operations: RETURN FINAL-BALANCE
Operations->>User: DISPLAY "Current balance: " FINAL-BALANCE
end
alt Credit Account
MainProgram->>Operations: CALL 'Operations' USING 'CREDIT'
Operations->>User: DISPLAY "Enter credit amount: "
User->>Operations: Enter Amount
Operations->>DataProgram: CALL 'DataProgram' USING 'READ', FINAL-BALANCE
DataProgram-->>Operations: RETURN FINAL-BALANCE
Operations->>Operations: ADD AMOUNT TO FINAL-BALANCE
Operations->>DataProgram: CALL 'DataProgram' USING 'WRITE', FINAL-BALANCE
DataProgram-->>Operations: RETURN
Operations->>User: DISPLAY "Amount credited. New balance: " FINAL-BALANCE
end
alt Debit Account
MainProgram->>Operations: CALL 'Operations' USING 'DEBIT'
Operations->>User: DISPLAY "Enter debit amount: "
User->>Operations: Enter Amount
Operations->>DataProgram: CALL 'DataProgram' USING 'READ', FINAL-BALANCE
DataProgram-->>Operations: RETURN FINAL-BALANCE
alt Sufficient Funds
Operations->>Operations: SUBTRACT AMOUNT FROM FINAL-BALANCE
Operations->>DataProgram: CALL 'DataProgram' USING 'WRITE', FINAL-BALANCE
DataProgram-->>Operations: RETURN
Operations->>User: DISPLAY "Amount debited. New balance: " FINAL-BALANCE
else Insufficient Funds
Operations->>User: DISPLAY "Insufficient funds for this debit."
end
end
alt Exit Application
MainProgram->>MainProgram: MOVE 'NO' TO CONTINUE-FLAG
MainProgram->>User: DISPLAY "Exiting the program. Goodbye!"
end
```
## Generate a test plan
```text
@workspace The current Cobol app has no tests. Can you please create a test plan of current business logic that I can use to validate with business stakeholders about the current implementation.
Later I would like to use this test plan to create unit and integration tests in a node.js app. I am in the middle of transforming the current Cobol app to a node.js app.
The test plan should include the following:
1. Test Case ID
2. Test Case Description
3. Pre-conditions
4. Test Steps
5. Expected Result
6. Actual Result
7. Status (Pass/Fail)
8. Comments
Please create the test plan in a markdown table format. The test plan should cover all the business logic in the current Cobol app.
```
### Note
*You may still need follow up with another prompt to generate the markdown file format for the test plan.*
```markdown
Convert this to markdown syntax please to insert as a new file
```
## Convert files using prompt engineering best practices
### Create the Node.js project directory
```bash
mkdir node-accounting-app
cd node-accounting-app
```
### Use GitHub Copilot to convert the files iteratively
#### Convert main.cob to main.js
#### Convert operations.cob to operations.js
#### Convert data.cob to data.js
```text
Let's link all node.js files to work together in one accounting application, and then initialize, install dependencies, and run the application.
```
### Initialize a new Node.js project
```bash
npm init -y
```
### Install the Node.js app
```bash
npm install
```
### Run the Node.js app
```bash
node main.js
```
### Generate unit and integration tests
```text
@workspace I would like to create unit and integration tests cases form the test plan mentioned in
#file:TESTPLAN.md file The node.js code is in node-accounting-app folder and I am looking to generate tests
for #file:operations.js file. Use a popular testing framework and also provide all the dependencies required to run the tests.
```
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/math974/modernize-legacy-cobol-app",
"name": "legacy-cobol-modernization",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "cobol, legacy, modernization, golden-master, testing, accounting, migration, python",
"author": "Your Name",
"author_email": "Your Name <your.email@example.com>",
"download_url": "https://files.pythonhosted.org/packages/68/50/175e980542ed6766178c73a00bffe5826824890ea9738814a148db4eeb87/legacy_cobol_modernization-1.0.4.tar.gz",
"platform": null,
"description": "# Modernizing a Cobol accounting system to a Node.js application using GitHub Copilot\n\n[](https://github.com/math974/modernize-legacy-cobol-app/actions/workflows/test.yml)\n[](https://github.com/math974/modernize-legacy-cobol-app/actions/workflows/test.yml)\n[](https://github.com/math974/modernize-legacy-cobol-app/actions/workflows/test.yml)\n[](https://github.com/math974/modernize-legacy-cobol-app/actions/workflows/test.yml)\n[](https://pypi.org/project/legacy-cobol-modernization/)\n[](https://pypi.org/project/legacy-cobol-modernization/)\n[](https://www.python.org/)\n[](https://gnucobol.sourceforge.io/)\n[](https://github.com/astral-sh/ruff)\n[](https://opensource.org/licenses/MIT)\n\nThis repo contains COBOL code for a simple accounting system. You can use GitHub Copilot to transform this code to a Node.js accounting system.\n\n**Note: Keep in mind GitHub Copilot is an AI pair programmer that helps you write code. It is not a code generator and is using generative\nmodels trained on public code. It may provide completions that are not perfect, safe, or otherwise suitable for production. Always review suggestions\nand take a trust but verify approach.**\n\n<img src=\"images/cobol_to_nodejs.png\" alt=\"Cobol to Node.js\" width=\"800\"/>\n\n## \ud83d\udce6 Quick Installation via PyPI\n\nInstall the modernized COBOL accounting system directly from PyPI:\n\n```bash\n# Install the package\npip install legacy-cobol-modernization\n\n# Run the application\nlegacy-accounting\n```\n\n### Alternative Installation Methods\n\n```bash\n# Install with development tools\npip install legacy-cobol-modernization[dev]\n\n# Install with testing tools only \npip install legacy-cobol-modernization[test]\n\n# Install from source\ngit clone https://github.com/math974/modernize-legacy-cobol-app.git\ncd modernize-legacy-cobol-app\npip install -e .\n```\n\n### Usage After Installation\n\n```bash\n# Run the accounting system\nlegacy-accounting\n\n# Or use the alternative command\ncobol-accounting\n```\n\n## Prerequisites\n\n- Basic understanding of programming concepts.\n- Basic understanding of the COBOL programming language.\n- GitHub Copilot or GitHub Copilot Chat installed in your IDE or GitHub Codespace.\n\n## Setup the development environment\n\n### Option 1: Use an IDE that supports GitHub Copilot\n\n- IDE options for both GitHub Copilot and Copilot Chat:\n - <img src=\"images/ide-vscode.png\" alt=\"Visual Studio Code\" width=\"20\"/> Visual Studio Code\n - <img src=\"images/ide-vs.png\" alt=\"Visual Studio\" width=\"20\"/> Visual Studio\n - <img src=\"images/ide-jetbrains.png\" alt=\"JetBrains IDE\" width=\"20\"/> JetBrains IDE\n\n#### For Visual Studio Code\n\n- Install the GitHub Copilot and GitHub Copilot Chat extensions for Visual Studio Code.\n- Install the COBOL extension for Visual Studio Code.\n\n### Option 2: Use a GitHub codespace\n\n- Create a new codespace in this repository. </br>\n\n\n- The configuration for the codespace is already set up with the required extensions.\n - GitHub Copilot\n - GitHub Copilot Chat\n - COBOL\n - Markdown All in One\n - Mermaid Markdown\n - python\n\n## About the program\n\nThis COBOL program simulates an account management system. This program will involve multiple COBOL source files and perform various operations like crediting, debiting, viewing the balance, and even exiting the program. Here\u2019s how you its structured:\n\n- Main Program (main.cob): The main program will handle the user interface and call subprograms for different operations.\n- Operations Program (operations.cob): This program will handle the actual operations like credit, debit, and view balance.\n- Data Storage Program (data.cob): This program will manage the storage of the account balance.\n\n## Steps to Compile and Run the Program\n\n- Option 1: Install COBOL compiler on MaC\nIf you don't already have a COBOL compiler, you'll need to install one. Common COBOL compiler is GnuCOBOL: An open-source COBOL compiler. To Install , use brew:\n\n```bash\nbrew install gnucobol \n```\n\n- Option 2: Open the terminal in the GitHub codespace or Ubuntu Linux system and run the following command to install the COBOL compiler:\n\n```bash\nsudo apt-get update && \\\nsudo apt-get install gnucobol\n```\n\nreference: [gnucobol](https://formulae.brew.sh/formula/gnucobol)\n\n- Compile, link and create executable: Link the object files together to create the final executable:\n\n```bash\ncobc -x main.cob operations.cob data.cob -o accountsystem\n```\n\n- Run the Program: Run the executable to start the account management system:\n\n```bash\n./accountsystem\n```\n\n## Program Interaction Example\n\n- Program starts with user input menu\n\n```bash\n--------------------------------\nAccount Management System\n1. View Balance\n2. Credit Account\n3. Debit Account\n4. Exit\n--------------------------------\nEnter your choice (1-4): \n```\n\n- User Chooses to View Balance:\n\n```bash\nCurrent balance: 1000.00\n```\n\n- User Chooses to Credit:\n\n```bash\nEnter credit amount:\n200.00\nAmount credited. New balance: 1200.00\n```\n\n- User Chooses to Debit:\n\n```bash\nEnter debit amount:\n300.00\nAmount debited. New balance: 900.00\n```\n\n- User Chooses to Exit:\n\n```bash\nExiting the program. Goodbye!\n```\n\n## Explanation\n\n- main.cob: This is the main interface where users select operations.\n- operations.cob: It handles specific operations such as viewing, crediting, and debiting the account balance.\n- data.cob: This program acts as a simple data storage, handling reading and writing of the balance.\n\nThis multi-file structure introduces modularity, making it easier to manage and extend the program. Each file has a clear responsibility, and the program flow is driven by user interaction.\n\n### Data flow\n\n```text\n@workspace can you create a sequence diagram of the app showing the data flow of the app. Please create this in mermaid format so that I can render this in a markdown file.\n```\n\n```mermaid\nsequenceDiagram\n participant User\n participant MainProgram\n participant Operations\n participant DataProgram\n\n User->>MainProgram: Start Application\n MainProgram->>User: Display Menu\n User->>MainProgram: Select Option (1-4)\n \n alt View Balance\n MainProgram->>Operations: CALL 'Operations' USING 'TOTAL'\n Operations->>DataProgram: CALL 'DataProgram' USING 'READ', FINAL-BALANCE\n DataProgram-->>Operations: RETURN FINAL-BALANCE\n Operations->>User: DISPLAY \"Current balance: \" FINAL-BALANCE\n end\n \n alt Credit Account\n MainProgram->>Operations: CALL 'Operations' USING 'CREDIT'\n Operations->>User: DISPLAY \"Enter credit amount: \"\n User->>Operations: Enter Amount\n Operations->>DataProgram: CALL 'DataProgram' USING 'READ', FINAL-BALANCE\n DataProgram-->>Operations: RETURN FINAL-BALANCE\n Operations->>Operations: ADD AMOUNT TO FINAL-BALANCE\n Operations->>DataProgram: CALL 'DataProgram' USING 'WRITE', FINAL-BALANCE\n DataProgram-->>Operations: RETURN\n Operations->>User: DISPLAY \"Amount credited. New balance: \" FINAL-BALANCE\n end\n \n alt Debit Account\n MainProgram->>Operations: CALL 'Operations' USING 'DEBIT'\n Operations->>User: DISPLAY \"Enter debit amount: \"\n User->>Operations: Enter Amount\n Operations->>DataProgram: CALL 'DataProgram' USING 'READ', FINAL-BALANCE\n DataProgram-->>Operations: RETURN FINAL-BALANCE\n alt Sufficient Funds\n Operations->>Operations: SUBTRACT AMOUNT FROM FINAL-BALANCE\n Operations->>DataProgram: CALL 'DataProgram' USING 'WRITE', FINAL-BALANCE\n DataProgram-->>Operations: RETURN\n Operations->>User: DISPLAY \"Amount debited. New balance: \" FINAL-BALANCE\n else Insufficient Funds\n Operations->>User: DISPLAY \"Insufficient funds for this debit.\"\n end\n end\n \n alt Exit Application\n MainProgram->>MainProgram: MOVE 'NO' TO CONTINUE-FLAG\n MainProgram->>User: DISPLAY \"Exiting the program. Goodbye!\"\n end\n```\n\n## Generate a test plan\n\n```text\n@workspace The current Cobol app has no tests. Can you please create a test plan of current business logic that I can use to validate with business stakeholders about the current implementation.\nLater I would like to use this test plan to create unit and integration tests in a node.js app. I am in the middle of transforming the current Cobol app to a node.js app.\nThe test plan should include the following:\n\n1. Test Case ID\n2. Test Case Description\n3. Pre-conditions\n4. Test Steps\n5. Expected Result\n6. Actual Result\n7. Status (Pass/Fail)\n8. Comments\n\nPlease create the test plan in a markdown table format. The test plan should cover all the business logic in the current Cobol app.\n```\n\n### Note\n\n*You may still need follow up with another prompt to generate the markdown file format for the test plan.*\n\n```markdown\nConvert this to markdown syntax please to insert as a new file\n```\n\n## Convert files using prompt engineering best practices\n\n### Create the Node.js project directory\n\n```bash\nmkdir node-accounting-app\ncd node-accounting-app\n```\n\n### Use GitHub Copilot to convert the files iteratively\n\n#### Convert main.cob to main.js\n\n#### Convert operations.cob to operations.js\n\n#### Convert data.cob to data.js\n\n```text\nLet's link all node.js files to work together in one accounting application, and then initialize, install dependencies, and run the application.\n```\n\n### Initialize a new Node.js project\n\n```bash\nnpm init -y\n```\n\n### Install the Node.js app\n\n```bash\nnpm install\n\n```\n\n### Run the Node.js app\n\n```bash\nnode main.js\n```\n\n### Generate unit and integration tests\n\n```text\n@workspace I would like to create unit and integration tests cases form the test plan mentioned in\n#file:TESTPLAN.md file The node.js code is in node-accounting-app folder and I am looking to generate tests\nfor #file:operations.js file. Use a popular testing framework and also provide all the dependencies required to run the tests.\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python implementation of a COBOL accounting system with Golden Master testing",
"version": "1.0.4",
"project_urls": {
"Bug Reports": "https://github.com/math974/modernize-legacy-cobol-app/issues",
"Documentation": "https://github.com/math974/modernize-legacy-cobol-app#readme",
"Homepage": "https://github.com/math974/modernize-legacy-cobol-app",
"Source": "https://github.com/math974/modernize-legacy-cobol-app"
},
"split_keywords": [
"cobol",
" legacy",
" modernization",
" golden-master",
" testing",
" accounting",
" migration",
" python"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "d3f6a5a235337cef2fa950baaa92566387a02130744c3f64adcaa02ca045a354",
"md5": "b704c78faaa3401249b38c11712a0da9",
"sha256": "6f0bf6ce34223968273b5fcef0f740f04b8bfa28ae7541692bc7c6af7d90ab7f"
},
"downloads": -1,
"filename": "legacy_cobol_modernization-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b704c78faaa3401249b38c11712a0da9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 7717,
"upload_time": "2025-09-03T16:40:59",
"upload_time_iso_8601": "2025-09-03T16:40:59.081355Z",
"url": "https://files.pythonhosted.org/packages/d3/f6/a5a235337cef2fa950baaa92566387a02130744c3f64adcaa02ca045a354/legacy_cobol_modernization-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "6850175e980542ed6766178c73a00bffe5826824890ea9738814a148db4eeb87",
"md5": "98dddf717e17c1fa5c92cd18b0df2b7d",
"sha256": "eb134345190439d2ff6869730970af017964c055c60b57f519dbc9f961777b0f"
},
"downloads": -1,
"filename": "legacy_cobol_modernization-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "98dddf717e17c1fa5c92cd18b0df2b7d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 13382,
"upload_time": "2025-09-03T16:40:59",
"upload_time_iso_8601": "2025-09-03T16:40:59.833372Z",
"url": "https://files.pythonhosted.org/packages/68/50/175e980542ed6766178c73a00bffe5826824890ea9738814a148db4eeb87/legacy_cobol_modernization-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-03 16:40:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "math974",
"github_project": "modernize-legacy-cobol-app",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "pytest",
"specs": [
[
">=",
"7.4.0"
]
]
},
{
"name": "pytest-cov",
"specs": [
[
">=",
"4.1.0"
]
]
},
{
"name": "ruff",
"specs": [
[
">=",
"0.1.0"
]
]
},
{
"name": "black",
"specs": [
[
">=",
"23.0.0"
]
]
},
{
"name": "mypy",
"specs": [
[
">=",
"1.5.0"
]
]
}
],
"lcname": "legacy-cobol-modernization"
}