Reference·MRG Segment·MRG-5
HL7 v2 Reference

What Is HL7 v2 MRG-5? Prior Patient ID, Explained for Testers

Jul 27, 2026 · 4 min read
← MRG-4 MRG-7 →

MRG-5 looks like it should hold the same thing as MRG-1, and in older feeds sometimes it's the only one populated — which is exactly why it can't be safely ignored.

Quick answer

MRG-5 is a legacy identifier field carried in the MRG segment mainly for backward compatibility with older HL7 v2 implementations that predated the repeating identifier structure now used in MRG-1. Newer interfaces are expected to read MRG-1 instead, but some sending systems — particularly ones running interface engines configured years ago — still populate MRG-5 and leave MRG-1 sparse or empty.

What this field contains

ID Number
Typical content — a single retiring patient identifier value, without the richer repeating structure of MRG-1
Legacy usage
Common pattern — older or unmaintained interfaces sometimes populate only MRG-5 and leave MRG-1 blank
Deprecated status
Current guidance — MRG-1 is the field new integrations should read; MRG-5 exists for compatibility, not as the primary source

Example

Synthetic example Generated by Synthibase
MRG|847213609^^^HOSP^MR|||55219847^^^HOSP^AN|ACC-102938

This synthetic example leaves MRG-5 blank, reflecting the modern pattern where MRG-1 alone carries the retiring identifier.

Where this trips people up

Integrations built exclusively against modern feeds sometimes skip MRG-5 entirely, on the assumption that MRG-1 always carries the retiring ID. That assumption fails the first time a merge message arrives from an older interface engine that still only populates MRG-5. The safer pattern is to check MRG-1 first and fall back to MRG-5 when MRG-1 is empty, and test fixtures should include a message that exercises exactly that fallback case.

HL7 v2 MRG Segment Guide: Fields, Format, and Testing Gotchas
HL7 ADT Messages: A01 through A08 Explained
Regression Testing for EHR Upgrades: A Complete Guide
Test both legacy and modern merge patterns
Synthibase can generate merge messages that mimic older interface engines still populating MRG-5, so your fallback logic gets exercised instead of assumed.
Start free trial →
This page is written independently by Synthibase for testing and informational purposes. It is not an official publication of HL7 International or X12/Washington Publishing Company, and is not a substitute for reviewing the official standard or your trading partner's companion guide. See our Terms of Service for full legal terms.