NEWFree ROI Calculators — quantify what prior auth and siloed data are costing your organization.Prior Auth ROI Siloed Data ROI
HL7 v2Segment8 min read

HL7 RXD Segment: Pharmacy / Treatment Dispense

The RXD (Pharmacy/Treatment Dispense) segment records a single dispensing event for a medication or treatment. It captures what was actually dispensed — the product, the actual amount and units, the dispense date/time, lot and expiration details, and the dispensing provider — and is the central detail segment of the RDS (Pharmacy/Treatment Dispense) message. Where RXE describes the encoded order, RXD describes the fulfillment of that order.

Purpose

The RXD segment exists to report the concrete act of dispensing a medication. After an order has been encoded (RXE), the pharmacy fills it and reports back the realities of that fill: the exact product dispensed, the actual quantity and units, the remaining refills, and traceability data such as lot number and expiration date. This makes RXD the authoritative record of dispensing in the medication lifecycle and the basis for inventory, billing, and medication-reconciliation downstream.

Used in

The RXD segment appears in RDS messages (Pharmacy/Treatment Dispense), where it conveys the details of each dispense within an order group. It is normally preceded by an ORC order-control segment and accompanied by one or more RXR (route) segments, and it references the encoded order described by the related RXE segment.

Field-by-field reference

Source: HAPI HL7v2 v2.5.1 javadocs (RXD javadoc) for sequence, name, data type, and repetition. Length is not published in the javadocs (); Required and Table # are filled from the HL7 v2.5.1 standard where well-established.

SeqNameData TypeLengthReqRepeatTable #Description
RXD-1Dispense Sub-ID CounternmRSequential counter for each dispense event
RXD-2Dispense/Give CodeceRCoded identifier of the dispensed product
RXD-3Date/Time DispensedtsRWhen the dispense occurred
RXD-4Actual Dispense AmountnmRQuantity actually dispensed
RXD-5Actual Dispense UnitsceOUnits for the actual dispense amount
RXD-6Actual Dosage FormceODosage form actually dispensed
RXD-7Prescription NumberstOPharmacy-assigned prescription number
RXD-8Number of Refills RemainingnmORefills still available after this dispense
RXD-9Dispense NotesstOYFree-text notes about the dispense
RXD-10Dispensing ProviderxcnOYProvider who performed the dispense
RXD-11Substitution StatusidOHL70167Whether a substitution occurred
RXD-12Total Daily DosecqOTotal amount to be given per day
RXD-13Dispense-to Locationla2OLocation to which the drug is dispensed
RXD-14Needs Human ReviewidOHL70136Flag indicating manual review is required
RXD-15Pharmacy/Treatment Supplier's Special Dispensing InstructionsceOYSpecial dispensing instructions
RXD-16Actual StrengthnmOStrength of the product dispensed
RXD-17Actual Strength UnitceOUnits for the actual strength
RXD-18Substance Lot NumberstOYLot number of the dispensed substance
RXD-19Substance Expiration DatetsOYExpiration date of the dispensed substance
RXD-20Substance Manufacturer NameceOYHL70227Manufacturer of the dispensed substance
RXD-21IndicationceOYReason or indication for the dispense
RXD-22Dispense Package SizenmOSize of the dispense package
RXD-23Dispense Package Size UnitceOUnits for the dispense package size
RXD-24Dispense Package MethodidOHL70321Method of dispense packaging
RXD-25Supplementary CodeceOYAdditional codes such as billing modifiers
RXD-26Initiating LocationceOLocation that initiated the dispense
RXD-27Packaging/Assembly LocationceOLocation where packaging was assembled
RXD-28Actual Drug Strength VolumenmOVolume associated with the drug strength
RXD-29Actual Drug Strength Volume UnitscweOUnits for the drug strength volume
RXD-30Dispense to PharmacycweOPharmacy receiving the dispense
RXD-31Dispense to Pharmacy AddressxadOAddress of the receiving pharmacy
RXD-32Pharmacy Order TypeidOHL70480Type of pharmacy order (inpatient/outpatient)
RXD-33Dispense TypecweOHL70484Type of dispense (trial, refill, etc.)

Most-used fields

The fields most integrations rely on are RXD-1 (Dispense Sub-ID Counter), which orders multiple dispenses within an order, RXD-2 (Dispense/Give Code), which identifies the dispensed product, and RXD-3 (Date/Time Dispensed), which timestamps the event. RXD-4 and RXD-5 (Actual Dispense Amount and Units) record exactly what was given out, while RXD-7 (Prescription Number) and RXD-8 (Number of Refills Remaining) tie the dispense back to the prescription lifecycle. Pharmacies that track traceability also depend heavily on RXD-18 (Substance Lot Number) and RXD-19 (Substance Expiration Date).

Version differences (2.3 to 2.8.2)

In v2.3 the RXD segment ended near field 21, covering the actual dispense amounts, lot, expiration, and indication. v2.4 stabilized the dispense-package fields (22–25). v2.5 and v2.5.1 added fields 26 through 33, including Initiating Location, Packaging/Assembly Location, Actual Drug Strength Volume, the dispense-to-pharmacy block (30–31), Pharmacy Order Type (RXD-32), and Dispense Type (RXD-33). Releases from v2.6 through v2.8.2 refined data types (notably moving newer coded fields to CWE) and clarified table bindings, while the v2.5.1 field sequence documented here remained stable.

Common mistakes

A common pitfall is omitting RXD-1 (Dispense Sub-ID Counter) or repeating the same value across multiple dispenses, which breaks correlation of distinct fill events. Another is confusing RXD-4 (Actual Dispense Amount, what was truly dispensed) with the ordered amount in the related RXE — they can legitimately differ. Integrators sometimes drop units (RXD-5), leaving the quantity ambiguous. The repeating fields (RXD-9, RXD-10, RXD-15, RXD-18, RXD-19, RXD-20, RXD-21, RXD-25) must be expressed with the repetition separator (~). Finally, lot and expiration data (RXD-18, RXD-19) should be paired consistently so traceability records remain coherent.

Examples

A minimal valid RXD segment:

RXD|1|00093-0058-01^Amoxicillin 500 MG Capsule^NDC|20260612101500|30

A fully-populated RXD segment:

RXD|1|00093-0058-01^Amoxicillin 500 MG Capsule^NDC|20260612101500|30|CAP|CAP^Capsule^HL70488|RX0000457821|2|Counseled patient~No allergies noted|PH9981^Stone^Rita^^^^RPh|G|500^mg/day|WARD3^^^^^^^^Pharmacy|N|Refrigerate after opening|500|mg|LOT44821~LOT44822|20271231~20280131|00093^Teva^MFR|J01CA04^Bacterial infection^ICD10|100|CAP|F|MOD3^Modifier|MAIN-PHARM^Main Pharmacy|PKG-LINE2^Packaging Line 2|5|mL|SAT-PHARM^Satellite Pharmacy|789 Clinic Rd^^Springfield^IL^62704|O|R^Refill^HL70484

Annotated breakdown:

RXD|1|00093-0058-01^Amoxicillin 500 MG Capsule^NDC|20260612101500|30|CAP|...
   | |                                            |              |  |
   | |                                            |              |  +--> RXD-5 Actual Dispense Units (CAP)
   | |                                            |              +-----> RXD-4 Actual Dispense Amount (30)
   | |                                            +--------------------> RXD-3 Date/Time Dispensed (20260612101500)
   | +-----------------------------------------------------------------> RXD-2 Dispense/Give Code (NDC for Amoxicillin)
   +-------------------------------------------------------------------> RXD-1 Dispense Sub-ID Counter (1)

In context inside an RDS message (dispense report):

MSH|^~&|PHARMSYS|GENHOSP|EHR|GENHOSP|20260612101500||RDS^O13^RDS_O13|MSG00073201|P|2.5.1
PID|1||MRN556677^^^GENHOSP^MR||Calloway^Dana^E||19840722|F
ORC|RE|ORD778899^EHR|RX0000457821^PHARMSYS|||||20260612101500|||AA1234567^Welby^Marcus^^^^Dr
RXD|1|00093-0058-01^Amoxicillin 500 MG Capsule^NDC|20260612101500|30|CAP|CAP^Capsule^HL70488|RX0000457821|2||PH9981^Stone^Rita^^^^RPh|G
RXR|PO^By mouth^HL70162

A second in-context excerpt (IV solution dispense with lot tracking):

MSH|^~&|PHARMSYS|GENHOSP|EHR|GENHOSP|20260612110000||RDS^O13^RDS_O13|MSG00073202|P|2.5.1
PID|1||MRN112233^^^GENHOSP^MR||Okafor^Jane^L||19771103|F
ORC|RE|ORD778900^EHR|RX0000457822^PHARMSYS|||||20260612110000|||BB7654321^Patel^Anya^^^^Dr
RXD|1|0338-0049-04^Sodium Chloride 0.9% IV^NDC|20260612110000|1000|mL|SOL^Solution^HL70488|RX0000457822|0||PH9981^Stone^Rita^^^^RPh|N|||N||||LOT77310|20270630|0338^Baxter^MFR
RXR|IV^Intravenous^HL70162

FHIR mapping

No segment-level ConceptMap is published in the v2-to-FHIR IG for RXD. Conceptually, an RXD segment corresponds to a FHIR MedicationDispense resource: the Dispense/Give Code maps to medication, the actual dispense amount and units to quantity, the dispense date/time to whenHandedOver or whenPrepared, the prescription number to authorizingPrescription, and lot/expiration data to batch. Because no published ConceptMap exists, integrators must define field-level mappings themselves.

Engine considerations

RXD is a long segment with numerous CE and CWE composites, so engines must correctly parse component (^) and subcomponent (&) delimiters when reading coded fields. The repeating fields (RXD-9, RXD-10, RXD-15, RXD-18, RXD-19, RXD-20, RXD-21, RXD-25) require iterating across repetition (~) instances; in particular, lot numbers and expiration dates may carry parallel repetitions that must stay aligned. Engines should preserve empty trailing fields when re-emitting RXD and validate that units accompany every populated amount and strength.

How Vorro parses and produces RXD

Vorro parses RXD positionally into typed fields, decomposing CE/CWE/XCN composites so codes, descriptions, and coding systems are individually accessible, and exposing repeating fields as ordered collections that preserve parallel alignment between lot numbers and expiration dates. When producing RXD, Vorro emits only mapped fields while keeping correct positions with placeholder delimiters, ensures RXD-1 is unique per dispense event, normalizes coded values against configured terminologies (NDC, RxNorm, manufacturer tables), and verifies that amount and strength fields are paired with their unit fields before serialization.

Sources

← Back to HL7 v2 Guide

Ready to Integrate This Into Your Workflow?

Talk to a Vorro expert about implementing HL7 v2 in your specific environment.

Browse HL7 v2 Guides