Originally posted by: SystemAdmin
Hello,
I am getting error L199 when analyzing a type tree. I need to add a component rule to distinguish between two groups in the type tree. My question is there a way to create a component Rule to a group to repeat based on # in data OR can a component rule be created to determine the # of characters to include in group?
The issue is, the data does not have any syntax and it is a fixed length. In the type tree the group is set up as implicit (also tried explicit), and the data elements have a min and max size Ex. Min=22, Max=22). The problem I am running into is since there is no syntax, when the map reads the data, it can’t determine where this group ends so it reads the entire file as being a part of this group until it gets to the end of the file. There are two ways that might work but I am having trouble writing the rule. The first way I believe would work is to make the group repeat based on a particular number in the file. For example, the data would read: 3Key001 Valu001 Key002 Val002 Key003 Val003.
The “3” would tell me the number of times to repeat this group.
The second way is since the Key is 20 characters and the Value is 50 characters, making the pair 70 characters total, then I could write the component rule to multiply the “3” by ‘70’ to represent the number of characters that belong to this group. Once it gets to this total, the next group should start. I have tried several rules but nothing works, for example:
$= COUNT (Key Comp KeyValueType:$ ) * 20 + COUNT (Value Comp KeyValueType:$ ) * 50
$<=LEFT ($, KeyValueCount Comp * 70 )
IF (PRESENT ( KeyValueCount Comp ) , SIZE = CLONE( ($), KeyValueCount Comp ))
SIZE ( $) = LEFT ($, KeyValueCount Comp * 70 )
$=$
LAST $ = IF (PRESENT ( KeyValueCount Comp ) , $)
$ = IF (PRESENT ( KeyValueCount Comp ) , LEFT ($, KeyValueCount Comp * 70 ))
SIZE ( $) = KeyValueCount Comp * 70 (rule works still reads entire file)
$=LEFT ($, KeyValueCount Comp * 70 ) (rule works but still reads entire file, includes more than # of characters than it should based on the formulae listed above) *Should read 210 characters then go to next group. Trace report looks like this: (this is only 1 key so tag should change after 70 char. *Notice the tags don’t change even though the data does.
<key>KEY001A</key>
<value>VAL001A</value>
</keyValue>
< key>2 2 677073850</ key>
<value>P GRACE</value>
</keyValue>
The trick is, to determine the size of the group in a component rule in order to distinguish between two groups because there is no syntax.
Is there a way to add a component rule to repeat a group based on a particular number or a way to state in a component rule that this group is a particular number of characters based on a formulae (70 x
some number)? Any assistance would be greatly appreciated.
#IBM-Websphere-Transformation-Extender#DataExchange#IBMSterlingTransformationExtender