Real-time semantic analysis for COBOL code. Detect when procedure names don't match their implementation.
- Real-time Analysis: Analyze COBOL files as you type (on save)
- Inline Diagnostics: See semantic disharmony warnings directly in your code
- Batch Analysis: Analyze entire workspace with one command
- Customizable Thresholds: Configure sensitivity levels
- IBM Mainframe Ready: Works with z/OS USS and standard COBOL
Semantic disharmony occurs when a procedure's name suggests one thing, but the code does something different:
*> DISHARMONY: Name says "VALIDATE" but code UPDATES database
VALIDATE-CUSTOMER-RECORD.
EXEC SQL
UPDATE CUSTOMERS
SET STATUS = 'APPROVED'
WHERE CUST-ID = :WS-CUST-ID
END-EXEC.The extension analyzes the LJPW (Love, Justice, Power, Wisdom) semantic coordinates:
- Love: Connection/Communication operations
- Justice: Validation/Control operations
- Power: Modification/Update operations
- Wisdom: Retrieval/Query operations
- Python 3.9+ installed
- COBOL Code Harmonizer installed (Installation Guide)
# Package the extension
cd vscode-extension
npm install -g vsce
vsce package
# Install in VS Code
code --install-extension cobol-harmonizer-0.1.0.vsix# Clone repository
git clone https://github.com/BruinGrowly/COBOL-Code-Harmonizer.git
cd COBOL-Code-Harmonizer/vscode-extension
# Install dependencies
npm install
# Open in VS Code
code .
# Press F5 to launch Extension Development HostOpen VS Code settings (Ctrl+,) and search for "COBOL Harmonizer":
{
"cobolHarmonizer.pythonPath": "python3",
"cobolHarmonizer.harmonizerPath": "/path/to/cobol_harmonizer.py",
"cobolHarmonizer.disharmonyThreshold": 0.5,
"cobolHarmonizer.analyzeOnSave": true,
"cobolHarmonizer.copybookPaths": [
"/u/prod/cobol/copybook",
"./copybooks"
]
}Method 1: Automatic (on save)
- Just save your COBOL file - analysis runs automatically
Method 2: Manual
- Right-click in COBOL file → "COBOL Harmonizer: Analyze Current File"
- Or: Ctrl+Shift+P → "COBOL Harmonizer: Analyze Current File"
Method 3: Workspace
- Ctrl+Shift+P → "COBOL Harmonizer: Analyze Workspace"
Diagnostics appear inline with color-coded severity:
- 🔴 Error (≥1.2): Critical disharmony - immediate attention required
- 🟡 Warning (0.8-1.2): Significant disharmony - review recommended
- 🔵 Info (0.5-0.8): Concerning drift - consider refactoring
Hover over the underlined procedure name to see:
- Disharmony score
- Intent coordinates (from name)
- Execution coordinates (from code)
- Classification level
| Setting | Type | Default | Description |
|---|---|---|---|
pythonPath |
string | python3 |
Path to Python interpreter |
harmonizerPath |
string | (auto-detect) | Path to cobol_harmonizer.py |
disharmonyThreshold |
number | 0.5 |
Minimum score to report (0.0-1.5) |
analyzeOnSave |
boolean | true |
Auto-analyze on file save |
copybookPaths |
array | [] |
Additional copybook directories |
The extension automatically searches for cobol_harmonizer.py in:
- Workspace root
/u/cobol-harmonizer/(z/OS USS)/usr/local/bin//usr/bin/~/cobol-harmonizer/
| Command | Description |
|---|---|
COBOL Harmonizer: Analyze Current File |
Analyze active COBOL file |
COBOL Harmonizer: Analyze Workspace |
Analyze all COBOL files in workspace |
COBOL Harmonizer: Clear Diagnostics |
Clear all warnings/errors |
*> Name matches implementation - no warning
CALCULATE-MONTHLY-TOTAL.
COMPUTE WS-MONTHLY-TOTAL = WS-DAILY-TOTAL * 30.*> Suggests validation but also reads data
VALIDATE-CUSTOMER. *> Intent: Justice (0.6)
EXEC SQL
SELECT STATUS INTO :WS-STATUS *> Execution: Wisdom (0.7)
FROM CUSTOMERS
WHERE CUST-ID = :WS-CUST-ID
END-EXEC.
IF WS-STATUS NOT = 'ACTIVE'
MOVE 'INVALID' TO WS-RESULT.Disharmony: 0.6 - Consider renaming to GET-AND-VALIDATE-CUSTOMER
*> CRITICAL: Name says "DISPLAY" but code DELETES!
DISPLAY-ACCOUNT-INFO. *> Intent: Love (0.7)
EXEC SQL
DELETE FROM ACCOUNTS *> Execution: Power (0.8)
WHERE ACCT-ID = :WS-ACCT-ID
END-EXEC.Disharmony: 1.5 - Immediate refactoring required
For IBM mainframe users:
{
"cobolHarmonizer.pythonPath": "/usr/lpp/IBM/cyp/v3r9/pyz/bin/python3",
"cobolHarmonizer.harmonizerPath": "/u/cobol-harmonizer/cobol_harmonizer.py",
"cobolHarmonizer.copybookPaths": [
"/u/prod/cobol/copybook",
"/SYS1.COPYLIB"
]
}- Small files (<500 LOC): < 1 second
- Medium files (500-2000 LOC): 1-3 seconds
- Large files (>2000 LOC): 3-10 seconds
- Workspace (100 files): 2-5 minutes
Analysis is cached - subsequent runs are 95% faster.
Solution: Set cobolHarmonizer.harmonizerPath in settings:
{
"cobolHarmonizer.harmonizerPath": "/path/to/cobol_harmonizer.py"
}Solution: Set cobolHarmonizer.pythonPath to full Python path:
{
"cobolHarmonizer.pythonPath": "/usr/bin/python3"
}Possible causes:
- Threshold too high - lower
disharmonyThresholdto 0.3 - No procedures with disharmony - code is harmonious! ✓
- File not recognized as COBOL - check file extension (.cbl, .cob, .cobol)
Solution: Add copybook paths to settings:
{
"cobolHarmonizer.copybookPaths": [
"/path/to/copybooks",
"./local/copybooks"
]
}- Quick fixes (auto-rename procedures)
- Code actions (suggest better names)
- Historical trend tracking
- Team dashboard integration
- Language Server Protocol (LSP) implementation
- Real-time analysis (as-you-type)
- Documentation: ../docs/IBM_QUICK_START.md
- Architecture: ../docs/ARCHITECTURE.md
- Issues: GitHub Issues
MIT - Free for IBM customers and all users
Built by the COBOL Code Harmonizer team for the IBM mainframe community.
Version: 0.1.0 (MVP) Status: Production-ready Last Updated: 2025-11-08