IBM Sterling Transformation Extender

Sterling Transformation Extender

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


#Sterling
#Supplychain
 View Only
  • 1.  Compare Field on Current Record with Same Field on Previous

    Posted 04/05/04 12:07 PM

    Originally posted by: SystemAdmin


    Hello! Have read something about this but not sure where it was.

    The environment is 6.7 on HPUX here. Would like to compare a record read on input to the previous record, for example, the SSN field, and if that is true, then perform some processing.

    The input file here could have up to five records per SSN, the key field, on the same file and would like to perform some conditional logic and look for a specific value in another field as long as the current record SSN matches the previous.

    Heard or read something where some kind of Last function or index is used to hold the record or read it from a buffer that TX has but not sure how to do this.

    Would anyone have an example or maybe a few recommendations for how to do this.

    Would appreciate any help that can be provided.

    Thanks!
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 2.  Re: Compare Field on Current Record with Same Field on Previ

    Posted 04/05/04 02:11 PM

    Originally posted by: SystemAdmin


    You can do it with stage variables.

    SaveLastRow = ColX
    Colx = Link.Column
    ColChanged = if SaveLastRow = Colx or @INROWNUM=1 then @true else @false
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 3.  Re: Compare Field on Current Record with Same Field on Previ

    Posted 04/06/04 05:57 AM

    Originally posted by: SystemAdmin


    Hello! Cannot find any documentation for this.

    Would your answer apply to TX or is it just Datastage and if it is TX, what help pdf is this located.

    Looking to perform this compare in the TX product.

    Thanks!
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 4.  Re: Compare Field on Current Record with Same Field on Previ

    Posted 04/06/04 06:24 AM

    Originally posted by: SystemAdmin


    Think the last reply might have been from a DataStage perspective rather than DataStage TX.

    There are two ways to utilize the LAST capability in DSTX, in a Type Tree component rule or in a Map rule.

    In a Type Tree component rule you create a group to contain the related rows. This has the advantage of the data being pre-parsed for you and being able to treat the related rows as a group (launch a functional map, reset a counter, etc.) and creates a control break on input.

    File Group
    --> Data Group (1:s)
    ------> SSN Group (1:s) Rule= SSN:$=SSN:$LAST
    -----------> SSN (1:1)
    -----------> Column2 (1:1)
    -----------> etc.

    If the data file contains multiple record types the coding changes a little as you may need to create a group that is made up of other groups and the placement of the LAST rule affects processing. Can't remember what manual this is in but if you contact support and tell them you need documentation on the use of "control break logic" in Type Trees they may be able to assist.

    In a Map you can also use LAST, with a little different placement, to test the value of an element but it only works in reference to output objects built. (If you want a control break on the input, use the Type Tree.) It is important to note that the value you check is within the context of the data "object" you are working with. For example, if you are defining a rule on an output card and you are in a functional map you will only be testing the values of data objects built within a single iteration of that functional map. If you want to test if the SSN# is the same as the last one built you need to perform the test one level up before entering the functional map, or pass the value of the last SSN into the functional map as a parameter.

    Output File
    ----> OutputRow (1:s)
    ---------> SSN (1:1)
    ---------> Column2 (1:1)
    ---------> etc.

    The Map rule for "Row" could be:

    1) IF (SSN:InputRow = SSNLAST IN OutputRow, F_SameSSN(InputRow), F_NewSSN(InputRow))

    2) F_EachRow(InputRow, SSNLAST IN OutputRow)

    Refer to the Function Reference for a discussion of the "IN" function. You might also want to check out the Ascential course L2-MC-605 "Advanced Transformation Techniques".
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 5.  Re: Compare Field on Current Record with Same Field on Previ

    Posted 04/06/04 07:11 AM

    Originally posted by: SystemAdmin


    Hello rreeves! Thanks for the great amount of information on this topic.

    The file does not have more than one record type, it is all detail records with the SSN in the beginning of each record here.

    Could not find anything about the IN function in the Function Reference, just has INDEX, INDEXABS and INT, it should be the latest version, the pdf is 1006, but maybe an update was made to this.

    What pdf is your IN function found if you have a chance to look.

    Will contact Ascential and check if they have documentation concerning control break logic in trees as well.

    Thanks!
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 6.  Re: Compare Field on Current Record with Same Field on Previ

    Posted 04/06/04 08:32 AM

    Originally posted by: SystemAdmin


    The place to find the IN is in the help in the design studio, Help -> Contents

    Functions and Expressions -> Reserved Words and Symbols -> Reserved Words and Symbols:
    IN Separates a component from an object that it contains.
    For example, LineItem IN File refers to all occurrences of the type LineItem in the type File.

    Control Break logic is no where in the documentation, it is just something that is learned...
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 7.  Re: Compare Field on Current Record with Same Field on Previ

    Posted 04/06/04 10:52 AM

    Originally posted by: SystemAdmin


    Eric is right -- control break logic is a developers' technique rather than a documentable product feature.

    There are, however, two chapters in the Tutorial (1027.pdf) that illustrate how to use control break logic. Chapter 9 deals with breaking on object counts (useful when working with COBOL data containing OCCURS DEPENDING ON clauses.) Chapter 10 deals with breaking when an item's value changes, which is what you're dealing with here.

    This topic is also covered in the TX Advanced Transformation Techniques training course, which I recommend to anyone who is about to take on their first, significant TX project.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 8.  Re: Compare Field on Current Record with Same Field on Previ

    Posted 04/06/04 11:49 AM

    Originally posted by: SystemAdmin


    Thanks rmcfate:

    I never realized that it was documented. I will look into it and read the "official" documentation!

    I also recommend the advanced training course, it saves countless hours of frustration in creating a solution, and attempting to explain the issue in this forum (which is a good forum, but sometimes kludgy).

    Cheers!
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 9.  Re: Compare Field on Current Record with Same Field on Previ

    Posted 04/06/04 02:53 PM

    Originally posted by: SystemAdmin


    Sorry. My answer was from a DataStage perspective.
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 10.  Re: Compare Field on Current Record with Same Field on Previ

    Posted 04/07/04 06:53 AM

    Originally posted by: SystemAdmin


    Thanks to everyone for the help! Those two chapters in the tutorial pdf actually have some good examples to work from.

    Will use the chapter 10 example as a model and try to get this working.

    Thanks!
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender