Framework EDI Reference. Methods and Properties
ediFile. IsAscX12

Indicates if the file is an ASC/X12 EDI document.

Syntax:

Remarks

FREDI does a scan for a valid ASC/X12 header to quickly determine if the file is an ASC/X12 document.  It does the following:

  1. Attempt to detects an interchange header control segment identifier - ISA - as the first string in the file, and, if found, determines the existence of data elements between the ISA segment up to the next control segment.  If data elements exist, then the file is determined to be an ASC/X12 document.
  2. If ISA is not found, FREDI attempts to detect the interconnect mailbag header - IH - as the first string in the file.  If the string is found, a search is made for the next valid control segment, which is either the interconnect acknowledgment - IA - or the interconnect mailbag trailer - IT.  If a valid control segment is found, the file is determined to be an ASC/X12 document.

In the example below, only the shaded portion has been verified to determine if the file is an ASC/X12 file.

 

Example

Dim oEdiDoc As Fredi.ediDocument
Dim oFileSystem As Fredi.ediFileSystem
Dim oFile As Fredi.ediFile

' Create instance of Framework EDI.
Set oEdiDoc = New Fredi.ediDocument

' Get file system object.
Set oFileSystem = oEdiDoc.GetFileSystem

' Get file object.
Set oFile = oFileSystem.GetFile(App.Path & "\TestFile_850.X12")

If oFile.IsAscX12 Then

MsgBox oFile.FileName & " is an ASC/X12 document"
Else
MsgBox oFile.FileName & " is NOT an ASC/X12 document"
End If

Samples