class EnsLib.EDI.X12.Parser
extends %RegisteredObject
This is the X12 Interchange parser
property %CharCount
as %Integer;
property %CurrentDocument
as EnsLib.EDI.Document;
The current Document
property %CurrentParentSegIndex
as %String;
The segment position within the current parent Document
property %CurrentParents
[ InitialExpression = 0,MultiDimensional ];
List of enclosing parent objects ordered from outermost to immediate
As EnsLib.EDI.Document
property %LineCount
as %Integer;
property %LookaheadLine
as %String;
Lookahead line left over from previous document parse
property %LookaheadLineIsNew
as %Boolean;
Flag for whether lookahead buffer has had input conversion yet
property %NumChildren
as %Integer [ MultiDimensional ];
List of counts of nested documents, ordered from outer to innermost
property %ParentIds
as %String;
List of enclosing parent objects ordered from immediate to outermost
property %SegmentCount
as %Integer;
Count of Segments tallied during parse of a TransactionSet
property %ServiceInterface
as EnsLib.EDI.ServiceInterface;
The config provider
property %Stream
as %IO.I.CharacterStream;
property %inFraming
as %String;
pre-parse of Framing setting
property %outFraming
as %String;
Framing to use on output if input framing is "Flexible"
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 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 Done
as %Boolean [ Calculated,ReadOnly ];
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 Framing
as %String;
See your X12 Config Items for a description of accepted values.
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 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 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 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 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 TransactionSetCount
as %Integer;
Count of TransactionSets in a Group
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
method DoneGet()
as %Boolean
This is a Get accessor method for the Done property.
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