Files
cobol-java-v3/README.md
T
tmm621 a3918e2162 feat: add agent mode pipeline (orchestrator_jcl)
- Add --mode agent to main.py for jcl-cobol-data-create integration
- New orchestrator_jcl.py: 5-phase pipeline
  Phase 1: Call jcl-cobol-data-create (DeepSeek LLM) to generate JSON test data
  Phase 2: Parse COBOL FD layouts via analyze_fd_layout
  Phase 3: Compile COBOL + subprograms + Java (once)
  Phase 4: Per-group loop: JSON->binary->run COBOL->run Java->compare->report
  Phase 5: Aggregate summary
- Fix orchestrator.py import error (check_coverage from cobol_testgen.coverage)
- Normalize jcl JSON field names (R01-APPL-ID -> R01APPL-ID) for FD layout matching
- Auto-compile subprograms by scanning CALL statements in COBOL source
- Update README.md with agent mode usage and architecture docs
- jcl-cobol-data-create api_client.py: bypass Windows system proxy
2026-07-27 20:20:30 +08:00

94 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# COBOL → Java/Spark 迁移验证平台 v3
自动解析 COBOL 源码,生成覆盖全分支路径的测试数据,分别运行 COBOL 和 Java/Spark 两个版本,逐字段比对输出,判定迁移正确性。
支持 **非 DB**flat file I-O)和 **DB**EXEC SQL → gixsql + SQLite)两条平行管道。
## 快速开始
```bash
# 安装依赖
pip install lark pathlib pyyaml
# 运行非 DB 回归测试
python test-data/s15_coverage_verification.py
# 运行 DB 端到端测试(需设置环境变量,见 SETUP.md)
python test-data/s30_db_e2e.py
# 单程序运行(自动路由:含 EXEC SQL → DB 管道,否则非 DB)
python -m cobol_testgen ../cobol-tna-system/src/KIN01INP.cbl
# Agent 模式(调用 jcl-cobol-data-create + DeepSeek LLM 生成数据)
python main.py --mode agent \
--design "D:/cobol-tna-system/詳細設計書/詳細設計書_ZAN04MAT.md" \
--cobol-src "D:/cobol-tna-system/src/ZAN04MAT.cbl" \
--file-db-md "D:/cobol-tna-system/詳細設計書/COPY句定義書.md" \
--cpy "D:/cobol-tna-system/cpy" \
--db-md "D:/cobol-tna-system/詳細設計書/DB定義書.md" \
--output "output"
```
## 架构
```
CLI → orchestrator / orchestrator_db / orchestrator_jcl
┌─────┼──────┬──────────┬──────────┐
▼ ▼ ▼ ▼ ▼
cobol_testgen runners comparator agents
(数据生成) (编译运行) (比对验证) (LLM)
```
三条管道自动路由:
- **非 DB**`cobc` 编译 → flat file 二进制比对
- **DB**`gixpp` ESQL 预处理 → `cobc -l gixsql` 编译 → SQLite 表比对
- **Agent**:调用 jcl-cobol-data-create (DeepSeek LLM) 生成测试数据 → 转换二进制 → COBOL/Java 编译运行 → 逐 group 循环比对
## 文档索引
| 文档 | 说明 |
|------|------|
| `SETUP.md` | 环境搭建、运行指南、检查清单(含 DB 管道) |
| `docs/v3-理解文档.md` | 系统架构、组件说明、数据流(中文,457 行) |
| `docs/changelog-v1-to-v3.md` | V1→V3 演进记录 |
| `docs/module-interfaces.md` | 模块接口定义 |
| `DESIGN.md` | Web UI 设计规范 |
| `CONTRIBUTING.md` | 贡献指南 |
## 核心命令
```bash
# 非 DB 全量覆盖率报告
python test-data/s25_per_program_report.py
# DB 端到端测试
python test-data/s30_db_e2e.py
# 带 gcov 覆盖率的单程序运行
python -m cobol_testgen --gcov <cobol_src> runtime/
# Agent 模式(调用 jcl-cobol-data-create LLM 生成测试数据 + 全管道验证)
python main.py --mode agent \
--design <詳細設計書.md> --cobol-src <program.cbl> \
--file-db-md <COPY句定義書.md> --cpy <copybook_dir> \
--db-md <DB定義書.md> --output output/
# Agent 模式 + Java 比对(需要 java-src 和 mapping YAML
python main.py --mode agent \
--design <詳細設計書.md> --cobol-src <program.cbl> \
--file-db-md <COPY句定義書.md> --cpy <copybook_dir> \
--db-md <DB定義書.md> --output output/ \
--java-src <java_dir> --mapping <mapping.yaml>
# 诊断脚本
python diagnose_db2.py # DB 全流程
python diagnose_kind8dbrun.py # DB 编译运行
```
## 依赖
- **Python 3.12+** + `lark`, `pyyaml`
- **GnuCOBOL 3.2.0** (GC32-BDB-SP1,含 DB2/SQLite 支持)
- **gixsql** (已 vendored 在 `gixsql/` 目录)