IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.


#Sterling
#Supplychain
 View Only
Expand all | Collapse all

Component Rule Question

  • 1.  Component Rule Question

    Posted 06/28/08 10:06 PM

    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>
    • <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


  • 2.  Re: Component Rule Question

    Posted 06/29/08 02:21 PM

    Originally posted by: LaurentB


    I'm not sure to get your point.
    If all components are fixed length and mandatory, then the best available option is to have the group as explicit fixed, and this should do it.
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 3.  Re: Component Rule Question

    Posted 06/29/08 08:42 PM

    Originally posted by: SystemAdmin


    I also tried setting the group as explicit and it didnt work either. So thats why I'm trying to see if its possible to create a component rule that would work or if anyone else has run into a situation like this and how they resolved it. Thanks anyway.
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 4.  Re: Component Rule Question

    Posted 06/30/08 04:17 AM

    Originally posted by: janhess


    What version are you using? I've never had this sort of problem with fixed length fields.

    Are you saying that the group occurs an indeterminate number of times or do you know how many occurences there are? If the number of odccurrences varies from record to record than you need some way to either know how many occurrences there are or the end of the group. I did once have to deal with a file that had an number of variable occurring groups in record but each group had a field containing the character number for the start of the occurence.

    Message was edited by: janhess
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 5.  Re: Component Rule Question

    Posted 06/30/08 09:19 AM

    Originally posted by: SystemAdmin


    Hello,
    I am using version 8.1.0.2 build 38. Yes, the group occurs an indeterminate number of times (O:s) and there is a field in the data that determines how many times the group repeats, but that part seems to be working correctly now. The problem is determining the end of that group since there is no syntax. I noticed that the data is being read correctly; however, the tags on the output do not change (keeps repeating until it reaches the CRLF at the end of the data) so its seems that I am missing something in my type tree. The group is repeating the correct number of times, however, I cant get my type tree to recognize it has reached the end of this group so what is happening is the outbound tags for this group keeps repeating until it reaches the CRLF at the end of the file. I've tried changing the group to implicit and explicit but I am getting the same results. I believe the issue is in the type tree so I will keep trying. Thanks.
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 6.  Re: Component Rule Question

    Posted 06/30/08 10:03 AM
      |   view attached

    Originally posted by: janhess


    I have created a very simple file containing 3 different length records as a string. The type tree defines the variable group as a sized binary text. The size field is the character size.
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender

    Attachment(s)



  • 7.  Re: Component Rule Question

    Posted 06/30/08 10:16 AM

    Originally posted by: SystemAdmin


    Thank you! I will give this a shot and let you know. Thanks again.
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 8.  Re: Component Rule Question

    Posted 06/30/08 10:36 AM

    Originally posted by: janhess


    Sorry, type tree has sized character group but it works the same.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 9.  Re: Component Rule Question

    Posted 06/30/08 11:57 AM

    Originally posted by: SystemAdmin


    Hello,
    Thank you for the map; however, I don't believe I described my issue very well. I have provided more details about the issue I am having:
    3Key001 Val001 Key002 Val002 Key003 Val003 Group = 0:s
    0:1 0:1 0:1 0:1 0:1 0:1
    \ / \ / \ /
    70 70 70

    3 = number of times the pair repeats (# varies)
    Key+Val = 70 char total
    70*3 = 210 represents total of characters in group (end of group)

    ----- Next group, 1st data item in group

    Group repeats the correct # of times, however, doesn’t stop repeating until it reaches the end of data.

    key>KEY001</key>
    <value>VAL001</value>
    </keyValue>
    <keyValue>
    key>KEY002</key>
    <value>VAL002</value>
    </keyValue>
    <keyValue>
    key>KEY003</key>
    <value>VAL003</value>
    </keyValue>
    <keyValue>
    key>2 2 677073850</ key> tags should represent 1ST data element in next group, not previous group.
    <value>P GEORGE</value>
    </keyValue>
    Component rule is working, since I am getting the correct # of groups. The next set of output tags should belong to the next group to represent the data but it isn’t, its still repeating the previous group tags because my typetree doesn’t recognize its reached the end of the data in this group (since there is no syntax). The tags keep repeating until it hits the CRLF at the end of the data then it goes to the next group. I know it’s something I need to do with the type tree properties, so I will keep manipulating the properties. Thanks again.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 10.  Re: Component Rule Question

    Posted 06/30/08 12:00 PM

    Originally posted by: janhess


    Or is it your output card rule? What does the trace file say?Can you post the type tree and sample data?
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 11.  Re: Component Rule Question

    Posted 06/30/08 12:36 PM

    Originally posted by: SystemAdmin


    The only rule on the output card is to map each field in the group, so I don't think thats it. Unfortunately due to the nature of the data, I am unable to post it. Thank you for all of your help, I really appreciate it
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 12.  Re: Component Rule Question

    Posted 07/01/08 06:00 AM
      |   view attached

    Originally posted by: janhess


    OK try the attached map and typetree. The data is like your example. In the type tree is uses the rule on the occuring Group - count($) <= Sizeof Item where Sizeof is the field containing the number of occurences of the group.
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender

    Attachment(s)



  • 13.  Re: Component Rule Question

    Posted 07/01/08 09:24 AM

    Originally posted by: SystemAdmin


    Hi Janhess-
    thank you for your assistance,this is very helpful. I made a few changes to my type tree and I worked out a solution that is very similar to what you have in the map ($= COUNT( KeyValueCount Comp ). Youre solution will also help me because I have another group similar situation but the data does not provide me the number of times this group repeats. It is working now! Thank you for your all of your help I really appreciate it!
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange