2.24.1 MSH - message header segment

The MSH segment defines the intent, source, destination, and some specifics of the syntax of a message.

Figure 2-8. MSH attributes

1 1 ST R

00001 Field Separator
2 4 ST R

00002 Encoding Characters
3 180 HD O

00003 Sending Application
4 180 HD O

00004 Sending Facility
5 180 HD O

00005 Receiving Application
6 180 HD O

00006 Receiving Facility
7 26 TS O

00007 Date/Time Of Message
8 40 ST O

00008 Security
9 7 CM R

00009 Message Type
10 20 ST R

00010 Message Control ID
11 3 PT R

00011 Processing ID
12 8 ID R
0104 00012 Version ID
13 15 NM O

00013 Sequence Number
14 180 ST O

00014 Continuation Pointer
15 2 ID O
0155 00015 Accept Acknowledgment Type
16 2 ID O
0155 00016 Application Acknowledgment Type
17 2 ID O

00017 Country Code
18 6 ID O Y/3 0211 00692 Character Set
19 60 CE O

00693 Principal Language Of Message MSH field definitions Field separator (ST) 00001

Definition: This field contains the separator between the segment ID and the first real field, MSH-2-encoding characters. As such it serves as the separator and defines the character to be used as a separator for the rest of the message. Recommended value is |, (ASCII 124). Encoding characters (ST) 00002

Definition: This field contains the four characters in the following order: the component separator, repetition separator, escape character, and subcomponent separator. Recommended values are ^~\&, (ASCII 94, 126, 92, and 38, respectively). See Section 2.7, "Message Delimiters." Sending application (HD) 00003

Components: <namespace ID (IS)> ^ <universal ID (ST)> ^ <universal ID type (ID)>

Definition: This field uniquely identifies the sending application among all other applications within the network enterprise. The network enterprise consists of all those applications that participate in the exchange of HL7 messages within the enterprise. Entirely site-defined. Sending facility (HD) 00004

Components: <namespace ID (IS)> ^ <universal ID (ST)> ^ <universal ID type (ID)>

Definition: This field contains the address of one of several occurrences of the same application within the sending system. Absent other considerations, the Medicare Provider ID might be used with an appropriate sub-identifier in the second component. Entirely user-defined. Receiving application (HD) 00005

Components: <namespace ID (IS)> ^ <universal ID (ST)> ^ <universal ID type (ID)>

Definition: This field uniquely identifies the receiving application among all other applications within the network enterprise. The network enterprise consists of all those applications that participate in the exchange of HL7 messages within the enterprise. Entirely site-defined. Receiving facility (HD) 00006

Components: <namespace ID (IS)> ^ <universal ID (ST)> ^ <universal ID type (ID)>

Definition: This field identifies the receiving application among multiple identical instances of the application running on behalf of different organizations. See comments: MSH-4-sending facility. Entirely site-defined. Date/time of message (TS) 00007

Definition: This field contains the date/time that the sending system created the message. If the time zone is specified, it will be used throughout the message as the default time zone. Security (ST) 00008

Definition: In some applications of HL7, this field is used to implement security features. Its use is not yet further specified. Message type (CM) 00009

Components: <message type (ID)> ^ <trigger event (ID)>

Definition: This field contains the message type and trigger event for the message. The first component is the message type edited by HL7 table 0076 - Message type; second is the trigger event code edited by HL7 table 0003 - Event type.

The receiving system uses this field to know the data segments to recognize, and possibly, the application to which to route this message. For certain queries, which may have more than a single response event type, the second component may, in the response message, vary to indicate the response event type. See the discussion of the display query variants in Section, "Original mode display query variants." The second component is not required on response or acknowledgment messages.

Table 0076 - Message type

Value Description Chapter
ACK General acknowledgment message 2
ADR ADT response 3
ADT ADT message 3
ARD Ancillary RPT (display) 7
BAR Add/change billing account 6
CSU Unsolicited clinical study data 7
DFT Detail financial transaction 6
DSR Display response 2
EDR Enhanced display response 2
ERP Event replay response 2
ERQ Event replay query 2
EQQ Embedded query language query 2
MCF Delayed acknowledgment 2
MDM Documentation message 9
MFN Master files notification 8
MFK Master files application acknowledgement 8
MFD Master files delayed application acknowledgement 8
MFQ Master files query 8
MFR Master files query response 8
ORF Observ. result/record response 7
ORM Order message 4
ORR Order acknowledgement message 4
ORU Observ result/unsolicited 7
OSQ Order status query 4
OSR Order status response 4
QRY Query, original Mode 2
PEX Product experience 7
PGL Patient goal 12
PGR Patient goal response 12
PGQ Patient goal query 12
PIN Patient Insurance Information 12
PPG Patient pathway (goal-oriented) 12
PPP Patient pathway (problem-oriented) 12
PPR Patient problem 12
PPT Patient pathway (goal oriented) 12
PPV Patient goal response 12
PRQ Patient care problem query 12
PRR Patient problem response 12
PTQ Patient pathway (problem-oriented) query 12
PTR Patient pathway (problem-oriented) response 12
PTU Patient pathway (goal-oriented) query 12
PTV Patient pathway (goal-oriented) response 12
PIN Patient information 11
RAR Pharmacy administration information 4
RAS Pharmacy administration message 4
RCI Return clinical information 11
RCL Return clinical list 11
RDE Pharmacy encoded order message 4
RDR Pharmacy dispense information 4
RDS Pharmacy dispense message 4
RGV Pharmacy give message 4
RGR Pharmacy dose information 4
REF Patient referral 11
RER Pharmacy encoded order information 4
ROD Request patient demographics 11
ROR Pharmacy prescription order response 4
RPA Return patient authorization 11
RPI Return patient information 11
RPL Return patient display list 11
RPR Return patient list 11
RQA Request patient authorization 11
RQC Request clinical information 11
RQI Request patient information 11
RQP Request patient demographics 11
RRA Pharmacy administration acknowledgment 4
RRD Pharmacy dispense acknowledgment 4
RRE Pharmacy encoded order acknowledgment 4
RRG Pharmacy give acknowledgment 4
RRI Return patient referral 11
SIU Schedule information unsolicited 10
SPQ Stored procedure request 2
SQM Schedule query 10
SQR Schedule query response 10
CRM Clinical study registration 7
SRM Schedule request 10
SRR Scheduled request response 10
SUR Summary product experience report 7
TBR Tabular data response 2
UDM Unsolicited display message 2
VQQ Virtual table query 2
VXQ Query for vaccination record 4
VXX Vaccination query response with multiple PID matches 4
VXR Vaccination query record response 4
VXU Unsolicited vaccination record update 4

Table 0003 - Event type

Value Description
A01 ADT/ACK - Admit / visit notification
A02 ADT/ACK - Transfer a patient
A03 ADT/ACK - Discharge/end visit
A04 ADT/ACK - Register a patient
A05 ADT/ACK - Pre-admit a patient
A06 ADT/ACK - Change an outpatient to an inpatient
A07 ADT/ACK - Change an inpatient to an outpatient
A08 ADT/ACK - Update patient information
A09 ADT/ACK - Patient departing - tracking
A10 ADT/ACK - Patient arriving - tracking
A11 ADT/ACK - Cancel admit/visit notification
A12 ADT/ACK - Cancel transfer
A13 ADT/ACK - Cancel discharge/end visit
A14 ADT/ACK - Pending admit
A15 ADT/ACK - Pending transfer
A16 ADT/ACK - Pending discharge
A17 ADT/ACK - Swap patients
A18 ADT/ACK - Merge patient information
A19 QRY/ADR - Patient query
A20 ADT/ACK - Bed status update
A21 ADT/ACK - Patient goes on a "leave of absence"
A22 ADT/ACK - Patient returns from a "leave of absence"
A23 ADT/ACK - Delete a patient record
A24 ADT/ACK - Link patient information
A25 ADT/ACK - Cancel pending discharge
A26 ADT/ACK - Cancel pending transfer
A27 ADT/ACK - Cancel pending admit
A28 ADT/ACK - Add person information
A29 ADT/ACK - Delete person information
A30 ADT/ACK - Merge person information
A31 ADT/ACK - Update person information
A32 ADT/ACK - Cancel patient arriving - tracking
A33 ADT/ACK - Cancel patient departing - tracking
A34 ADT/ACK - Merge patient information - patient ID only
A35 ADT/ACK - Merge patient information - account number only
A36 ADT/ACK - Merge patient information - patient ID and account number
A37 ADT/ACK - Unlink patient information
A38 ADT/ACK - Cancel pre-admit
A39 ADT/ACK - Merge person - external ID
A40 ADT/ACK - Merge patient - internal ID
A41 ADT/ACK - Merge account - patient account number
A42 ADT/ACK - Merge visit - visit number
A43 ADT/ACK - Move patient information - internal ID
A44 ADT/ACK - Move account information - patient account number
A45 ADT/ACK - Move visit information - visit number
A46 ADT/ACK - Change external ID
A47 ADT/ACK - Change internal ID
A48 ADT/ACK - Change alternate patient ID
A49 ADT/ACK - Change patient account number
A50 ADT/ACK - Change visit number
A51 ADT/ACK - Change alternate visit ID
C01 CRM - Register a patient on a clinical trial
C02 CRM - Cancel a patient registration on clinical trial (for clerical mistakes only)
C03 CRM - Correct/update registration information
C04 CRM - Patient has gone off a clinical trial
C05 CRM - Patient enters phase of clinical trial
C06 CRM - Cancel patient entering a phase (clerical mistake)
C07 CRM - Correct/update phase information
C08 CRM - Patient has gone off phase of clinical trial
C09 CSU - Automated time intervals for reporting, like monthly
C10 CSU - Patient completes the clinical trial
C11 CSU - Patient completes a phase of the clinical trial
C12 CSU - Update/correction of patient order/result information
CNQ QRY/EQQ/SPQ/VQQ/RQQ - Cancel query
G01 PGL/ACK - Patient goal
I01 RQI/RPI - Request for insurance information
I02 RQI/RPL - Request/receipt of patient selection display list
I03 RQI/RPR - Request/receipt of patient selection list
I04 RQD/RPI - Request for patient demographic data
I05 RQC/RCI - Request for patient clinical information
I06 RQC/RCL - Request/receipt of clinical data listing
I07 PIN/ACK - Unsolicited insurance information
I08 RQA/RPA - Request for treatment authorization information
I09 RQA/RPA - Request for modification to an authorization
I10 RQA/RPA - Request for resubmission of an authorization
I11 RQA/RPA - Request for cancellation of an authorization
I12 REF/RRI - Patient referral
I13 REF/RRI - Modify patient referral
I14 REF/RRI - Cancel patient referral
I15 REF/RRI - Request patient referral status
M01 MFN/MFK - Master file not otherwise specified (for backward compatibility only)
M02 MFN/MFK - Master file - Staff Practioner
M03 MFN/MFK - Master file - Test/Observation (for backward compatibility only)
varies MFQ/MFR - Master files query (use event same as asking for e.g., M05 - location)
M04 MFN/MFK - Master files charge description
M05 MFN/MFK - Patient location master file
M06 MFN/MFK - Clinical study with phases and schedules master file
M07 MFN/MFK - Clinical study without phases but with schedules master file
M08 MFN/MFK - Test/observation (Numeric) master file
M09 MFN/MFK - Test/Observation (Categorical) master file
M10 MFN/MFK - Test /observation batteries master file
M11 MFN/MFK - Test/calculated observations master file
O01 ORM - Order message (also RDE, RDS, RGV, RAS)
O02 ORR - Order response (also RRE, RRD, RRG, RRA)
P01 BAR/ACK - Add patient accounts
P02 BAR/ACK - Purge patient accounts
P03 DFT/ACK - Post detail financial transaction
P04 QRY/DSP - Generate bill and A/R statements
P05 BAR/ACK - Update account
P06 BAR/ACK - End account
P07 PEX - Unsolicited initial individual product experience report
P08 PEX - Unsolicited update individual product experience report
P09 SUR - Summary product experience report
PC1 PPR - PC/ Problem Add
PC2 PPR - PC/ Problem Update
PC3 PPR - PC/ Problem Delete
PC4 PRQ - PC/ Problem Query
PC5 PRR - PC/ Problem Response
PC6 PGL - PC/ Goal Add
PC7 PGL - PC/ Goal Update
PC8 PGL - PC/ Goal Delete
PC9 PGQ - PC/ Goal Query
PCA PGR - PC/ Goal Response
PCB PPP - PC/ Pathway (Problem-Oriented) Add
PCC PPP - PC/ Pathway (Problem-Oriented) Update
PCD PPP - PC/ Pathway (Problem-Oriented) Delete
PCE PTQ - PC/ Pathway (Problem-Oriented) Query
PCF PTR - PC/ Pathway (Problem-Oriented) Query Response
PCG PPG - PC/ Pathway (Goal-Oriented) Add
PCH PPG - PC/ Pathway (Goal-Oriented) Update
PCJ PPG - PC/ Pathway (Goal-Oriented) Delete
PCK PTU - PC/ Pathway (Goal-Oriented) Query
PCL PTV - PC/ Pathway (Goal-Oriented) Query Response
Q01 QRY/DSR - Query sent for immediate response
Q02 QRY/QCK - Query sent for deferred response
Q03 DSR/ACK - Deferred response to a query
Q05 UDM/ACK - Unsolicited display update message
Q06 OSQ/OSR - Query for order status
R01 ORU/ACK - Unsolicited transmission of an observation message
R02 QRY - Query for results of observation
R03 QRY/DSR Display-oriented results, query/unsol. update (for backward compatibility only)
R04 ORF - Response to query; transmission of requested observation
R05 QRY/DSR-query for display results
R06 UDM-unsolicited update/display results
RAR RAR - Pharmacy administration information query response
RDR RDR - Pharmacy dispense information query response
RER RER - Pharmacy encoded order information query response
RGR RGR - Pharmacy dose information query response
ROR ROR - Pharmacy prescription order query response
S01 SRM/SRR - Request new appointment booking
S02 SRM/SRR - Request appointment rescheduling
S03 SRM/SRR - Request appointment modification
S04 SRM/SRR - Request appointment cancellation
S05 SRM/SRR - Request appointment discontinuation
S06 SRM/SRR - Request appointment deletion
S07 SRM/SRR - Request addition of service/resource on appointment
S08 SRM/SRR - Request modification of service/resource on appointment
S09 SRM/SRR - Request cancellation of service/resource on appointment
S10 SRM/SRR - Request discontinuation of service/resource on appointment
S11 SRM/SRR - Request deletion of service/resource on appointment
S12 SIU/ACK - Notification of new appointment booking
S13 SIU/ACK - Notification of appointment rescheduling
S14 SIU/ACK - Notification of appointment modification
S15 SIU/ACK - Notification of appointment cancellation
S16 SIU/ACK - Notification of appointment discontinuation
S17 SIU/ACK - Notification of appointment deletion
S18 SIU/ACK - Notification of addition of service/resource on appointment
S19 SIU/ACK - Notification of modification of service/resource on appointment
S20 SIU/ACK - Notification of cancellation of service/resource on appointment
S21 SIU/ACK - Notification of discontinuation of service/resource on appointment
S22 SIU/ACK - Notification of deletion of service/resource on appointment
S23 SIU/ACK - Notification of blocked schedule time slot(s)
S24 SIU/ACK - Notification of opened ("unblocked") schedule time slot(s)
S25 SQM/SQR - Schedule query message and response
S26 Notification that patient did not show up for schedule appointment
T01 MDM/ACK - Original document notification
T02 MDM/ACK - Original document notification and content
T03 MDM/ACK - Document status change notification
T04 MDM/ACK - Document status change notification and content
T05 MDM/ACK - Document addendum notification
T06 MDM/ACK - Document addendum notification and content
T07 MDM/ACK - Document edit notification
T08 MDM/ACK - Document edit notification and content
T09 MDM/ACK - Document replacement notification
T10 MDM/ACK - Document replacement notification and content
T11 MDM/ACK - Document cancel notification
T12 QRY/DOC - Document query
V01 VXQ - Query for vaccination record
V02 VXX - Response to vaccination query returning multiple PID matches
V03 VXR - Vaccination record response
V04 VXU - Unsolicited vaccination record update
W01 ORU - Waveform result, unsolicited transmission of requested information
W02 QRF - Waveform result, response to query
X01 PEX - Product experience Message control ID (ST) 00010

Definition: This field contains a number or other identifier that uniquely identifies the message. The receiving system echoes this ID back to the sending system in the Message acknowledgment segment (MSA). Processing ID (PT) 00011

Components: <processing ID (ID)> ^<processing mode (ID)>

Definition: This field is used to decide whether to process the message as defined in HL7 Application (level 7) Processing rules, above. The first component defines whether the message is part of a production, training, or debugging system (refer to HL7 table 0103 - Processing ID for valid values). The second component defines whether the message is part of an archival process or an initial load (refer to HL7 table 0207 - Processing mode for valid values). This allows different priorities to be given to different processing modes.

Table 0103 - Processing ID

Value Description
D Debugging
P Production
T Training

Table 0207 - Processing mode

Value Description
A Archive
R Restore from archive
I Initial load
not present Not present (the default, meaning current processing) Version ID (ID) 00012

Definition: This field is matched by the receiving system to its own version to be sure the message will be interpreted correctly.

Table 0104 - Version ID

Value Description
2.0 Release 2.0 September 1988
2.0D Demo 2.0 October 1988
2.1 Release 2. 1 March 1990
2.2 Release 2.2 December 1994
2.3 Release 2.3 Ballot #1 February 1996, Ballot #2 July 1996, Final Ballot Sequence number (NM) 00013

Definition: A non-null value in this field implies that the sequence number protocol is in use. This numeric field incremented by one for each subsequent value. Continuation pointer (ST) 00014

Definition: This field is used to define continuations in application-specific ways. Accept acknowledgment type (ID) 00015

Definition: This field identifies the conditions under which accept acknowledgements are required to be returned in response to this message. Required for enhanced acknowledgment mode. Refer to HL7 table 0155 - Accept/application acknowledgment conditions for valid values. Application acknowledgment type (ID) 00016

Definition: This field contains the conditions under which application acknowledgements are required to be returned in response to this message. Required for enhanced acknowledgment mode.

The following table contains the possible values for MSH-15-accept acknowledgment type and MSH-16-application acknowledgment type:

Table 0155 - Accept/application acknowledgment conditions

Value Description
AL Always
NE Never
ER Error/reject conditions only
SU Successful completion only
Note: If MSH-15-accept acknowledgment type and MSH-16-applictation acknowledgment type are omitted (or are both null), the original acknowledgment mode rules are used. Country code (ID) 00017

Definition: This field contains the country of origin for the message. It will be used primarily to specify default elements, such as currency denominations. ISO 3166 provides a list of country codes that may be used [ Available from ISO 1 Rue de Varembe, Case Postale 56, CH 1211, Geneve, Switzerland] . Character set (ID) 00692

Definition: This field contains the character set for the entire message. Refer to HL7 table 0211 - Alternate character sets for valid values.

Table 0211 - Alternate character sets

Value Description
ASCII The printable 7-bit ASCII character set . (This is the default if this field is omitted)
8859/1 The printable characters from the ISO 8859/1 Character set
8859/2 The printable characters from the ISO 8859/2 Character set
8859/3 The printable characters from the ISO 8859/3 Character set
8859/4 The printable characters from the ISO 8859/4 Character set
8859/5 The printable characters from the ISO 8859/5 Character set
8859/6 The printable characters from the ISO 8859/6 Character set
8859/7 The printable characters from the ISO 8859/7 Character set
8859/8 The printable characters from the ISO 8859/8 Character set
8859/9 The printable characters from the ISO 8859/9 Character set
JAS2020 A subset of ISO2020 used for most Kanjii transmissions
JIS X 0202 ISO 2022 with escape sequences for Kanjii
JIS X 0201-1976 Code for Information Exchange
JIS X 0208-1990 Code for the Japanese Graphic Character set for information interchange
JIS X 0212-1990 Code of the supplementary Japanese Graphic Character set for information interchange
Note: The field separator character must still be chosen from the printable 7-bit ASCII character set.

The repetitions of this field to specify different character sets apply only to fields of the PN and XPN data types.

The field MSH-18-character set is an optional, repeating field of data type ID, using IDs outlined in HL7 table 0211 - Alternate character sets (or equivalents from ISO 2375).

• if the field is not valued, the default single-byte character set (ASCII (ISO IR-6)) should be assumed. No other character sets are allowed in the message.

• if the field repeats, but the first element is NULL (i.e., present but unvalued), the single-byte ASCII (ISO IR-6) is assumed as the default character set.

• if the sequence is present and the first element is specified, this character set is regarded as the default character set for the message. This must be a single-byte character set (i.e., ISO-IR 6, ISO-IR 13, ISO-IR 14, ISO-IR 100, etc.)

• elements in the remainder of the sequence (i.e., elements 2..n) are alternate character sets that may be used. These may include multi-byte character sets (i.e., JIS X 0208)

• the default character set should always be a single-byte character set. It should always have ISO-IR 6 (ISO 646) or ISO-IR 14 (JIS X 0201-1976) in the G0 area. Principal language of message (CE) 00693

Components: <identifier (ID)> ^ <text (ST)> ^ <name of coding system (ST)> ^ <alternate identifier (ID)> ^ <alternate text (ST)> ^ <name of alternate coding system (ST)>

Definition: This field contains the principal language of the message. Codes come from ISO 639.