Was this helpful?
EDI X12 (eDoc)
With the EDI X12 connector, Map Editor can read and write EDI X12 files and messages. EDI, or Electronic Data Interchange, uses standard formats to exchange data among disparate business systems. Standard formats exist for nearly all business transactions and are used to enforce validity and completeness of those transactions. The EDI standard in the United States is ANSI X12, developed by the Data Interchange Standards Association (DISA). For details, see the X12 EDI Standard web site.
EDI Structure
EDI document structure contains Headers that identify the transaction type. Within the document, Segments and Elements further define the data and its structure. If you make changes to the default EDI schema, make sure you adhere to the following EDI schema rules to prevent the updated schema from becoming invalid.
Note:  The schema must include two sections—root_defs that defines the schema structure at the root level and type_defs that defines the record types.
Interchange (ISA -IEA)
A container of one or more functional groups. The interchange/message container must include a header (ISA) and trailer (IEA). The segments can appear only once in the message. The record type name is always Loop.Function.
Note:  Do not edit Interchange (ISA- IEA).
Elements:
name - Required. Identifies the unique identifier for the group.
max_occurs - Optional. Defines the field requirement:
0: optional
1: required
If min_occurs is 0 and max_occurs is 0, the field is not used.
min_occurs - Identifies the minimum number of times a repeat can occur within a group:
0: Default value
1: unbounded.
An unbounded minimum occurrence means multiple functional groups can exist.
sequence - Indicates the position of the loop within the transaction.
rec_type_ref - Identifies the record definition. For examples, ISA, IEA, GS, and GE.
Functional Group (GS - GE)
A collection of messages. The functional group container must include a header (GS) and trailer (GE) and must reside inside the interchange enveloping segment. The record type name is always Loop.Function.
Note:  Do not edit Functional Group (GS - GE).
Elements:
name - Required. Identifies the unique identifier for the message.
max_occurs - Optional. Defines the field requirement:
0: optional
1: required
If min_occurs is 0 and max_occurs is 0, the field is not used.
min_occurs - Optional. Identifies the minimum number of times a repeat can occur within a group:
0: Default value
1: unbounded
An unbounded minimum occurrence means multiple transactions can exist in the group.
rec_type_ref - Identifies the record definition. For examples, ISA, IEA, GS, and GE.
Transaction (ST - SE)
A container of one or more segments and loops. Also, referred to as a message. The transaction container must include a header (ST) and trailer (SE) and reside inside of the functional group. The record type name is always Loop.Message.
Note:  Do not edit Functional Group (ST - SE).
Elements:
name - Required. Identifies the unique identifier for the segment or loop.
max_occurs - Optional. Defines the field requirement:
0: optional
1: required
If min_occurs is 0 and max_occurs is 0, the field is not used.
min_occurs - Optional. Identifies the minimum number of times a repeat can occur within a group:
0: Default value
1: unbounded
An unbounded minimum occurrence means multiple functional groups can exist in the transaction.
rec_type_ref - Identifies the record definition. For examples, ISA, IEA, GS, and GE.
Choice
Defines a group of loops or a group of segments in which only one loop or segment can be selected. The record type name always includes Choice as the prefix. For example, Choice.2000
Elements:
name - Required. Identifies the unique identifier for the group of segments or loops.
recognition_rule - Required. Identifies the recognition rule name.
discriminator_field - Required. The fully qualified name in one of the referred record or structure in the Choice group. Uses the format: recordname/field. A forward slash (/) separates the record name and field name. For example, HL.0010/E.735.03.
max_occurs - Optional. Defines the field requirement:
0: optional
1: required
If min_occurs is 0 and max_occurs is 0, the field is not used.
min_occurs - Optional. Identifies the minimum number of times a repeat can occur within a group:
0: Default value
1: unbounded
An unbounded minimum occurrence means multiple functional groups can exist.
Loop
Repeating data within the message that is mapped to the JSON field. The record type name always contains the Loop prefix. For example, Loop.1000A
Elements:
name - Required. Identifies the loop name.
max_occurs - Optional. Defines the field requirement:
0: optional
1: required
If min_occurs is 0 and max_occurs is 0, the field is not used.
min_occurs - Optional. Identifies the minimum number of times a repeat can occur within a group:
0: Default value
1: unbounded
An unbounded minimum occurrence means multiple functional groups can exist.
sequence - Indicates the loop is defined in a sequential order.
Segment
A collection of fields that shares a particular data type.
Elements:
name - Required. Identifies the unique identifier for the field.
max_occurs - Optional. Defines the field requirement:
0: optional
1: required
If min_occurs is 0 and max_occurs is 0, the field is not used.
min_occurs - Optional. Identifies the minimum number of times a repeat can occur within a group:
0: Default value
1: unbounded
An unbounded minimum occurrence means multiple functional groups can exist.
sequence - Indicates the segment is defined in a sequential order.
Composite
Defines a group of elements in a sequence that is mapped to struct_type_ref. Prefixed with C.
Elements:
name - Requires. Identifies the unique identifier for the element.
max_occurs - Optional. Defines the field requirement:
0: optional
1: required
If min_occurs is 0 and max_occurs is 0, the field is not used.
min_occurs - Optional. Identifies the minimum number of times a repeat can occur within a group:
0: Default value
1: unbounded
An unbounded minimum occurrence means multiple functional groups can exist.
sequence - Indicates the composite is defined in a sequential order.
Element
The element ID uses the prefix E. For example, E.I12.13.
Elements:
name - Required. Identifies the unique identifier for the element.
max_occurs - Optional. Defines the field requirement:
0: optional
1: required
If min_occurs is 0 and max_occurs is 0, the field is not used.
min_occurs - Optional. Identifies the minimum number of times a repeat can occur within a group:
0: Default value
1: unbounded
An unbounded minimum occurrence means multiple functional groups can exist.
sequence - Indicates the element is defined in a sequential order.
type - Indicates the data type for the element:
identifier (ID)
alphanumeric (AN)
date (DT)
time (TM)
float (R)
binary (B)
numeric (N0 to Nn, 0…n is the decimal size).
length - Indicates the maximum length for the element:
0
MAX_LONG
unbounded
min_length - The minimum length of characters allowed for the field data type.
Note:  You cannot edit the min_length property using the Schema Editor. To edit this value, open the schema file in JSON editor and change the value.
Version Mismatch Errors
The ANSI standards reflect generic supersets designed to address a wide range of data exchange requirements. You may decide to define your own "subset" and develop rules that describe the data you submit. If you elect to develop your own schema, be aware that many errors can be traced to schema "version mismatch". It is important that all trading partners agree on the specific version of the schema to be used in transactions. Addenda schemas especially, should be examined to verify version match with all parties involved in the transaction.
To verify the version of a schema, open the schema in a text editor. Check the header information. In the header, notice the date created and date (last) modified fields. These fields offer a convenient method to determine precise version match.
Changes to, or customization of the schema must be communicated among and mutually agreed upon by all trading partners prior to "live" data exchange. A customized or modified schema should be verified by each partner to ensure version match at each point of exchange within the trading group. Thorough preparation, well ahead of time, is the key to minimize production errors.
Recommended Practices
Begin with schema versions that are standard and current.
Agree with each trading partner on which schema version to use.
Check schema addenda for version match at each point-of-exchange.
Test the data exchange and test it frequently, well ahead of production deadline.
Connector Properties
You can set the following source and target properties.
Property
ST
Description
Encoding
ST
Type of character encoding to use with source and target files. The default value is OEM.
Shift-JIS encoding is used only in Japanese operating systems.
UCS-2 is no longer considered a valid encoding name, but you may use UCS2. In the data file, change UCS-2 to UCS2.
Note:  This property is not encoding of the database that you connect to, but it is the encoding in which the connector expects to receive SQL query statements that must be sent to the database.
SchemaFile
ST
Schema file for the source or target file. Click within the cell and then click Browse to specify schema file. Click Open to apply the file.
Skip
S
If set to True, the segments that do not match those in the applied schema file are not read. The default value is False. If you are reading large EDI files and have many mismatches, then Map Editor parsing time increases. In this case, it must be set to False.
SegmentTerminator
T
Select a Segment Terminator. For the available options, see Element Separator Options.
ElementSeparator
T
Select the Element Separator. For the available options, see Element Separator Options. In other connectors, such as ASCII (Fixed), this property is called the FieldSeparator.
SubElementSeparator
T
Select a sub element separator. For the available options, see Element Separator Options. The SubElementSeparator property value supersedes any value mapped in the ISA segment. It allows overrides of values from the command line or through the API.
RepetitionSeparator
T
Sets the character used to separate multiple occurrences of a field.
LineWrap
T
Sets the type of line wrap you want to use in the data file. The default is None.
Some EDI files may consist of a constant stream of data with no line separators. LineWrap forces a temporary line-wrapping behavior. When you attempt to connect to your EDI file and you receive parse error messages, try changing the setting to CR-LF, CR, LF, or LF-CR.
WrapLength
T
Sets the length of line wrap you want to use in your target file. The default is 80.
Element Separator Options
CR-LF
STX (0001)
SOT(0002)
ETX(0003)
EOT(0004)
ENQ(0005)
ACK(0006)
BEL(0007)
BS(0008)
HT(0009)
LF(000A)
VT(000B)
FF(000C)
CR(000D)
SO(000E)
S1(000F)
DLE(0010)
DC1(0011)
DC2(0012)
DC3(0013)
DC4(0014)
NAK(0015)
SYN(0016)
ETB(0017)
CAN(0018)
EM(0019)
SUB(001A)
ESC(001B)
FS(001C)
GS(001D)
RS(001E)
US (001F)
SP(0020)
! (0021)
" (0022)
#(0023)
$(0024)
%(0025)
& (0026)
'(0027)
( (0028)
) (0029)
* (002A)
+ (002B)
, (002C)
- (002D)
. (002E)
/ (002F)
: (003A)
; (003B)
< (003C)
= (003D)
>(003E)
? (003F)
@(0040)
[ (005B)
\ (005C)
] (005D)
^ (005E)
_ (005F)
‘ (0060)
{ (007B)
| (007C)
} (007D)
~ (007E)
DEL (007F)
Supported Output Mode
EDI X12 (eDoc) connector supports the Replace output mode. For information about output modes, see Target Output Modes.
Data Type
The following data types are available:
a
AN
an
B
DT
ID
Loop
n
N0
N1
n10
N11
N12
N13
N14
N15
N16
N17
N18
N19
N2
N20
N3
N4
N5
N6
N7
N8
N9
R
Segment
TM
Note:  The data types that you see under Type in the target schema (Map tab) are EDI data type names. However, these data types are read as Text by Map Designer. To use a DT EDI data type in an expression, you would need to treat the data type as Text that must be converted to a DateTime data type. For more information about converting data types, search for "commonly used functions" in the documentation.
Last modified date: 08/02/2023