94400d50d4
作为子目录纳入系统,与核心测试管道协同 Co-Authored-By: Claude <noreply@anthropic.com>
28 lines
1.0 KiB
Markdown
28 lines
1.0 KiB
Markdown
# 25-subprogram
|
|
|
|
## 电信业务场景
|
|
|
|
计费子程序。通过CALL语句调用计费计算子程序,传入用量和单价参数,返回计费金额。演示USING参数传递和RETURN-CODE使用。
|
|
|
|
## Purpose
|
|
Tests COBOL subprogram calling conventions including CALL with literal names,
|
|
CALL with variable program names, and CALL with IS INITIAL.
|
|
|
|
## Architecture
|
|
- **callee.cbl** — Subprogram (PROGRAM-ID. callee) that adds two numbers via
|
|
LINKAGE SECTION parameters and tracks first-call state.
|
|
- **caller.cbl** — Main program (PROGRAM-ID. caller) with three test cases.
|
|
|
|
## Tests
|
|
1. **CALL literal**: CALL "callee" USING 100 200 -> expects 300
|
|
2. **CALL variable**: CALL WS-PGM-NAME USING 10 20 -> expects 30
|
|
3. **CALL IS INITIAL**: CALL "callee" IS INITIAL USING 1 2 -> expects 3,
|
|
forces subprogram reinitialization
|
|
|
|
## Key Techniques
|
|
- CALL USING for parameter passing
|
|
- LINKAGE SECTION for parameter definitions
|
|
- GOBACK to return to caller
|
|
- RETURN-CODE for status communication
|
|
- IS INITIAL to reinitialize subprogram state
|