Files

32-mix-1N-samekeybreak — 1:N Matching with Same-Key Break

电信业务场景

合同+月别混合集计。先做合同↔CDR的1:N匹配,再在匹配结果内做同键(key)的月别集计。同时演示匹配和key切两种模式。

Purpose

Demonstrates 1:N matching pattern (one master to many details) combined with same-key break summarization.

Test Coverage

  1. 1:N matching — One master (KEY0000001) matched to three detail records
  2. Same-key break — When detail key changes, a summary line is output with count and total
  3. Multiple master matches — Records for KEY0000001, KEY0000002, KEY0000004
  4. Unmatched detail — Master lookup not found (if key is missing)
  5. Final break — Last group summary at end of file

Data

  • 5 master records (KEY0000001 through KEY0000005)
  • 8 detail records with keys repeating for 1:N matching

Key Techniques

  • In-memory master table loaded from file
  • Sequential file matching
  • Key break detection on key field change
  • Accumulator reset at each break
  • Grand total across all matches