Search code examples
edix12

Is there an EDI Segment that can contain more than 256 characters?


Is there an EDI x12 segment that has no character limit? We often use the MSG segment for open text fields but this is capped at 256 characters, so we’re looking for an alternative that can handle 500+ characters.


Solution

  • The short answer

    The MTX Text segment allows you to send messages of up to 4096 characters long, which is the longest available in X12. You can’t just swap out an MSG segment for an MTX segment, though. You can only use MTX if it’s included in the transaction set, and that depends on which X12 'release' (version) you're using.

    For the 005010 release (one of the more popular ones), here are the transaction sets that MTX appears in:

    • 105 Business Entity Filings
    • 113 Election Campaign and Lobbyist Reporting
    • 150 Tax Rate Notification
    • 155 Business Credit Report
    • 179 Environmental Compliance Reporting
    • 194 Grant or Assistance Application
    • 251 Pricing Support
    • 274 Healthcare Provider Information
    • 284 Commercial Vehicle Safety Reports
    • 500 Medical Event Reporting
    • 620 Excavation Communication
    • 625 Well Information
    • 650 Maintenance Service Order
    • 805 Contract Pricing Proposal
    • 806 Project Schedule Reporting
    • 814 General Request, Response or Confirmation
    • 832 Price/Sales Catalog
    • 836 Procurement Notices
    • 840 Request for Quotation
    • 843 Response to Request for Quotation
    • 850 Purchase Order
    • 855 Purchase Order Acknowledgment
    • 860 Purchase Order Change Request - Buyer Initiated
    • 865 Purchase Order Change Acknowledgment/Request - Seller Initiated

    Some additional clarification

    • Technically, character limits don't apply to X12 segments – what you're referring to is an X12 element. A segment is just a container for elements, and the element you're referring to is the element referenced in MSG01 (the first element of the MSG segment).
    • Each X12 element references an ID number. For each element, the ID number points to a dictionary that specifies the name, description, type, minimum length, and maximum length. In the case of MSG01, it points to data element [933][1].
    • Data element 933 – the one you're currently using – actually has a character limit of 264 characters (more than 256 characters, but not by much). Note: the link above is to the 005010 X12 release, but I checked backed to 003010 and up to 008030 and it seems to be 264 characters all the way through.

    Now, back to your original question: is there a data element that allows for a larger character payload?

    The answer is that there are 8 data elements that accept a payload larger than 264 characters.

    Two of them are binary data types, which we can likely eliminate off the bat:

    • 785. Binary Data. A string of octets which can assume any binary pattern from hexadecimal 00 to FF. Note: The maximum length is dependent upon the maximum data value that can be entered in DE 784, which value is 999,999,999,999,999. Max characters: 999999999999999.
    • 1700. Transformed Data. Binary or filtered data having one or more security policy options applied; transformed data may represent compressed, encrypted, or compressed and encrypted plaintext. Max characters: 10000000000000000.

    The rest are strings, which is promising:

    • 364. Communication Number. Complete communications number including country or area code when applicable. Max characters: 2048.
    • 1565. Look-up Value. Value used to identify a certificate containing a public key. Max characters: 4096.
    • 1566. Keying Material. Additional material required for decrypting the one-time key. Max characters: 512.
    • 1567. One-time Encryption Key. Hexadecimally filtered encrypted one-time key. Max characters: 512.
    • 1573. Encoded Security Value. Encoded representation of the Security Value specified by the Security Value Qualifier. Max characters: 1.00E+16.

    And, last but not least:

    • 1551. Textual Data. To transmit large volumes of message text. Max characters: 4096.

    Looks like a winner!

    Note that element 1551 appears in only one segment: MTX, which was introduced in the 003060 X12 release. And in the initial 003060 release, it was only included in one X12 Transaction Set: 194 Grant or Assistance Application (which makes sense – a longer field was needed for grant applications).

    It seems that as new releases were developed, the MTX segment made its way into more and more transaction sets – likely for exactly the reason you're asking. In 003070, it was included in 5 transaction sets; in 004010, 15; in 005010, 24, and so on.

    The MTX segment uses element 1551 in both MTX02 and MTX03, so you can get double the length by using both of them. Note that there's a 'relational condition': If MTX-03 is present, then MTX-02 is required (in other words, you can't use MTX03 if you don't use MTX02 first).

    And depending on the transaction set, the MTX segment may be able to be repeated as well.

    Long story short: if the MTX segment is in the transaction set / release you're using, you're likely in luck.

    Hope this helps.