# Where does the UNH01 segment of a 01B EDI document get populated from?

**URL:** <https://techcommunity.softwareag.com/t/where-does-the-unh01-segment-of-a-01b-edi-document-get-populated-from/109437>\
**Category:** Forum\
**Tags:** EDI\
**Created:** [November 6, 2007, 6:24am UTC](https://techcommunity.softwareag.com/t/where-does-the-unh01-segment-of-a-01b-edi-document-get-populated-from/109437 "2007-11-06T06:24:16Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aditya](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/aditya/32/202_2.png) [@Aditya](https://techcommunity.softwareag.com/u/Aditya)\
**Post date:** [November 6, 2007, 6:24am UTC](https://techcommunity.softwareag.com/t/where-does-the-unh01-segment-of-a-01b-edi-document-get-populated-from/109437/1 "2007-11-06T06:24:16Z")

</div>

Hi there,

I’m experiencing a bit of a problem with where a certain value gets populated from in the EDI 01B Document.

The UNH01 segment of my EDI document doesn’t have any mapping, however when i do a wm.b2b.edi.convertToString, it populates that segment with a random number.

This is fine in my Dev environment (which is Windows), however when the code is run in a HP-UX environment, the UNH01 = “MSG\_ID”

Does the convertToString service automatically populate that segment? And if so, could a difference in environments cause this problem?

If you require any of the code let me know.

Thanks in advance

–Aditya

---

<div class="post-metadata">

**Author:** ![gupta\_r.17495](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@gupta\_r.17495](https://techcommunity.softwareag.com/u/gupta_r.17495)\
**Post date:** [November 7, 2007, 12:30am UTC](https://techcommunity.softwareag.com/t/where-does-the-unh01-segment-of-a-01b-edi-document-get-populated-from/109437/2 "2007-11-07T00:30:14Z")

</div>

UNH01 is a Message reference number(control number) convertToString generates it automatically extracting it from the control number table.

Can you elaborate bit more on the issue you are facing??

HTH,  
RMG

---

<div class="post-metadata">

**Author:** ![Aditya](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/aditya/32/202_2.png) [@Aditya](https://techcommunity.softwareag.com/u/Aditya)\
**Post date:** [November 8, 2007, 6:14am UTC](https://techcommunity.softwareag.com/t/where-does-the-unh01-segment-of-a-01b-edi-document-get-populated-from/109437/3 "2007-11-08T06:14:20Z")

</div>

Hi RMG,

Thanks for the information regarding where the UNH01 gets generated from.

The issue i’m facing is that in my DEV environment, this is working successfully and the number is getting generated.

In the QA environment, a HP UX box, the number isn’t getting generated at all and only MSG\_ID is being printed.

I’ve done a diff on the code in QA and my DEV and there are no differences at all.

Could the environment cause the differences? or is there something else that could cause this?

---

<div class="post-metadata">

**Author:** ![gupta\_r.17495](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@gupta\_r.17495](https://techcommunity.softwareag.com/u/gupta_r.17495)\
**Post date:** [November 8, 2007, 9:07pm UTC](https://techcommunity.softwareag.com/t/where-does-the-unh01-segment-of-a-01b-edi-document-get-populated-from/109437/4 "2007-11-08T21:07:23Z")

</div>

Could the environment cause the differences? or is there something else that could cause this?

could be…i have no clue…

---

<div class="post-metadata">

**Author:** ![reamon](https://avatars.discourse-cdn.com/v4/letter/r/b77776/32.png) [@reamon](https://techcommunity.softwareag.com/u/reamon)\
**Post date:** [November 8, 2007, 10:55pm UTC](https://techcommunity.softwareag.com/t/where-does-the-unh01-segment-of-a-01b-edi-document-get-populated-from/109437/5 "2007-11-08T22:55:10Z")

</div>

UNH is similar to the ST segment in X12. It is not managed by a control number table. When you call wm.b2b.edi:convertToString, it will assign a (random) value for UNH01 (or ST01 for X12) if that field is null in your document.

Though convertToString provides a generated control number, you usually want to set it. A common practice is to assign a sequential number to each transaction set within the group/interchange that starts at 1 (often 0001) and increments by 1 for each transaction set within the group (though EDIFACT docs don’t normally have groups).

If your process is such that just one transaction set per interchange, setting UHN01 to 1 (or 0001) should be fine. If you’re managing putting multiple transactions sets into a single interchange, then you’ll want to assign incrementing control numbers. If you use the built-in batching service (wm.b2b.editn.batch:batchProcess) then you can control how the control number is managed with the contentControlNumber input variable.

Refer to the EDI Module BIS Reference for more information. Specifically, the descriptions for wm.b2b.edi:convertToString, wm.b2b.editn.batch:batchProcess and wem.b2b.edi.util:addICEnvelopeEDIFACT.

---

<div class="post-metadata">

**Author:** ![Aditya](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/aditya/32/202_2.png) [@Aditya](https://techcommunity.softwareag.com/u/Aditya)\
**Post date:** [November 9, 2007, 4:34am UTC](https://techcommunity.softwareag.com/t/where-does-the-unh01-segment-of-a-01b-edi-document-get-populated-from/109437/6 "2007-11-09T04:34:43Z")

</div>

Hi Rob,

I’ve gone with your method of assigning the value 0001, which is also what the client requested.

Would you know if the environment webMethods is run on can cause the convertToString to not generate a number as a random value for the UNH01 segment if that is null?

In Windows, UNH01 is a number  
In HP UX, UNH01 is “MSG\_ID”

Thank you once again for your help as well as RMG.

---

<div class="post-metadata">

**Author:** ![reamon](https://avatars.discourse-cdn.com/v4/letter/r/b77776/32.png) [@reamon](https://techcommunity.softwareag.com/u/reamon)\
**Post date:** [November 9, 2007, 5:15am UTC](https://techcommunity.softwareag.com/t/where-does-the-unh01-segment-of-a-01b-edi-document-get-populated-from/109437/7 "2007-11-09T05:15:17Z")

</div>

I do not know what causes the difference in the behavior you observed.

---

<div class="post-metadata">

**Author:** ![Aditya](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/aditya/32/202_2.png) [@Aditya](https://techcommunity.softwareag.com/u/Aditya)\
**Post date:** [November 15, 2007, 8:29am UTC](https://techcommunity.softwareag.com/t/where-does-the-unh01-segment-of-a-01b-edi-document-get-populated-from/109437/8 "2007-11-15T08:29:26Z")

</div>

Hi Rob/All,

I figured out what was causing the problem.

The handler service that invokes the mapping service, set the value of the UNH01 segment manually after the mapping service completed. This is what was setting the value of UNH01 to MSG\_ID.

I did a quick patch to resolve this issue.  
Good thing it wasn’t an environmental problem

---

<div class="post-metadata">

**Author:** ![gupta\_r.17495](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@gupta\_r.17495](https://techcommunity.softwareag.com/u/gupta_r.17495)\
**Post date:** [November 16, 2007, 6:54am UTC](https://techcommunity.softwareag.com/t/where-does-the-unh01-segment-of-a-01b-edi-document-get-populated-from/109437/9 "2007-11-16T06:54:32Z")

</div>

See…here you go…Glad to hear you resolved the issue by yourself.

HTH,  
RMG

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 3:05pm UTC](https://techcommunity.softwareag.com/t/where-does-the-unh01-segment-of-a-01b-edi-document-get-populated-from/109437/10 "2021-04-02T15:05:41Z")

</div>

Closed on April 2, 2021, 3:05pm UTC


