feat: SQL between/hostvar-key alignment, class-condition parsing, gcov merge across scenario runs
This commit is contained in:
@@ -132,7 +132,10 @@ def _format_value(value: Any, field: dict) -> bytes:
|
||||
try:
|
||||
num = int(float(val)) if val else 0
|
||||
except (ValueError, TypeError):
|
||||
num = 0
|
||||
# 非数字値を 0 に静かに丸めると '00000000' が合成され、
|
||||
# 複数レコードで主キー衝突(DAILY_RECORDS INSERT エラー→早期 ABEND)を
|
||||
# 引き起こす。SPACE を書くことでプログラムの空キー判定に委ねる。
|
||||
return (' ' * length).encode("ascii")
|
||||
num = abs(num)
|
||||
max_val = 10 ** length - 1
|
||||
if num > max_val:
|
||||
@@ -295,6 +298,12 @@ def write_sysin_file(records: list[dict], source_text: str, outdir: Path, prefix
|
||||
|
||||
# Always add a RESET-mode batch with duplicate EMP-ID for UPDATE path
|
||||
unique_ids = list(dict.fromkeys(emp_ids_ordered))
|
||||
# Ensure a duplicated EMP-ID (from AGG path injection in orchestrator_db)
|
||||
# appears in the last T card chunk. Without this, dict.fromkeys removes
|
||||
# duplicates keeping only the first occurrence, which may not be in last 8.
|
||||
dup_candidates = [e for e in unique_ids if emp_ids_ordered.count(e) > 1]
|
||||
if dup_candidates and dup_candidates[0] not in unique_ids[-8:]:
|
||||
unique_ids.append(dup_candidates[0])
|
||||
if not unique_ids:
|
||||
unique_ids = ["EMP00001", "EMP00002", "EMP00003", "EMP00004", "EMP00005"]
|
||||
# Inject duplicates: use first EMP-ID twice to trigger RESET/UPDATE
|
||||
@@ -313,8 +322,10 @@ def write_sysin_file(records: list[dict], source_text: str, outdir: Path, prefix
|
||||
# Unknown card type to cover IF WRK-CARD-TYPE '*' ELSE branch (DP#8 F)
|
||||
lines.append("X UNKNOWN")
|
||||
|
||||
# End with RESET mode so 3000STPSOR runs the RESET path (DP#22-#23)
|
||||
lines.append("M MODE=RESET")
|
||||
# End with the configured final mode (default RESET → 3000STPSOR 実行 RESET path).
|
||||
# final_mode='NORMAL' 时(如 drop_tables 场景),3000STPSOR 不执行 DELETE,
|
||||
# 使 SELECT COUNT 等后续 SQL 错误分支可达。
|
||||
lines.append(f"M MODE={run_cfg.get('final_mode', 'RESET')}")
|
||||
|
||||
# Write as fixed-length flat file
|
||||
outpath = outdir / (prefix + sysin_filename)
|
||||
|
||||
Reference in New Issue
Block a user