EDI Interview Questions
EDI Interview Questions
EDI Interview Questions
EDI Definition
EDI or Electronic Data Interchange is the exchange of data in a standard format between computers
without any human intermediary.
EDI Standards
Two widely used standards are X12 (commonly used in U.S.A. and Canada), and UN/EDIFACT
(commonly used in Europe and the rest of the world).
EDI Processes
A typical EDI exchange involves the following processes:
Outbound Process
The Outbound process is the generating and sending of EDI files. Below are the steps of an outbound
process.
Inbound Process
The Inbound process is the receiving and translating of EDI files. Below are the steps of an inbound
process.
The Control Segments are the header and trailer segments that mark the start and end of their controlling
structure.
The Header/Trailer control segments of the Interchange are the ISA/IEA in X12, and UNB/UNZ
in UN/EDIFACT.
The Header/Trailer control segments of the Functional Group are the GS/GE in X12, and
UNG/UNE in UN/EDIFACT.
The Header/Trailer control segments of the Transaction Set are the ST/SE in X12, and UNH/UNT
in UN/EDIFACT
List of Commonly Used EDI Segments
Segment /
Trans.
Example Name Description
Type
Elements
Interchange Identifies the sender and receiver using
All ISA
Information QID's. There is only one ISA
Functional Group Identifies the kind of business documents
All GS
Header in this transmission
Transaction Set Marks beginning of a document, for
All ST
Header example a Purchase Order
Transaction Set Marks the end of a document, for
All SE
Trailer example an Invoice
Functional Group
All GE Marks the end of a functional group
Trailer
Interchange Color Marks the end of functional group(s) and
All IEA
Trailer the end of an EDI Transmission
Marks the start of the purchase order and
PO BEG Beginning
has identifying information
Reference
PO REF
Identification
To request or identify a service,
Service, Promotion,
PO SAC promotion, allowance, or charge and the
Allowance, or Charge
associated amount or percentage
PO ITD Terms of Sale Specifies the terms of the sale
PO DTM Date/Time Reference Specifies relevant dates as well as times
To identify a party or organization using
PO N1 Name
a code
PO N3, N4 Address Information Street, City, State address information
Specifies most frequently used Purchase
PO PO1* Baseline Item Detail
Order line item data
Marks the start of an the advance ship
ASN BSN Beginning
notice and has identifying information
ASN TD5 Carrier Details Specifies the carrier and routing sequence
Reference May be used for matching the Carrier's
ASN REF
Identification EDI 214 Carrier Status message
To identify a party or organization using
ASN N1 Name
a code
Purchase Order Contains data about the purchase order
ASN PRF
Reference being filled by this ASN
Specifies transportation details including
ASN TD1 Carrier Details
commodity, weight, and quantity
Specifies the packaging, weight, and
ASN PO4* Item Physical Details
dimensions
Indicates identifying marks and numbers
ASN MAN* Marks and Number
on the shipment
ASN LIN* Item Identification Item identification data
Item Detail Specifies line-item detail for this
ASN SN1*
(Shipment) shipment
Marks the start of the invoice and has
Invoice BIG Beginning
identifying information
To identify a party or organization using
Invoice N1 Name
a code
Invoice ITD Terms of Sale Specifies the terms of the sale
Invoice DTM Date/Time Reference Specifies relevant dates and times
FOB Related Specifies transportation and payment
Invoice FOB
Instructions instructions for a shipment
To request or identify a service,
Service, Promotion,
Invoice SAC promotion, allowance, or charge and the
Allowance, or Charge
associated amount or percentage
Specifies transportation details for the
Invoice CAD Carrier Detail
items being invoiced
Specifies most frequently used invoice
Invoice IT01* Baseline Item Detail
line item data
Product/Item
Invoice PID* Describes a product
Description
The essence of X12 is defined in X12.5 and X12.6. These standards provide the syntax and control
structures which allow data elements, segments, and transaction sets to be defined. For those with a
background in computer science, the basic X12 grammar qualifies as a context free grammar. It is specified
in X12.5 and X12.6 using Backus-Naur Form (BNF) notation.
In this tutorial, only the basic concepts of the X12 syntax are addressed. The X12.58 security standards are
relevant to X12.5 and X12.6 as discussed here, but are not included in the discussion.
Data elements are defined in the X12 Data Element Dictionary - X12.3. A data element is equivalent to a
field in a data dictionary. Data elements have a name, a data element number, a brief description, a data
type, and a minimum and maximum length. For elements which represent codes, either a list of valid codes
is included or a reference is included to a source outside of the X12 standard.
Data Types
N - Numeric with implied decimal point, signed. Example: N2 indicates a numeric with two
decimal places. 12.34 becomes 1234. N0 indicates in integer.
R - Decimal Number with explicit decimal point, signed. Example: 12.34 represented in R format
is 12.34. Starting with 4010, exponential notation is also supported.
ID - Identifier - A coded value, usually alphanumeric.
AN - String - alphanumeric.
DT - Date - YYMMDD. As of 4010, CCYYMMDD is also supported.
TM - Time - HHMM, with optional seconds and hundredths.
B - Binary - Any sequence of 8 bit bytes.
A composite data structure consists of two or more simple data elements separated by a delimiter character
known as the component data element separator. The individual component data elements in the composite
may be designated as either mandatory or optional.
2.3 Segment
Segments are defined in the X12 Segment Directory - X12.22. A segment is equivalent to a record type. A
segment is composed of one or more data elements or composite data structures, which are equivalent to
the fields in a record. Segments start with a two or three character segment tag which identifies the
segment, equivalent to a record type field. Data elements are separated by a delimiter character known as
an element separator, and end with a different delimiter character known as the segment terminator.
Elements which are not assigned values in a particular instance of a segment are represented by consecutive
delimiters, and such trailing delimiters are not transmitted. For example, if a segment XYX has five
elements and in a particular transmission only the second has a value, it is represented as XYZ**123<CR>,
where "*" is the element separator and <CR> is the segment terminator.
2.3.1 Elements
Example: In the N1 Name segment, the first element, N1_01, data element number 98 (Entity Identifier
Code), is mandatory. Elements three and four ( 66 Identification Code Qualifier and 67 Identification Code)
have a Semantic Note indicating a Conditional Relationship of P0304. If one is present, then both must be
present.
Segments may have Semantic Notes indicating the meaning to be applied to data elements, beyond just
their name and description. For example: In the N9 Reference Number Segment, a Semantic Note indicates
that the sixth element, 623 Time Code, indicates the time zone of the fifth element, 337 Time.
A Transaction Set is a group of one or more data segments conveyed between trading partners. It usually
represents a business document such as a Purchase Order, but any unit of information meaningful to both
parties is sufficient. Transaction Sets are defined in the X12 standard with a number and name, a statement
of purpose, a Functional Group ID, and a table listing the included segments, their position numbers,
requirement designation, maximum usage, and loop repeat counts. Transaction Sets start with an ST
Transaction Set Header segment and end with an SE Transaction Set Trailer segment.
A specific segment may occur in several positions within a transaction set, representing different
information in each different position. For example, an N3 segment in the previous example regarding the
837 Health Care Claim applies to the Subscriber's street address in the first NM1 loop, but would represent
the provider's address in the 2310 NM1 loop. Transaction Sets are structured such that, in any given data
stream containing a Transaction Set, a segment's position in the defined standard for the Transaction Set
may be determined solely by the segment tag (except when LS/LE loops are used). In other words, the
segments defined position in regard to the standard is determined by considering the segments that
appeared before it in the data stream.
The Transaction Set definition includes attributes which apply to segments in a Transaction Set. These are:
Position
Requirement - Mandatory or Optional (and in earlier version of X12, Floating)
Maximum Occurrences - If more than 1, then the segment may be repeated at that position in the
Transaction Set up through the maxim usage indicated.
2.4.2 Loops
A loop is a set of related segments in a Transaction Set. Segments are grouped together in this way to
conveniently represent a block of related information. No formal Loops are defined, but several basic loop
types, such as a Name/Address loop, appear with minor variations in many Transaction Sets. Different
loops may be nested within each other, and loops may repeat up to the maximum loop occurrences
specified within the Transaction Set. X12 defines two types of loop formats: Unbounded and Bounded.
2.4.2.1 Unbounded
An Unbounded loop starts with a specific segment, and all of the other segments in the loop may be
considered children of that segment. The start segment may appear once and only once in the loop, and
each new occurrence of the starting segment starts a new loop. A loop has a requirement designation of
optional or mandatory (corresponding to the requirement designator of the first segment in the loop), and a
repeat count indicating the maximum number of times it may repeat. If any of the segments in the loop are
used, the starting segment must be used even if the loop itself is optional. An example of an unbounded
loop is the N1/N2/N3/N4 Name and Address loop. It starts with the N1 Name segment, and includes the N2
Additional Name, N3 Address, and N4 Geographic Location segments.
A bounded loop has the same characteristics as an unbounded loop, except it is bracketed by LS Start Loop
and LE End Loop segments. Any of the segments in the loop may be the first in a specific instance of the
loop, depending on requirement designation of the loop. Bounded loops are used to identify loops that
otherwise would be indistinguishable from each other. If the loop does not appear in a particular
transmission, the LS and LE segments should not appear.
An example of a bounded loop appears in the 837 Health Care Claim ( Version 3040 in this example ). At
Position 2110, we start an NM1 loop identifying the subscriber. Within this NM1 loop, we have several
other NM1 loops identifying other entities related to this subscriber. Such as, at 2310 there is an NM1 loop
describing the Health Care provider. This 2310 loop is bounded by an LS/LE structure. Without the LS/LE,
it would appear that we are starting a new NM1 loop at 2110 for the Subscriber. This section of the 837
appears below:
A Functional Group is a group of one or more related Transaction Sets sharing the same Functional Group
ID. Functional Groups start with a GS Functional Group Header segment and end with a GE Functional
Group Trailer segment. The details in the Functional Group GS/GE envelope are often used to route the
group's transaction sets to the appropriate department or business application within a company.
2.7 Interchange
An Interchange is the lowest unit of data exchanged between trading partners. It consists of one or more
Functional Groups enclosed in an envelope defined by an ISA Interchange Control Header segment and
ending with an IEA Interchange Control Trailer segment. The details in the ISA segment are often used to
route the Interchange between trading partners in an EDI Value Added Network, or VAN.
3 Envelope Details
Listed here are brief descriptions of the control segments for the interchange, group, and transaction set
envelopes. For full explanation of these segments, their purposes, and their data elements, refer to X12.5
Interchange Control Structures, X12.6 Application Control Structure, X12.22 Segment Directory, and
X12.3 Data Element Dictionary.
The ISA is effectively fixed length, since all of the elements are fixed length. This results in the segment
terminator always being in position 106. The element separator can be obtained from position 4, and the
subelement separator from 105. These delimiters allow the remainder of the interchange to be parsed.
IEA01 - Number of Included Functional Groups - This is used for message integrity, developed
before such things as check sums were widely implemented.
IEA02 - Interchange Control Number - Must match the control number in the IEA.
The Group Envelope, as noted above, may be used for internal routing. The X12 Version/Release is
specified in the GS, so all of the Transaction Sets in the group must be of the same version/release.
GS01 - Functional Group Header Code - Same as the Group Type of the included Transaction
Sets.
GS02 - Application Sender's Code
GS03 - Application Receiver's Code
GS04 - Date - YYMMDD, or CCYYMMDD as of 4010.
GS05 - Time - HHMM
GS06 - Group Control Number - Like the ISA control number, is used for audit and to detect
duplicates, missing, or out of sequence groups. Most importantly, the 997 Functional
Acknowledgment, which acts as a return receipt for the group, references the group control
number. May take any numeric value so long as there are no duplicates in the interchange, but is
usually incremented by one for each group of this type sent to the same trading partner.
GS07 - Responsible Agency Code - X for X12 or T for TDCC
GS08 - Version/Release/Industry Identifier Code - The first six characters specify the X12 version
and release, while any of the last six may be used to indicate an Industry standard or
Implementation Convention reference.
GE01 - Number of included Transaction Sets - This is used for message integrity, developed
before such things as check sums were widely implemented.
GE02 - Group Control Number - Must match the group control number of the GS
ST01 - Transaction Set Identifier Code - A three digit numeric code identifying the Transaction
Set type, from the Transaction Set table.
ST02 - Transaction Set Control Number - May take any alphanumeric value so long as there are
no duplicates in the functional group. Usually starts with 0001 in each group, but there are several
other numbering schemes in common usage. Is referenced in the 997 Functional Acknowledgment
if individual transaction sets are positively acknowledged or if there are errors in the transaction
set indicating a rejection.
SE01 - Number of included segments - This is used for message integrity, developed before such
things as check sums were widely implemented.
SE02 - Transaction Set Control Number - Must match the Transaction Set Control Number in the
ST.
4 Example Interchange
This example has one transaction set, in one functional group, in one interchange. An asterisk "*" is used
for the element separator. A carriage return "^M" is used for the segment terminator. Each segment is listed
on a separate line for readability, but in reality the data appears as a single stream with the segments
separated only by the <CR>. There are four N1 Name/Address loops. Please note that the ISA segment is
wrapped over two lines to enable easier reading.
ITD Terms Of Sale/ Defferred Terms Of Sale Optional - Can Occur 999999
1510 1 O ID 2/2 336 Terms Type Code
12 O AN 1/80 352 Description
2 O AN 1/60 63 Name
End Of SAC
Loop
5 M DT 8 373 Date
Not
6 O AN 1/30 367 Used Contract Number
Not
7 O ID 2/2 587 Used Acknowledgment Type
PER Loop
PER Administrative Communications Contact Segment is optional
510 1 M ID 2/2 366 Contact Function Code
2 O AN 1/60 93 Name
Not
3 R ID 2/2 365 Used Communication Number Qualifier
Not
PID (2110) Product/Item Description Used
Not
MAN (2910) Marks and Numbers Used
Not
CTB (3110) Restrictions/Conditions Used
N9 Reference Identification
3910 1 M ID 2/3 128 Reference Identification Qualifier
2 R AN 1/30 127 Reference Identification
3 R AN 1/45 369 Free-form Description
N1 Name BUYER
4210 1 M AN 2/3 98 Entity Identifier Code
2 R AN 1/60 93 Name
3 R ID 1/2 66 Identification Code Qualifier
4 R AN 2/80 67 ID Code
REF (4710) Reference Identification Not Used
PER (4810) Administrative Communications Contact Not Used
TD5 (5210) Carrier Details (Routing Sequence/Transit Time)
End of N1 Loop
SPI (5810) Specification Identifier
PO1 Loop
Not
REF (9110) Reference Identification Used
Not
TAX (10110) Tax Reference Used
Not
DTM (10510) Date/Time Reference Used
Not
MSG (11310) Message Text Used
Not
SCH (11910) Line Item Schedule Used
Not
PKG (12510) Marking Used
Not
N9 (13510) Reference Identification Used
MSG (13810) Message Text
Summary Details
CTT Transaction Totals
19410 1 M N 1/6 354 Number of Line Items
2 O R 1/10 347 Hash Total
3 O R 1/10 81 Weight
4 O S 2/2 355 Unit or Basis for Measurement Code
CUR Currency
2 R AN 1/60 93 Name
3 R ID 1/2 66 Identification Code Qualifier
4 R AN 2/80 67 Identification Code
N3 Address Information
1010 1 M AN 1/55 166 Address Information
2 R AN 1/60 166 Address Information
N4 Geographic Location
1110 1 O AN 2/30 19 City Name
2 O ID 2/2 156 State or Province Code
3 O ID 3/15 116 Postal Code
4 O ID 2/3 26 Country Code
ITD Terms of Sale/Deferred Terms of Sale Can occur 1 time
13 - 15 not used
Detail Section
IT1 Loop
Loop is Optional
-
Summary Section
3 R R 1/10 81 Weight
Unit or Basis for Measurement Code
4 R ID 2/2 355
3 O DT 8 337 Time
4 O A 2 623 Time Code
N
Order Level
HL Hierarchical Level Can occur 1 time
A 1/1
410 1 M 628 Hierarchical ID Number
N 2
A 1/1
2 O 734 Hierarchical Parent ID Number
N 2
3 M ID 1/2 735 Hierarchical Level Code
Item Level
HL Hierarchical Level Can occur 1 time
A 1/1
410 1 M 628 Hierarchical ID Number
N 2
A 1/1
2 O 734 Hierarchical Parent ID Number
N 2
3 M ID 1/2 735 Hierarchical Level Code
A
3 M 1/2 355 Unit or Basis for Measurement Code
N
CTT
Loop
CTT Transaction Totals segment is optional
2 O AN 1/60 93 Name
Order Level
Item Level
SN1 Measurements
610 1 O AN 1/20 350 Not Used Assigned Identification
2 M R 1/10 382 Number of Units Shipped
CTT Loop