Electronic Data Interchange | |
The Interchange Header (ASC/X12) |
The Interchange Header is the starting control segment of the interchange envelope. After the recipient has received the document, the interchange header is the first data segment encountered in the document. The interchange header contains:
This topic covers:
Interchange Header in a Document
In the document, the interchange header is identified with the first letters "ISA" followed by the element separator.
The interchange header data stream fit into the implementation guideline defined for the interchange header as follows:
REF ELE NAME REQ TYPE MIN/MAX VALUE COMMENT 01 I01 Authorization Information Qualifier M ID 2/2 00 This element qualifies the value entered in element position 02 (DE I02). The "00" code indicates that there is no authorization information stored there. 02 I02 Authorization Information M AN 10/10 0000000000 This value is not meaningful as stated by data element in position 01 (DE I01). 03 I03 Security Information Qualifier M ID 2/2 01 This data element qualifies the element in position 04 (DE I04). The "01" code indicates that the value stored there is a password. 04 I04 Security Information M AN 10/10 MYPASSWORD Password value as indicated by the element in position 03 (DE I03). 05 I05 Interchange ID Qualifier M ID 2/2 ZZ This element qualifies the value entered in element position 06 (DE I06). The "ZZ" code indicates that the value stored there is mutually defined. 06 I06 Interchange Sender ID M AN 15/15 SENDERISA This value identifies who was the sender of the interchange. Since this value is mutually defined as specified by element position 05 (DE I05), this sender identity is meaningful only to the trading partner. 07 I05 Interchange ID Qualifier M ID 2/2 ZZ This element qualifies the value entered in element position 08 (DE I07). The "ZZ" code indicates that the value stored there is mutually defined. 08 I07 Interchange Receiver ID M AN 15/15 RECEIVERISA This value identifies who is the intended recipient of the interchange. Since this value is mutually defined as specified by element position 07 (DE I05), this recipient identity is meaningful only to the trading partner. 09 I08 Interchange Date M DT 6/6 090419 The date in "YYMMDD" format. 10 I09 Interchange Time M TM 4/4 1548 The time in "HHMM" format. 11 I65 Repetition Separator M 1/1 ! Repetition separator. 12 I11 Interchange Control Version Number M ID 5/5 00503 Interchange version 00503. "Standards Approved for Publication by ASC X12 Procedures Review Board through October 2005" 13 I12 Interchange Control Number M N0 9/9 000000020 Number assigned to the interchange so as to be unique from other interchanges in the document. The interchange trailer pair should have the same number. 14 I13 Acknowledgment Requested M ID 1/1 1 The value "1" indicates that the sender is requesting an interchange acknowledgment at receipt of the interchange. The value "0" is used otherwise. 15 I14 Interchange Usage Indicator M ID 1/1 T The value "T" indicates that this interchange is for testing only. For production, use "P"; for Information, use "I". 16 I15 Component Element Separator M 1/1 > Component element separator.
The delimiters of each interchange in the document is determined from the interchange header alone. The following is the process how each delimiters are discovered:
Properly specifying the delimiters in the interchange header is critical to processing the document correctly. The interchange header is the first data stream encountered in the document, and by its raw information can one determine the nature of the data enveloped by the interchange entity. The delimiters dissect the raw data in the interchange header into its known constituents. These information are:
The repetition separator determined above is "!" (exclamation), and the version
is "00503". The diagram below demonstrates what happens if the repetition
separator is identical to the element separator, that is, the "!" is replaced
by "*".
Based on the erroneous raw data, the repetition separator is translated
as empty, and the control version number is translated as empty as
well.
Programmatically Reading the Interchange Header
The following steps demonstrates how to read the interchange header.
Dim oEdiDoc As Fredi.ediDocument
Set oEdiDoc = New Fredi.ediDocument
Dim oSchemas As Fredi.ediSchemas
Dim oSchema As Fredi.ediSchema
' Disable standard reference library.
Set oSchemas = oEdiDoc.GetSchemas
oSchemas.EnableStandardReference = False
Set oSchema = oEdiDoc.LoadSchema(App.Path & "\SampleAscX12_850.SEF", Schema_Standard_Exchange_Format)
' Load EDI document normally.
oEdiDoc.LoadEdi App.Path & "\SampleEdiX12_850.X12"
Dim oInterchange As Fredi.ediInterchange
' Get first interchange.
Set oInterchange = oEdiDoc.FirstInterchange
' Get interchange header.
Dim oHeader As Fredi.ediDataSegment
Dim oElements As Fredi.ediDataElements
Dim oElement As Fredi.ediDataElement
Dim sResult As String
Dim i As Integer
Set oHeader = oInterchange.GetDataSegmentHeader
' Get elements collection.
Set oElements = oHeader.DataElements
sResult = ""
For Each oElement In oElements
sResult = sResult & oElement.ID & " = " & oElement.Value & vbCrLf
Next
Programmatically Generating the Interchange Header
The following steps demonstrates how to generate the interchange header.
Dim oEdiDoc As Fredi.ediDocument
Set oEdiDoc = New Fredi.ediDocument
Dim oSchemas As Fredi.ediSchemas
Dim oSchema As Fredi.ediSchema
' Disable standard reference library.
Set oSchemas = oEdiDoc.GetSchemas
oSchemas.EnableStandardReference = False
Set oSchema = oEdiDoc.LoadSchema(App.Path & "\SampleAscX12_850.SEF", Schema_Standard_Exchange_Format)
' Specify the terminators to use on the document.
oEdiDoc.SegmentTerminator = vbCrLf
oEdiDoc.ElementTerminator = "*"
oEdiDoc.CompositeTerminator = ">"
Dim oInterchange As Fredi.ediInterchange
' Create the Interchange envelope.
Set oInterchange = oEdiDoc.CreateInterchange("X", "005030")
Dim oHeader As Fredi.ediDataSegment
' Get the interchange header.
Set oHeader = oInterchange.GetDataSegmentHeader
' Set the values of the elements.
oHeader.DataElementValue(1) = "00"
oHeader.DataElementValue(3) = "00"
oHeader.DataElementValue(5) = "ZZ"
oHeader.DataElementValue(6) = "SENDERISA"
oHeader.DataElementValue(7) = "ZZ"
oHeader.DataElementValue(8) = "RECEIVERISA"
oHeader.DataElementValue(9) = "960807"
oHeader.DataElementValue(10) = "1548"
oHeader.DataElementValue(11) = "U"
oHeader.DataElementValue(12) = "00503"
oHeader.DataElementValue(13) = "000000020"
oHeader.DataElementValue(14) = "0"
oHeader.DataElementValue(15) = "T"
oHeader.DataElementValue(16) = ">"