Skip to main content

EnsLib.EDI.X12.Service.Standard

abstract class EnsLib.EDI.X12.Service.Standard extends Ens.BusinessService, EnsLib.EDI.X12.Util.IOFraming, EnsLib.EDI.ServiceInterface

Property Inventory

Method Inventory

Parameters

parameter DOCCLASS = EnsLib.EDI.X12.Document;
parameter SETTINGS = TargetConfigNames:Basic:selector?multiSelect=1&context={Ens.ContextSearch/ProductionItems?targets=1&productionName=@productionId},SearchTableClass::selector?context={Ens.ContextSearch/SearchTableClasses?host=EnsLib.EDI.X12.Service.Standard},DocSchemaCategory:Basic:selector?context={Ens.ContextSearch/SchemaCategories?host=EnsLib.EDI.X12.Service.Standard},Framing:Connection:selector?context={Ens.ContextSearch/getDisplayList?host=@currHostId&prop=Framing},Validation:Acknowledgement,ReplyMode:Acknowledgement,BatchHandling:Basic,BatchErrorAction:Acknowledgement,BatchReplyType:Acknowledgement,AddNackErrText:Acknowledgement,LocalApplicationID,TolerateNewlines:Connection,DefCharEncoding::selector?context={Ens.ContextSearch/CharacterSets};
Inherited description: List of properties can be set as settings in the configuration file format is a comma separated list of property names

Properties

property AddNackErrText as %Boolean;
Add extra error-text field to TA1 & 997/999 AKx segments when generating error-status reply messages; otherwise do not embed internal error state information in 997 messages
Property methods: AddNackErrTextDisplayToLogical(), AddNackErrTextGet(), AddNackErrTextIsValid(), AddNackErrTextLogicalToDisplay(), AddNackErrTextNormalize(), AddNackErrTextSet()
property BatchErrorAction as %String (DISPLAYLIST = ",Reject With All Errors,Reject On First Error,Reject Individual Errors", VALUELIST = ",All,First,Indiv") [ InitialExpression = "Indiv" , Required ];
What to do when detecting a validation error in a batch Interchange document:

(Note: If ReplyMode is 'Application' and BatchErrorAction is not 'Individual', then some documents in a batch may be forwarded and then the whole batch rejected after errors are encountered)

- Reject With All Errors : Reject the whole batch if any error is found in any document within it. Enumerate all errors found if BatchReplyType allows for reporting them. This will prevent forwarding any documents in a batch until all have been read and validated.
- Reject On First Error : Reject the whole batch when the first error is found in any document within it. Don't bother checking for more errors or parsing any further contents of the Interchange. This will prevent forwarding any documents in a batch until all have been read and validated.
- Reject Individual Errors : Reject only those documents within the Interchange that have errors. Forward each acceptable child document to the target config item(s) as soon as it has been read and validated.

Property methods: BatchErrorActionDisplayToLogical(), BatchErrorActionGet(), BatchErrorActionIsValid(), BatchErrorActionLogicalToDisplay(), BatchErrorActionLogicalToOdbc(), BatchErrorActionNormalize(), BatchErrorActionSet()
property BatchHandling as %String (DISPLAYLIST = ",Whole Batch,Single-Session Batch,Multi-Session Batch,Individual", VALUELIST = ",Whole,1Session,MSession,Indiv") [ InitialExpression = "1Session" , Required ];
How to treat received batch Interchange documents:
- Whole Batch : Don't process child documents individually; accumulate and send the whole batch as one composite document
- Single-Session Batch : Forward all documents in the Interchange as part of a single session, including final parent document objects containing batch and group header and trailer segments
- Multi-Session Batch : Forward each document in the Interchange in its own session, followed by final parent document objects containing the batch and group header and trailer segments
- Individual : Forward each child document in the batch in its own session; do not forward parent batch document objects
Property methods: BatchHandlingDisplayToLogical(), BatchHandlingGet(), BatchHandlingIsValid(), BatchHandlingLogicalToDisplay(), BatchHandlingLogicalToOdbc(), BatchHandlingNormalize(), BatchHandlingSet()
property BatchReplyType as %String (DISPLAYLIST = ",None,All,AllTA1,Errors,OnlyIfErrors,Successes,TA1,OnlyIfErrorTA1,ISA14-TA1,ISA14-OnlyIfErrorTA1,Byte", VALUELIST = ",None,All,AllTA1,Errs,OnlyErrs,Succ,TA1,ErrTA1,I14,I14Err,Byte") [ InitialExpression = "Errs" , Required ];
What kind of batch reply should we construct for an Interchange batch we have received? Note that all the options here that relate to TA1 segments are used to force a TA1 segment to be generated, often as the only body segment of the reply interchange. This is used to represent the presence or absence of errors in the whole inbound Interchange. However if an error is found in the incoming ISA or IEA that can only be reported in a TA1 segment, then a TA1 will be generated even if the configured setting does not force a TA1 to appear.

- None : Do not generate a batch reply - if an error occurs do not construct any immediate notification reply to the sender
- All : Generate a reply Interchange containing a reply notification for every TransactionSet in the Interchange we received
- All+TA1 : Generate a reply Interchange containing a TA1 segment that indicates acceptance or error status for the whole Interchange, and a reply notification for every TransactionSet in the Interchange we received
- Errors : Generate a reply Interchange containing reply notifications only for TransactionSets in which errors are detected, or an empty Interchange if no error is found
- OnlyIfErrors : Only if errors are found, generate a reply Interchange containing reply notifications only for TransactionSets in which errors are detected
- Successes : Generate a reply Interchange containing reply notifications only for TransactionSets in which no errors are detected, or an empty Interchange if only errors are found
- TA1 : Generate a reply Interchange containing only a TA1 segment that indicates acceptance or error status for the whole Interchange we received
- OnlyIfErrorTA1 : Only if errors are found, generate a reply Interchange containing only a TA1 segment that indicates error status for the whole Interchange we received
- ISA14-TA1 : Generate a reply Interchange containing only a TA1 segment if a 1 appears in field ISA:14 of the ISA header segment of the incoming Interchange; otherwise return nothing.
- ISA14-OnlyIfErrorTA1 : Only if errors are found and field ISA:14 of the incoming ISA header segment is set to 1, generate a reply Interchange containing only an error TA1 segment; otherwise return nothing.
- Byte : Generate a reply consisting of a single character code : 'A' if the whole Interchange is accepted, 'R' if it is rejected due to one or more errors

Property methods: BatchReplyTypeDisplayToLogical(), BatchReplyTypeGet(), BatchReplyTypeIsValid(), BatchReplyTypeLogicalToDisplay(), BatchReplyTypeLogicalToOdbc(), BatchReplyTypeNormalize(), BatchReplyTypeSet()
property CommitAckType as %String (VALUELIST = ",None,TA1,Byte") [ InitialExpression = "None" , Required ];
In addition to forwarding a full reply message according to the ReplyMode and BatchReplyType settings, return a direct immediate Acknowledgement of this type on this Service's TCP connection as soon as we have committed the inbound document to our persistent storage - None : Do not generate a batch reply - if an error occurs do not construct any immediate notification reply to the sender
- TA1 : Generate a reply Interchange containing only a TA1 segment that indicates acceptance or error status for the whole Interchange we received
- Byte : Generate a reply consisting of a single character code : 'A' if the whole Interchange is accepted, 'R' if it is rejected due to one or more errors
Property methods: CommitAckTypeDisplayToLogical(), CommitAckTypeGet(), CommitAckTypeIsValid(), CommitAckTypeLogicalToDisplay(), CommitAckTypeLogicalToOdbc(), CommitAckTypeNormalize(), CommitAckTypeSet()
property DefCharEncoding as %String (MAXLEN = 20);
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 Ensemble 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 Ensemble 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 DocSchemaCategory as %String (MAXLEN = 1000);
Category to apply to incoming X12 document type names to produce a complete DocType specification.

Combines with the document type name to produce a DocType assignment. This setting may also contain multiple comma-separated type names followed by = and then a DocTypeCategory or full DocType value to apply to documents declared as that type.
A trailing asterisk (*) at the end of a given partial type Name will match any types with that beginning part.

An example: DocSchemaCategory='837=837_X096, 850=850_X12-4010, Interchange=ISC_00401, Group=ISC_00401';
Note that a DocType assignment may be needed for Validation or SearchTableClass indexing.

Property methods: DocSchemaCategoryDisplayToLogical(), DocSchemaCategoryGet(), DocSchemaCategoryIsValid(), DocSchemaCategoryLogicalToDisplay(), DocSchemaCategoryLogicalToOdbc(), DocSchemaCategoryNormalize(), DocSchemaCategorySet()
property Framing as %String (DISPLAYLIST = ",Flexible,Flexible!,None,Epic02/03,Ascii11/28,Ascii11,AsciiLF,AsciiCR,MLLP,MLLP11/28,MsgEnvelope,MLLPMsgEnvelope") [ InitialExpression = "None" ];
X12 Document outbound framing protocol; options:
- Flexible : Determine framing style from the content of received data of each message received
- Flexible! : Determine framing style from the content of received data of the first message and require subsequent messages to have that same framing style
- None : No framing - Each document is output without prefix or suffix characters
- Epic02/03 : same as Ascii02/03 : EPIC sometimes uses this for TCP. Frame documents with an Ascii(02) prefix character before each document and an Ascii(03) suffix character
- Ascii[nn]/[mm] : Frame documents with an Ascii(nn) prefix character before each document and an Ascii(mm) suffix character, but no trailing Ascii(13) as in MLLP
- Ascii[nn] : Frame documents with an Ascii(nn) suffix character separating each document from the subsequent one.
- AsciiLF : Frame documents with Ascii(10) (Linefeed) separating each document from the subsequent one
- AsciiCR : Frame documents with an extra Ascii(13) (Carriage Return) separating each document from the subsequent one
- MLLP : Minimal Lower Level Protocol (HL7 style) - Frame each X12 Document with Ascii(11) prefix and Ascii(28,13) suffix
- MLLP[nn]/[mm] : Minimal Lower Level Protocol - Frame each X12 Document with Ascii(nn) prefix and Ascii(mm),Ascii(13) suffix
- MsgEnvelope : Use the document's Envelope property verbatim if it is present. The string <!--X12DOC--> if present in the Envelope will be replaced with the document content. Otherwise the document will simply follow the 'Envelope' text
- MLLPMsgEnvelope : Same as 'MsgEnvelope', but with MLLP prefix and suffix also around the document inside the 'Envelope'

Note: All Ascii values should be given in decimal; Ascii(120) ('x') is not allowed as an Ascii framing character. Also, if an asterisk (*) is appended to the framing specification, Flexible framing will be used in parsing received acknowledgement response messages. Otherwise the response messages will be expected with the same kind of framing as that specified here for outbound messages.

Property methods: FramingDisplayToLogical(), FramingGet(), FramingIsValid(), FramingLogicalToDisplay(), FramingLogicalToOdbc(), FramingNormalize(), FramingSet()
property IgnoreInboundAck as %Boolean [ InitialExpression = 1 ];
Ignore inbound Acknowledgement messages to avoid reply feedback loop.
Property methods: IgnoreInboundAckDisplayToLogical(), IgnoreInboundAckGet(), IgnoreInboundAckIsValid(), IgnoreInboundAckLogicalToDisplay(), IgnoreInboundAckNormalize(), IgnoreInboundAckSet()
property LocalApplicationID as %String (MAXLEN = 1000) [ InitialExpression = "EnsembleX12Service:03" ];
Colon-separated Local ID:Qualifier codes representing this (receiving) facility and application
These are used in constructing reply document headers.
The '@' symbol represents using the corresponding field from the incoming message.
If your ID must contain a literal @ symbol, escape it with backslash: '\@'
Property methods: LocalApplicationIDDisplayToLogical(), LocalApplicationIDGet(), LocalApplicationIDIsValid(), LocalApplicationIDLogicalToDisplay(), LocalApplicationIDLogicalToOdbc(), LocalApplicationIDNormalize(), LocalApplicationIDSet()
property ReplyMode as %String (DISPLAYLIST = ",Never,Immediate,Application", VALUELIST = ",Never,Immed,App") [ InitialExpression = "Immed" , Required ];
How should reply documents be generated?

- Never : Do not send back any reply
- Immediate : Send back reply message generated immediately in this Service
- Application : If the Interchange passes immediate validation, wait for reply or replies from target config item and forward a reply back when it is complete. (If validation fails or some other error occurs, generate an immediate reply anyway, according to the option selected for 'BatchReplyType'

Property methods: ReplyModeDisplayToLogical(), ReplyModeGet(), ReplyModeIsValid(), ReplyModeLogicalToDisplay(), ReplyModeLogicalToOdbc(), ReplyModeNormalize(), ReplyModeSet()
property SearchTableClass as %String (MAXLEN = 128) [ InitialExpression = "EnsLib.EDI.X12.SearchTable" ];
Store a set of searchable properties associated with each X12 TransactionSet processed.
These records will be stored in the named SearchTable class, if any.
Property methods: SearchTableClassDisplayToLogical(), SearchTableClassGet(), SearchTableClassIsValid(), SearchTableClassLogicalToDisplay(), SearchTableClassLogicalToOdbc(), SearchTableClassNormalize(), SearchTableClassSet()
property TargetConfigNames as %String (MAXLEN = 2000);
Configuration items to which to send Documents
Property methods: TargetConfigNamesDisplayToLogical(), TargetConfigNamesGet(), TargetConfigNamesIsValid(), TargetConfigNamesLogicalToDisplay(), TargetConfigNamesLogicalToOdbc(), TargetConfigNamesNormalize(), TargetConfigNamesSet()
property TolerateNewlines as %Boolean [ InitialExpression = 1 ];
Process the file without error even if to enhance readability newlines have been added after or in place of segment terminators.
Also causes tab and space characters to be ignored at the end or beginning of segments (i.e. adjacent to a segment terminator).
Property methods: TolerateNewlinesDisplayToLogical(), TolerateNewlinesGet(), TolerateNewlinesIsValid(), TolerateNewlinesLogicalToDisplay(), TolerateNewlinesNormalize(), TolerateNewlinesSet()
property Validation as %String;
String specifying types of Validation to perform

Set to 1 to block documents that don't pass default validation. Default validation requires a DocType and blocks messages with any other error encountered while mapping the document's sequence of segments using the X12 schema structure specified by the document's DocType. This is equivalent to 'dm'.

All flags relating to fields/components apply only if 's'/'c' also specified (eg. if set to 'dmslt' then the length and datatype of fields will be checked, but the length and datatype of components will not be)

'd' - require DocType
'm' - don't tolerate BuildMap segment mapping errors
's' - enforce segment structures (number and repetition of fields)
'c' - enforce composite structures (number of components)
'r' - enforce required fields/components being present
'u' - enforce non-use of fields/components marked 'Not Used' - Note this is not available when using a new-style only schema
'l' - enforce field/component length restrictions
't' - enforce correct datatypes used for field/component values
'v' - enforce correct code table values used where specified in the schema - Note this is not available when using a new-style only schema
'n' - perform all validation available to new style schemas. This is equivalent to 'dmscrlt'
'a' - perform all available validation. This is equivalent to 'dmscrultv'
'e' - continue validating after errors are encountered - specify this to scan the entire document and report all errors

Property methods: ValidationDisplayToLogical(), ValidationGet(), ValidationIsValid(), ValidationLogicalToDisplay(), ValidationLogicalToOdbc(), ValidationNormalize(), ValidationSet()

Methods

classmethod GetRequestClassList() as %String
classmethod GetResponseClassList(pRequest As %String = "") as %String
method GetSegmentTerminator() as %String
Return the segment terminator string that the Parser and the document.ImportFromIOStream() method will use.
method IOLogDiscard(pSC As %Status, pNote As %String, pDiscard As %GlobalCharacterStream)
Add discarded characters to IO Archive
method OnConstructReply(Output pReplyDoc As EnsLib.EDI.Document, pOriginalDoc As EnsLib.EDI.Document, ByRef pReplyCode As %String, ByRef pSC As %Status, pEarlyReply As %Boolean) as %Status
Override this method to construct a customized reply document. Inputs are the original document and the reply code and the status code that the framework produced in processing the original document. If you change the status code but do not construct a reply document, the framework will use the new value to construct a standard reply document.
method OnDocumentEnd(pDocument As EnsLib.EDI.Document, pSource As %String, pStatus As %Status) as %Status
Inherited description: Called by the Parser at the end of a document
method OnDocumentStart(pDocument As EnsLib.EDI.Document, pSource As %String, pStatus As %Status) as %Status
Callbacks from Parser:
classmethod OnGetConnections(Output pArray As %String, pItem As Ens.Config.Item)
Return an array of connections for drawing lines on the config diagram
method OnInboundAck(pDoc As EnsLib.EDI.Document, ByRef pSC As %Status) as %Boolean
Override this method to implement your own custom method for handling an incoming ACK Message Returning nonzero means you are handling it and the normal framework should ignore it
method OnInit() as %Status
Inherited description: This user callback method is called via initConfig() from %OnNew() or in the case of SOAP Services from OnPreSOAP()
method OnProcessInput(pDocIn As %Library.RegisteredObject, Output pDocOut As %Library.RegisteredObject, ByRef pHint As %Library.String) as %Status
Note: pDocIn is not declared as EnsLib.EDI.X12.Document so that subclasses can handle other types and transform them before calling ##super().
method OnResolveDocType(pDoc As EnsLib.EDI.Document, ByRef pDocType As %String) as %Boolean
Override this method to implement your own custom method for resolving the DocType of an incoming Message Returning nonzero means you are overriding the framework's standard DocType resolution.
method OnValidate(pDoc As EnsLib.EDI.Document, pValSpec As %String, Output pStatus As %Status) as %Boolean
Override this method to implement your own custom method for validating an incoming Document Return non-zero to prevent default validation of the message (if any);
method SendReply(pReplyDocument As EnsLib.EDI.Document, pOriginalDoc As EnsLib.EDI.Document) as %Status
method constructBatchReply(pOriginalDoc As EnsLib.EDI.X12.Document, ByRef pSC As %Status, pEarlyReply As %Boolean) as EnsLib.EDI.Document
method constructReply(pOriginalDoc As EnsLib.EDI.Document, ByRef pReplyCode As %String, ByRef pSC As %Status, pEarlyReply As %Integer) as EnsLib.EDI.Document
method getReplyChildDocCode(pAppReplyDoc As EnsLib.EDI.Document) as %String
get code from app reply object
method getReplyCode(pDoc As EnsLib.EDI.Document, pSC As %Status, pSCVal As %Status, pEarlyReply As %Boolean) as %String
pEarlyReply=0 means normal reply, -1 means "Immediate Commit Ack", 1 means Application reply Return the appropriate reply code, or empty string if no Ack needed for the specified mode
method reportReply(pOriginalDoc As EnsLib.EDI.Document, pReplyCode As %String = "", ByRef pSC As %Status, pEarlyReply As %Integer = 0) as EnsLib.EDI.Document
method resolveAndIndex(pDoc As EnsLib.EDI.Document) as %Status
Accept only specified document names; resolve DocType and perform requested validation if any
method resolveDocType(pDoc As EnsLib.EDI.X12.Document) as %String
Return the DocType that this service will assign to this document
method standardOnProcessInput(pDocIn As EnsLib.EDI.X12.Document, Output pDocOut As EnsLib.EDI.X12.Document) as %Status

Inherited Members

Inherited Properties

Inherited Methods

Subclasses

FeedbackOpens in a new tab