---
title: "Adding z-segments to HL7 Mapping Components"
date: "2009-07-20"
tags: 
  - "altova"
  - "data-mapping"
  - "hl7"
  - "mapforce"
description: This article provides a detailed guide on adding z-segments to HL7 mapping components using MapForce, focusing on the ZLR segment for enhanced EDI functionality.
---
Status: #blog

Tags:  #altova #data-mapping #hl7 #mapforce

Categories: [Altova](/blog/category/altova.md) 
# Adding z-segments to HL7 Mapping Components

When [mapping HL7](https://www.altova.com/HL7/default.aspx) EDI components, it is often necessary to add locally-defined information, or z-segments, to accommodate additional fields not included in the standard. Following is a simple walkthrough that will demonstrate how to add z-segments to the [HL7 configuration files](https://www.altova.com/components_mapforce.html) that are available as a free download with MapForce. In the example below we will be adding a ZLR segment to an HL7 2.3 Observation Results Unsolicited (ORU) message. The ZLR segment is commonly used for adding additional information for legacy laboratory-based reporting. ZLR attributes are provided below:

| SEQ | LENGTH | OPT | DATA TYPE | ELEMENT NAME |
|---|---|---|---|---|
| 1 | 106 | true | XAD | Ordering Provider's Address |
| 2 | 90 | true | XON | Ordering Facility Name |
| 3 | 106 | true | XAD | Ordering Facility Address |
| 4 | 40 | true | XTN | Ordering Facility Phone |
| 5 | 20 | true | SN | Patient's Age |
| 6 | 40 | true | XPN | Next of Kin/Associated Party Name |
| 7 | 40 | true | CE | Next of Kin/Associated Party Relationship |
| 8 | 106 | true | XAD | Next of Kin/Associated Party Address |
| 9 | 40 | true | XTN | Next of Kin/Associated Party Phone |

The ZLR segment must follow each OBR (Observation Request) segment, and there can only be one ZLR per OBR. 
1. Go to C:Program FilesAltovaMapForce2009MapForceEDIHL7.v230 to access the MapForce configuration files for HL7 version 2.3. 
2. First, locate the message configuration file in question, ORU\_R01, and open it in XMLSpy - or any text editor.
3. Save this file as ORU\_R01\_ZLR (or any unique name you choose). 
4. Now open the EDI collection file and add the new message to the list.
5. Next, simply open the HL7 SEGMENT file to add the segment details to the GENERATE DATA section as provided above.
6. Finally, scroll down to the GENERATE SEGMENTS section and add the following: 

[![hl7 mapping](https://www.altova.com/blog/images/AddingzsegmentstoHL7MappingComponents_9C7B/hl74_thumb.gif "hl7 mapping")](https://www.altova.com/blog/images/AddingzsegmentstoHL7MappingComponents_9C7B/hl74.gif) 

7. Now, let's access our newly customized HL7 EDI mapping component in MapForce. Open MapForce and choose **Insert > EDI**. In the **Browse EDI collections** dialog, select **HL7.v230** and scroll down to select **ORU\_R01\_ZLR**. 

[![hl7 mapping](https://www.altova.com/blog/images/AddingzsegmentstoHL7MappingComponents_9C7B/hl75_thumb.gif "hl7 mapping")](https://www.altova.com/blog/images/AddingzsegmentstoHL7MappingComponents_9C7B/hl75.gif) 

8. Your new mapping component will appear in the MapForce design pane with the new ZLR segment included. 

Now you can complete your data integration design by inserting another source or target data structure(s) and dragging lines to connect nodes. MapForce supports mapping to/from XML, databases, flat files, EDI, XBRL, and Web services. 

**For more information about** [**mapping HL7 and other EDI formats**](https://www.altova.com/products/mapforce/edi-mapping.html)**, please see the MapForce feature pages - or** [**download a 30-day free trial**](https://www.altova.com/download-mapforce3.html) **of MapForce today!**
