Skip to content

Fix ISO 8211 concatenated array descriptor parsing with leader subfields#3

Merged
philliphoff merged 1 commit into
mainfrom
philliphoff/fix-iso8211-concat-array-parsing
May 7, 2026
Merged

Fix ISO 8211 concatenated array descriptor parsing with leader subfields#3
philliphoff merged 1 commit into
mainfrom
philliphoff/fix-iso8211-concat-array-parsing

Conversation

@philliphoff
Copy link
Copy Markdown
Owner

Problem

ParseSubfieldLabels only splits on ! delimiters, so concatenated array label strings like VCID*YCOO!XCOO!ZCOO merged VCID and YCOO into a single name (VCID*YCOO). This produced 3 subfield definitions instead of 4, with RepeatingSubfieldStartIndex = -1.

This breaks S-101 MultiPoint (C3IL) records and any ISO 8211 concatenated array field using leader + repeating subfields separated by * (per ISO 8211 §6.4.3.3).

Fix

Iso8211DataDescriptiveRecordReader.cs — In ParseSubfieldLabels, add handling for mid-string * to split VCID*YCOO into two names: VCID (leader, index 0) and YCOO (repeating start, index 1). The existing *-at-start handling for vector-style fields is preserved.

Iso8211FieldReader.cs — Fix a GroupCount double-counting bug when RepeatingSubfieldStartIndex > 0: the first repeating group was counted both at entry (set to 1) and at wrap-around (incremented). Changed initial value to 0 so wrap-around correctly produces the count.

Tests

  • DDR Reader: Concatenated array with leader+repeating produces 4 subfields with correct names, formats, and RepeatingSubfieldStartIndex = 1
  • DDR Reader: Regression guard for vector-style *YCOO!XCOO still works correctly
  • Field Reader: End-to-end read of C3IL-style field with 1 leader byte + 3 repeating groups verifies GetFixedSubfield, GroupCount, and GetSubfieldGroups
  • All 421 existing tests pass

ParseSubfieldLabels only split on '!' delimiter, so label strings like
'VCID*YCOO!XCOO!ZCOO' merged VCID and YCOO into a single name. This
broke S-101 MultiPoint (C3IL) records and any concatenated array field
with leader + repeating subfields separated by '*'.

Add handling for mid-string '*' in ParseSubfieldLabels to correctly
split leader subfield names from repeating subfield names per
ISO 8211 §6.4.3.3.

Also fix a GroupCount double-counting bug in Iso8211FieldReader when
RepeatingSubfieldStartIndex > 0: the first repeating group was counted
both at entry and at wrap-around.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@philliphoff philliphoff merged commit d310687 into main May 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant