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.  Way to generate random numbers

    Posted 06/26/04 02:04 PM

    Originally posted by: SystemAdmin


    Hello! Looking for a way to create a test file.

    Particulary, would like to generate a random SSN for that field. Have an input file with 10 records, and would like to create say 10 records for each input record, all with a different SSN on each record on the output file.

    Was looking at a functional map or possibly 10 functional maps, to write out a record each, all fields except the SSN are changed.

    Can use the Index or Count function to add a constant to the SSN on input so that a different one would be built on output but was looking for some type of Random number generating function.

    Could not find anything in the help pdf but possibly someone has done something like this previously.

    Would appreciate any tips or recommendations concerning this.

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


  • 2.  Re: Way to generate random numbers

    Posted 06/27/04 01:02 AM

    Originally posted by: SystemAdmin


    What Operating System are you using? If you are using Windows XP, you could use the BATCH adapter to shell out and get a random number from the OS:

    =GET("BAT","cmd /c echo %P%RANDOM%P%")

    (note the Resource Registry will have to have a entry for P to represent %)

    ...not perfect, but at least a solution.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 3.  Re: Way to generate random numbers

    Posted 06/28/04 06:54 AM

    Originally posted by: SystemAdmin


    Hey Paul! Currently do the development on XP and HPUX will be the environment for production.

    From your example, guess the shell adapter can be used to run an HPUX script and grab the number from the Random function. Now the %P% is the number generated or what does that represent in the resource registry file, not understanding that part yet.

    Have used the resource registry before to hold variables for server names when connecting to a database but not sure what the %P% does here.

    Very much appreciate your help.

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


  • 4.  Re: Way to generate random numbers

    Posted 06/28/04 07:41 AM

    Originally posted by: SystemAdmin


    Define functional map to create a row for each input record. Then insert the CLONE function into the functional map rule to replicate each input row X times. Add INDEX($) onto the functional map rule so you have a counter that can be part of a formula that generates the output number.
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 5.  Re: Way to generate random numbers

    Posted 06/28/04 10:12 AM

    Originally posted by: SystemAdmin


    Hello rreeves! Thanks for the reply today.

    The Clone function via the functional map call worked great and generated the x number of records needed on the output file.

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


  • 6.  Re: Way to generate random numbers

    Posted 07/11/04 07:20 PM

    Originally posted by: SystemAdmin


    Hello! Have a modification to add to this topic.

    Would like to still create a test file with random SSNs generated but with a little twist here. The input file has 2 record types, S for Subscriber and D for Dependents, there can be 0 or many Dependents per Subscriber and the record lengths are the same for these types.

    Ex.

    S000003 111111111 111111111SMITH
    S000004 222222222 222222222THOMPSON
    D000005 222222222 222223333THOMPSON JR
    S000006 333333333 333333333RICKARDS
    D000007 333333333 333334444RICKARDS JR
    S000008 444444444 444444444HORN

    The Subscriber SSN is in position 23 for length of 9 and this SSN links Dependents to the Subscriber record, such as 222222222 for Thompson above, then position 36 for 9 has that records real SSN, so for the Subscriber record the Subscriber SSN is the same as the real SSN, but for the Dependent record, the real SSN should be different than the Subscriber SSN, such as 222223333 for Thompson Jr, the son of Thompson as in the above sample record text.

    The goal is to clone a test file and make say 70 copies of each record above, but keeping the Subscriber and its associated Dependents, if any, with the same Index number increase for the SSNs that are cloned.

    Ex. For Thompson above, the first 2 cloned copies of the 1 Subscriber and 1 Dependent record should look as follows.

    S000004 222222223 222222223THOMPSON 3
    D000005 222222223 222223334THOMPSON JR 3
    S000004 222222224 222222224THOMPSON 4
    D000005 222222224 222223335THOMPSON JR 4

    Therefore, if an incremental Index of 1 is added to each Subscriber SSN to generate a new cloned Subscriber SSN, would like to use the same increment of 1 for the real SSN in position 36, for each record in the Subscriber linked group of records, and also added the new Index value to the end of the Last Name so that it is easier to differentiate the records that were changed.

    Would like to use the same function map clone technique recommended previously if possible, but not sure how to keep the linked records together before the incremental index is added to the Subscriber SSN and Real SSN fields.

    Would this require the control break logic technique where records could be grouped on a commom value, then you could work with the correct fields in that group and perform the increment process.

    Have read something about it in the help pdf, chapter 10 in the Design Studio tutorial, data break by value, but do not fully understand it and how to apply it here.

    Would guess the Subscriber SSN that links the records is the data break value but not sure how to do this in the map. Possibly someone may have an example of how to do this Index increment in the map using this technique.

    Have one more thing, would the field that has the data break need to be the first field in the record, as in the tutorial, or could it be another field in a later position.

    Would appreciate any recommendations or help concerning this.

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