Subscribe to keep this site alive! Under new management but as always, still 100% FREE. Anyone with the IBM i is a friend of ours.
The Challenge: We are receiving the 820 (4010) from a trading partner who may not be adhering to the X12 standard. They are sending DTM/REF segments directly subordinate to the ENT loop.
We are receiving TRN9300 Received segment DTM was unexpected.
The Analysis: By saying that the DTM/REF is within the ENT loop, your Trading Partner must have sent you at least an ENT.
The first thing we have to do is to open a fresh map with the correct target version and select all REF and DTM segments. Do not worry about positioning, the mandatory loop starters and loop hearder will automatically be selected - so you always know where you are.
When we first examined this, we thought that the sequence of the DTM-REF was wrong (because most of the tandems were REF then DTM, except for DTM 300 / REF 320).
Loop starters are usually the first segment after the Loop Header - most of the time the segment has the same name as the loop. The loop starter will only occur once and is Mandatory.
If a segment can occur several times, then this is considered a loop. With the DTM-REF tandem, the DTM is the loop starter.
DTM 300 belongs to the ADX Loop, where ADX is its loop starter.
Read more on Variable Loop Starters.
The Solution:
After identifying the target segments (DTM 300/REF 320), View> Document> All.
Find out what is the nearest the nearest loop DTM 300 belongs to: the ADX Loop where ADX 270 is the loop starter.
We then need to make sure that the Requirement is Optional and Maximum Occurrence is 1 for the segments ADX 270 thru the target DTM 300 (and REF 320 if you are expecting this segment to optional) by overriding the Segment Properties (noted with a red star).
Because REF 320 is already a loop starter, hence Maximum Occurrence will be 1. To restrict it to occur more than once, change the Loop Properties of the REF Loop Header (noted with a red heart).
Thinking of a new CHALLENGE? Let us know HERE.