A Z-segment is a message segment that is defined locally and that is not part of the HL7 standard. Z-segments are part of the reason why the HL7 standard is considered a “flexible” standard. You may find that you need to create new fields to support the requirements of your Z-segment.
Z-segments can be inserted anywhere in the message. A popular approach is to place the Z-segment within a group of segments that contain similar information, such as insurance. Z-segments are also often placed at the end of the message. The advantage of doing so is that this placement prevents systems configured to parse “standard” HL7 format from requiring any configuration modifications in order to process the message. The application simply reads the segments in the order expected, and then extracts the data from the Z-segment (if needed) via parser modifications.
Sometimes systems may send unexpected Z-segments, whether or not they were part of the original specifications. Even if you are not interested in the data in the Z-segment, you may still (depending on its location) need to take the segment into account while testing and developing your interface. More information about how to support unexpected message elements can be found in our HL7 conformance checking white paper.