Skip to main content


class EnsLib.EDI.X12.Parser extends %Library.RegisteredObject

This is the X12 Interchange parser

Property Inventory

Method Inventory


property %CharCount as %Integer;
Property methods: %CharCountDisplayToLogical(), %CharCountGet(), %CharCountIsValid(), %CharCountLogicalToDisplay(), %CharCountNormalize(), %CharCountSet()
property %CurrentDocument as EnsLib.EDI.Document;
The current Document
Property methods: %CurrentDocumentGet(), %CurrentDocumentGetSwizzled(), %CurrentDocumentIsValid(), %CurrentDocumentNewObject(), %CurrentDocumentSet()
property %CurrentParentSegIndex as %String;
The segment position within the current parent Document
Property methods: %CurrentParentSegIndexDisplayToLogical(), %CurrentParentSegIndexGet(), %CurrentParentSegIndexIsValid(), %CurrentParentSegIndexLogicalToDisplay(), %CurrentParentSegIndexLogicalToOdbc(), %CurrentParentSegIndexNormalize(), %CurrentParentSegIndexSet()
property %CurrentParents [ InitialExpression = 0 , MultiDimensional ];
List of enclosing parent objects ordered from outermost to immediate As EnsLib.EDI.Document
Property methods: %CurrentParentsDisplayToLogical(), %CurrentParentsGet(), %CurrentParentsIsValid(), %CurrentParentsLogicalToDisplay(), %CurrentParentsLogicalToOdbc(), %CurrentParentsNormalize(), %CurrentParentsSet()
property %LineCount as %Integer;
Property methods: %LineCountDisplayToLogical(), %LineCountGet(), %LineCountIsValid(), %LineCountLogicalToDisplay(), %LineCountNormalize(), %LineCountSet()
property %LookaheadLine as %String;
Lookahead line left over from previous document parse
Property methods: %LookaheadLineDisplayToLogical(), %LookaheadLineGet(), %LookaheadLineIsValid(), %LookaheadLineLogicalToDisplay(), %LookaheadLineLogicalToOdbc(), %LookaheadLineNormalize(), %LookaheadLineSet()
property %LookaheadLineIsNew as %Boolean;
Flag for whether lookahead buffer has had input conversion yet
Property methods: %LookaheadLineIsNewDisplayToLogical(), %LookaheadLineIsNewGet(), %LookaheadLineIsNewIsValid(), %LookaheadLineIsNewLogicalToDisplay(), %LookaheadLineIsNewNormalize(), %LookaheadLineIsNewSet()
property %NumChildren as %Integer [ MultiDimensional ];
List of counts of nested documents, ordered from outer to innermost
Property methods: %NumChildrenDisplayToLogical(), %NumChildrenGet(), %NumChildrenIsValid(), %NumChildrenLogicalToDisplay(), %NumChildrenNormalize(), %NumChildrenSet()
property %ParentIds as %String;
List of enclosing parent objects ordered from immediate to outermost
Property methods: %ParentIdsDisplayToLogical(), %ParentIdsGet(), %ParentIdsIsValid(), %ParentIdsLogicalToDisplay(), %ParentIdsLogicalToOdbc(), %ParentIdsNormalize(), %ParentIdsSet()
property %SegmentCount as %Integer;
Count of Segments tallied during parse of a TransactionSet
Property methods: %SegmentCountDisplayToLogical(), %SegmentCountGet(), %SegmentCountIsValid(), %SegmentCountLogicalToDisplay(), %SegmentCountNormalize(), %SegmentCountSet()
property %ServiceInterface as EnsLib.EDI.ServiceInterface;
The config provider
Property methods: %ServiceInterfaceGet(), %ServiceInterfaceGetSwizzled(), %ServiceInterfaceIsValid(), %ServiceInterfaceNewObject(), %ServiceInterfaceSet()
property %Stream as %IO.I.CharacterStream;
Property methods: %StreamGet(), %StreamGetSwizzled(), %StreamIsValid(), %StreamNewObject(), %StreamSet()
property %inFraming as %String;
pre-parse of Framing setting
Property methods: %inFramingDisplayToLogical(), %inFramingGet(), %inFramingIsValid(), %inFramingLogicalToDisplay(), %inFramingLogicalToOdbc(), %inFramingNormalize(), %inFramingSet()
property %outFraming as %String;
Framing to use on output if input framing is "Flexible"
Property methods: %outFramingDisplayToLogical(), %outFramingGet(), %outFramingIsValid(), %outFramingLogicalToDisplay(), %outFramingLogicalToOdbc(), %outFramingNormalize(), %outFramingSet()
property ControlVersion as %String (MAXLEN = 5);
This allows you to pre-set a ControlVersion to use when reading TransactionSets without an ISA or GS
Property methods: ControlVersionDisplayToLogical(), ControlVersionGet(), ControlVersionIsValid(), ControlVersionLogicalToDisplay(), ControlVersionLogicalToOdbc(), ControlVersionNormalize(), ControlVersionSet()
property DefCharEncoding as %String (MAXLEN = 20) [ InitialExpression = "latin1" ];
Default Character Encoding to use when reading or writing X12 Documents.

Choices you can use for this setting include:

  • Native - use the default character encoding of the installed locale of the InterSystems IRIS server
  • latin1 - the ISO Latin1 8-bit encoding; this is the default
  • ISO-8859-1 - the ISO Latin1 8-bit encoding
  • UTF-8 - the Unicode 8-bit encoding
  • Unicode - the Unicode 16-bit encoding (Little-Endian)
  • UnicodeBig - the Unicode 16-bit encoding (Big-Endian)
  • Any other NLS definitions installed on this InterSystems IRIS server
  • @<ttable> - <ttable> means a raw InterSystems character translation table name. A prefix of '@' means to use the named table.
Property methods: DefCharEncodingDisplayToLogical(), DefCharEncodingGet(), DefCharEncodingIsValid(), DefCharEncodingLogicalToDisplay(), DefCharEncodingLogicalToOdbc(), DefCharEncodingNormalize(), DefCharEncodingSet()
property Done as %Boolean [ Calculated , ReadOnly ];
Property methods: DoneDisplayToLogical(), DoneIsValid(), DoneLogicalToDisplay(), DoneNormalize()
property FinishBatch as %Boolean;
Should the parser skim the rest of the current batch without notifying us of any further child documents? Gets automatically cleared when the end of each top-level document is encountered
Property methods: FinishBatchDisplayToLogical(), FinishBatchGet(), FinishBatchIsValid(), FinishBatchLogicalToDisplay(), FinishBatchNormalize(), FinishBatchSet()
property Framing as %String;
See your X12 Config Items for a description of accepted values.
Property methods: FramingDisplayToLogical(), FramingGet(), FramingIsValid(), FramingLogicalToDisplay(), FramingLogicalToOdbc(), FramingNormalize(), FramingSet()
property ReadTimeout as %Numeric (MINVAL = -1) [ InitialExpression = 5 ];
Number of seconds to wait for each read of document data inside a started document to be available on the input stream
Property methods: ReadTimeoutDisplayToLogical(), ReadTimeoutGet(), ReadTimeoutIsValid(), ReadTimeoutLogicalToDisplay(), ReadTimeoutNormalize(), ReadTimeoutSet()
property RememberFlex as %Boolean [ InitialExpression = 0 ];
Set this if you want to make an interface that is set to Framing='Flexible' continue with the Framing style it detects in the first message it receives. This can increase performance, reduce latency due to timeouts and ensure consistent behavior after initialization. However, it will also reduce the ability of the interface to interpret changing input formats in successive messages from the same source or from different sources on sequential connections.
Property methods: RememberFlexDisplayToLogical(), RememberFlexGet(), RememberFlexIsValid(), RememberFlexLogicalToDisplay(), RememberFlexNormalize(), RememberFlexSet()
property SegmentTerminator as %String (MAXLEN = 1, MINLEN = 1);
This remembers the terminator defined in the ISA, but you can pre-set it to read TransactionSets without an ISA
Property methods: SegmentTerminatorDisplayToLogical(), SegmentTerminatorGet(), SegmentTerminatorIsValid(), SegmentTerminatorLogicalToDisplay(), SegmentTerminatorLogicalToOdbc(), SegmentTerminatorNormalize(), SegmentTerminatorSet()
property Separators as %String (MAXLEN = 3, MINLEN = 3);
This remembers separators defined in the ISA, but you can pre-set it to read TransactionSets without an ISA
Property methods: SeparatorsDisplayToLogical(), SeparatorsGet(), SeparatorsIsValid(), SeparatorsLogicalToDisplay(), SeparatorsLogicalToOdbc(), SeparatorsNormalize(), SeparatorsSet()
property StartTimeout as %Numeric (MINVAL = -1) [ InitialExpression = 5 ];
Number of seconds to wait for the start of a document to be available on the input stream
Property methods: StartTimeoutDisplayToLogical(), StartTimeoutGet(), StartTimeoutIsValid(), StartTimeoutLogicalToDisplay(), StartTimeoutNormalize(), StartTimeoutSet()
property TransactionSetCount as %Integer;
Count of TransactionSets in a Group
Property methods: TransactionSetCountDisplayToLogical(), TransactionSetCountGet(), TransactionSetCountIsValid(), TransactionSetCountLogicalToDisplay(), TransactionSetCountNormalize(), TransactionSetCountSet()
property Whitespace as %String;
This property controls the skipping of whitespace in the data stream. Set it to a string of characters that should be considered whitespace and not part of the data
Property methods: WhitespaceDisplayToLogical(), WhitespaceGet(), WhitespaceIsValid(), WhitespaceLogicalToDisplay(), WhitespaceLogicalToOdbc(), WhitespaceNormalize(), WhitespaceSet()


method DoneGet() as %Boolean
method ParseFramedIOStream(pIOStream As %IO.I.CharacterStream, Output pDoc As EnsLib.EDI.X12.Document, pInbound As %Boolean = 0, ByRef pIOLogEntry As Ens.Util.IOLog = $$$NULLOREF, pDefaultRepSep As %String = "", pDefaultCompSep As %String = "", pDefaultSegTerminator As %String = "") as %Status
Read an X12 document from the given IO Stream Returned %Status codes are not logged, except for Exceptions
method ParseIOStream(pIOStream As %IO.I.CharacterStream, Output pDocument As EnsLib.EDI.X12.Document, ByRef pControlVersion As %String = "", pInbound As %Boolean = 0, pFramed As %Boolean = 0, pDefaultRepSep As %String = "", pDefaultCompSep As %String = "", pDefaultSegTerminator As %String = "") as %Status
Parse a complete X12 interchange document from the stream, including any nested TransactionSet documents inside it. An Interchange contains zero or more functional groups which in turn contain TransactionSets.
method Reset()
method ResetPosition()
method StripWhitespace(pLine As %String) as %String
Strip off leading whitespace from the line
classmethod applyFraming(pFraming As %String, pFlexDefault As %String = "xxf") as %String

Inherited Members

Inherited Methods

FeedbackOpens in a new tab