Skip to content

Ak2Segment

Ak2Segment models the X12 AK2 transaction set response header, which appears once per acknowledged transaction set nested inside an AK1 functional group acknowledgement. It identifies the transaction set type and control number of the transaction being acknowledged, with the control number zero-padded to four digits on output to match the corresponding ST segment's format (BR-042).

Purpose

  • Represents the AK2 segment identity via SegmentId returning the literal "AK2" (BR-020).
  • Carries TransactionSetIdentifierCode, TransactionSetControlNumber, and VersionConventionReference, the fields identifying which transaction set is being acknowledged.
  • Zero-pads TransactionSetControlNumber to (at least) four digits on Build() so it matches the format used by the originating StSegment's control number (BR-042).

Context

  • Namespace: SAIF.Common.Files.Edi.Segments
  • Assembly/package: SAIF.Framework.Common.Files

Public members

Member Signature Purpose
SegmentId string SegmentId { get; } Returns the literal X12 segment identifier "AK2".
TransactionSetIdentifierCode string TransactionSetIdentifierCode { get; set; } The transaction set identifier code of the acknowledged transaction (AK201), read/written at element 1.
TransactionSetControlNumber long TransactionSetControlNumber { get; set; } The control number of the acknowledged transaction set (AK202), zero-padded to four digits on Build() (BR-042).
VersionConventionReference string VersionConventionReference { get; set; } The implementation convention reference of the acknowledged transaction (AK203), read/written at element 3.
Build IEdiSegment Build() Creates a SegmentBuilder("AK2"), adds TransactionSetIdentifierCode at element 1, TransactionSetControlNumber.ToString().PadLeft(4, '0') at element 2, and VersionConventionReference at element 3, returning the built segment.
Fill void Fill(IEdiSegment segment) Reads elements 1-3 via GetChildValue, converting element 2 to long, into TransactionSetIdentifierCode, TransactionSetControlNumber, and VersionConventionReference.
Parse static Ak2Segment Parse(IEdiSegment segment) Instantiates a new Ak2Segment, calls Fill(segment) on it, and returns it.

Behavioral notes

  • The class carries a code comment noting its field layout is identical to StSegment except for the segment identifier*.

Constraints and usage notes

  • PadLeft(4, '0') only guarantees a minimum of four digits; a control number with more than four digits is written unpadded/untruncated at its natural length*.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

Sources

  • Common\SAIF.Common.Files\Edi\Segments\Ak2Segment.cs