2.1
Message Construction
Special characters are used
when developing a message. They are as follows:
Segment Terminator, Field Separator, Component
Separator, Subcomponent Separator, Repetition
Separator, and Escape Character.
The Segment Terminator is always a carriage
return. The other delimiters are defined in
the Field Separator and the Encoding Field
that are found in the Message Segment Header
(MSH).
The Field Separator is
( | ). This
character is in the Field Separator field
in the MSH segment.
The Field Separator separates two data fields
that are adjacent to each other in the segment.
It also separates the Segment ID from the
first data field segment.
The Component Separator
(^)
is the first character in the Encoding
Character field in the MSH
segment. This character is used to separate
adjacent components of some data fields.
The Repetition Separator
(~)
is the second character in the Encoding Character
field in the MSH
segment. This is used in some data
fields to separate multiple occurrences of
a field, and is only used where specifically
authorized.
The Escape Character
(\) is the third character
in the Encoding Character field in the MSH
segment. This field is optional.
The Subcomponent Separator (&)
is used to separate adjacent subcomponents
of some data fields. This separator is the
fourth character in the Encoding Character
field in the MSH
segment.
Example :
MSH|^~\&|LINKMED|LINKLPZI|RMS||200204150926||ADT^A04|CHPFOPUP|P|2.3|<CR>
Each message is defined
in special notation that lists the segment
IDs in the order they would appear in
the message.
Braces { }
indicate one or more repetitions
of the enclosed group of segments.
Brackets [
] show that the enclosed
group of segments is optional. If a
group of segments is optional and may
repeat it should be enclosed in brackets
first and then braces,
[{
}].
Example:
MSH..EVN..PID..[{NK1}]..[PV1]..[PV2]..[{AL1}]..[{DG1}]..[{PR1}]..[{GT1}]..[{IN1}]..[ACC]..[UB1]..[UB2]