Electronic Data Interchange | |
The Functional Group Header (ASC/X12) |
The Functional Group Header is the starting control segment of the functional group envelope. The functional group header contains:
This topic covers:
Functional Group Header in a Document
In the document, the group header is identified with the first letters "GS" followed by the element separator.
The group header data stream fit into the implementation guideline defined for the group header as follows:
REF ELE NAME REQ TYPE MIN/MAX VALUE COMMENT 01 479 Functional Identifier Code M ID 2/2 IN Functional identifier code. All transaction sets enveloped by the functional group must be categorized under the same identifier code. 02 142 Application Sender's Code M AN 2/15 SENDERDEPT This value identifies the sender of the group. 03 124 Application Receiver's Code M AN 2/15 RECEIVERDEPT This value identifies the receiver of the group. 04 373 Date M DT 8/8 20090419 Date the group was prepared. 05 337 Time M TM 4/8 1548 Time the group was prepared 06 28 Group Control Number M N0 1/9 1 This control number is unique to the functional group within the interchange. 07 455 Responsible Agency Code M ID 1/2 X Controlling agency is ASC/X12. 08 480 Version / Release / Industry Identifier Code M AN 1/12 005030VICS This value indicates the implementation version that applies to the functional group structure and underlying transaction sets. The value is subdivided as follows:
- 1 - 3 is the version which is "005",
- 4 - 6 is the release and subrelease which is "030", and
- 7 - 12 is the industry or trade association which is "VICS".
Programmatically Reading the Functional Group Header
The following steps demonstrates how to read the group 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
Dim oGroup As Fredi.ediInterchange
' Get first group.
Set oGroup = oInterchange.FirstGroup
' Get group 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 = oGroup.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 Functional Group Header
The following steps demonstrates how to generate the group 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 Group 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) = ">"
Dim oGroup As Fredi.ediGroup
' Create the Group envelope.
Set oGroup = oInterchange.CreateGroup("005030")
Dim oHeader As Fredi.ediDataSegment
' Get the group header.
Set oHeader = oGroup.GetDataSegmentHeader
' Set the values of the elements.
Set oHeader = oGroup.GetDataSegmentHeader
oHeader.DataElementValue(1) = "IN"
oHeader.DataElementValue(2) = "SENDERDEPT"
oHeader.DataElementValue(3) = "RECEIVERDEPT"
oHeader.DataElementValue(4) = "20090419"
oHeader.DataElementValue(5) = "1548"
oHeader.DataElementValue(6) = "1"
oHeader.DataElementValue(7) = "X"
oHeader.DataElementValue(8) = "005030VICS"