Understanding Separator Characters

An EDI file consists of tokens terminated by separators. Special characters are used to define separators and other symbols, like the decimal character. You can specify the characters used for the following EDI file items:

  • Segment terminator
  • Element separator
  • Component value separator
  • Subcomponent (tertiary) separator
  • Segment name/segment content separator
  • Release (escape) character
  • Decimal character
  • Repeat symbol

Values for some of these items are set explicitly in the EDI data stream. For example, in X12, the component separator is the value of the ISA16 field (the "I15: Component Element Separator"). In EDIFACT, separator values can be set using the contents of the UNA segment.

How Stylus Studio Sets Separator Characters

When writing XML to EDI, Stylus Studio overwrites separator values using a set of processing instructions (PIs) in the XML. As long as the character specified in the PI has not been emitted to the output stream, it can be changed. For example, the segment terminator can be changed using the PI only before the first segment is written to EDI.

Note

 

In X12, since the I15 element contains the component separator, it cannot be set by a PI as one value would conflict with the other.

Setting Processing Instruction

Stylus Studio uses the following naming convention and default values for XML processing instructions used to set values for separator characters:

Name
Default Value
edi_segment
'
edi_release
?
edi_element
+
edi_component
:
edi_repeat
~
edi_decimal
,

Note that the decimal character is read from the underlying platform default. If no default is set, the EDIFACT standard specifies a comma.
edi_tertiary
&
edi_follow
=
Table 24. Processing Instructions for Separator Characters

If a PI is used to set the value for one separator (say, edi_A) to a default value being used by another separator (edi_B), a new value will be chosen for the edi_B separator unless one has already been specified.

URI switches are available for each of these processing instructions. See the DataDirect XML Converters documentation at http://www.xmlconverters.com/doc/. for more information.

Syntax

The syntax of the PI is just "<?" followed by the name, followed by a space, and then the new special character before a closing "?>" tag. Consider a few examples:

<?edi_segment \n?> 
<?edi_release \\?> 
<?edi_element $?> 
<?edi_component \x0001?> 
<?edi_decimal .?> 

Here is another example, showing PIs used in context. In this example, an X12 document needed to be written to meet the following requirements:

  • The segment terminator needs to be a carriage return
  • The element separator needs to be an asterisk
  • The component separator needs to be a greater-than symbol.

The two PIs and the Component Element Separator are shown in bold for clarity:

<?xml version="1.0" encoding="utf-8"?> 
<?edi_segment \r?> 
<?edi_element *?> 
<X12> 
	<ISA> 
		<ISA01><!--I01: Authorization Information Qualifier-->00</ISA01> 
		<ISA02><!--I02: Authorization Information-->          </ISA02> 
		<ISA03><!--I03: Security Information Qualifier-->00</ISA03> 
		<ISA04><!--I04: Security Information-->          </ISA04> 
		<ISA05><!--I05: Interchange ID Qualifier-->01</ISA05> 
		<ISA06><!--I06: Interchange Sender ID-->1515151515     </ISA06> 
		<ISA07><!--I05: Interchange ID Qualifier-->01</ISA07> 
		<ISA08><!--I07: Interchange Receiver ID-->5151515151     </ISA08> 
		<ISA09><!--I08: Interchange Date-->041201<!--2004-12-01--></ISA09> 
		<ISA10><!--I09: Interchange Time-->1217</ISA10> 
		<ISA11><!--I65: Repetition Separator-->U</ISA11> 
		<ISA12><!--I11: Interchange Control Version-->00403</ISA12> 
		<ISA13><!--I12: Interchange Control Number-->000032123</ISA13> 
		<ISA14><!--I13: Acknowledgment Requested-->0</ISA14> 
		<ISA15><!--I14: Usage Indicator-->P</ISA15> 
		<ISA16><!--I15: Component Element Separator-->></ISA16> 
	</ISA> 
... 

If the segment terminator (edi_segment) is set to \r or \n, consider changing the default value for the Add linefeeds between segments on write property. Otherwise, the EDI output will have double endings. See the DataDirect XML Converters documentation for complete properties reference information: http://www.xmlconverters.com/doc/.

Ways to Specify Control Characters

In addition to literal characters, you can also specify control characters using the values in the following table. The values you set for these properties apply only when converting XML to EDI. Not all EDI dialects use all special characters. Finally, you must use unique values for each property you choose to set.

Character
Decimal
Hex
Other
NUL
\d0
\u0
 
SOH
\d1
\u1
 
STX
\d2
\u2
 
ETX
\d3
\u3
 
EOT
\d4
\u4
 
ENQ
\d5
\u5
 
ACK
\d6
\u6
 
BEL
\d7
\u7
 
BELL
\d7
\u7
 
BS
\d8
\u8
 
HT
\d9
\u9
\t
TAB
\d9
\u9
\t
LF
\d10
\uA
\n
VT
\d11
\uB
 
FF
\d12
\uC
\f
CR
\d13
\uD
\r
SO
\d14
\uE
 
SI
\d15
\uF
 
DLE
\d16
\u10
 
DC1 (XON)
\d17
\u11
 
DC2
\d18
\u12
 
DC3 (XOFF)
\d19
\u13
 
DC4
\d\0
\u14
 
NAK
\d21
\u15
 
SYN
\d22
\u16
 
ETB
\d23
\u17
 
CAN
\d24
\u17
 
EM
\d25
\u19
 
SUB
\d26
\u1a
 
ESC
\d27
\u1b
 
FS
\d28
\u1c
 
GS
\d29
\u1d
 
RS
\d30
\u1e
 
US
\d31
\u1f
 
DEL
\d127
\u7F
 
BPH
\d130
\u82
 
NBH
\d131
\u83
 
IND
\d132
\u84
 
NEL
\d133
\u85
 
SSA
\d134
\u86
 
ESA
\d135
\u87
 
HTS
\d136
\u88
 
HTJ
\d137
\u89
 
VTS
\d138
\u8A
 
PLD
\d139
\u8B
 
PLU
\d140
\u8C
 
RI
\d141
\u8D
 
SS2
\d142
\u8E
 
SS3
\d143
\u8F
 
DCS
\d144
\u90
 
PU1
\d145
\u91
 
PU2
\d146
\u92
 
STS
\d147
\u93
 
CCH
\d148
\u94
 
MW
\d149
\u95
 
SPA
\d150
\u96
 
EPA
\d151
\u97
 
SOS
\d152
\u98
 
SCI
\d154
\u9A
 
CSI
\d155
\u9B
 
ST
\d156
\u9C
 
OSC
\d157
\u9D
 
PM
\d158
\u9E
 
APC
\d159
\u9F
 
NBS (NBSP)
\d160
\uA0
 
SHY
\d173
\uAD
 
Table 25. Special Characters for Separators

Invalid Separator Characters

You cannot use any of the following characters as EDI separators:

  • Spaces
  • Alphabetical characters
  • Numeric characters
 
Free Stylus Studio XML Training: