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

creating multiple o/p files

  • 1.  creating multiple o/p files

    Posted 10/04/07 10:46 AM

    Originally posted by: SystemAdmin


    I am working on a scenario where I have got two file's:
    file 1
    HDR file with multiple PO's

    & file 2
    DTL file with multiple dtl lines for each PO

    I am trying to now work on getting multiple output files each having unique PO HDR+ corresponding PO details.

    I am presently getting one o/p file with each PO & its corresponding details.

    How do i now separate it to create multiple o/p files depending on number of PO's??? (probably using PUT function)
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 2.  Re: creating multiple o/p files

    Posted 10/04/07 10:51 AM

    Originally posted by: janhess


    For each header use put to create a file and use something from the header to identify the file name.
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 3.  Re: creating multiple o/p files

    Posted 10/04/07 03:01 PM

    Originally posted by: jvanboga


    I like janhess idea. Could also execute a runmap for each hdr + dtl group. each method has adv/disadv.
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 4.  Re: creating multiple o/p files

    Posted 10/04/07 03:13 PM

    Originally posted by: SystemAdmin


    could u elaborate on the runmap for each hdr+dtl group ???
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 5.  Re: creating multiple o/p files

    Posted 10/04/07 04:05 PM

    Originally posted by: jvanboga


    essentially, you'd pass your header plus all of your related detail to a runmap. You'd also override the runmap output file name with your run command.

    There should be an explanation on how to do that in one of the pdf's. Check out the Design Studio Intro, Command Server and Map Designer guides. You might also search your map (mms) files for either "run(" or "run (". Looking at them will give you some ideas.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 6.  Re: creating multiple o/p files

    Posted 10/04/07 05:22 PM

    Originally posted by: SystemAdmin


    i am getting multiple o/p files using PUT func , but the records are not being grouped...

    for eg

    file 1-rec1
    file 2-rec2
    file 3-rec3
    file 4-rec1

    i want only 3 o/p files to be created & rec1 to be added to file 1....so file 1 should have 2 records....
    any suggestions about this grouping ???
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 7.  Re: creating multiple o/p files

    Posted 10/05/07 03:51 AM

    Originally posted by: SystemAdmin


    Hi ASK,

    I think in your case you better create a second map that has two input cards, one containing 1 header, and one containing s Details. You then call this map with RUN() for each Hdr you have, and you pass the following inputs to your second map:
    • the Hdr
    • all corresponding Details to this Hdr (with extract)

    Here is an idea of how your RUN function will look like :

    =VALID(RUN ( "Create_One_File", ECHOIN( 1, PACKAGE (Hdr) ) + ECHOIN( 2, PACKAGE ( EXTRACT (...all Dtl corresponding to given Hdr...) ) + " -OF1 File_xxxHdrxxx.txt"),
    FAIL ("Error running map Create_One_File " + LastErrorCode() + " " + LasterrorMsg() ) )

    The option -OF1 means you override the adapter of output card one with "File" and specify the filename with something coming out of your Hdr.

    Hope this will help :)
    François
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 8.  Re: creating multiple o/p files

    Posted 10/05/07 09:52 AM

    Originally posted by: SystemAdmin


    Hi François
    I am unable to get exactly what you are trying to explain?
    could you please elaborate clearly.
    Thanks for your help.
    regards
    ASK
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 9.  Re: creating multiple o/p files

    Posted 10/05/07 10:07 AM

    Originally posted by: janhess


    I think you need something like this.

    Input card 1 - Header records + POs
    Input Card 2 - details records

    output 1 file structure header, POs ,Details for each PO
    use functional map to generate details by using Extract function

    Output 2 have Item occurring S and use PUT with the append parameter (I think filename+)(might need to be through a functional map) and use part of the header that's coommon to the multiple headers that you want to group in one file.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 10.  Re: creating multiple o/p files

    Posted 10/05/07 10:34 AM

    Originally posted by: SystemAdmin


    i require multiple files for each PO, not just the headers...
    i/p file1 i/p file2
    HDR for PO1 DTL for PO1
    HDR for PO2 DTL for PO2
    HDR for PO3 DTL for PO3

    o/p to have multiple files as

    file1 file2 file3
    HDR for PO1 HDR for PO2 HDR for PO3
    DTL for PO1 DTL for PO2 DTL for PO3
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 11.  Re: creating multiple o/p files

    Posted 10/05/07 10:58 AM

    Originally posted by: janhess


    I think that's what I was trying to say. The only thing you need to worry about is if there are multiple headers that you need to put into the same file where you don't want to output the additional headers.
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 12.  Re: creating multiple o/p files

    Posted 10/05/07 11:00 AM

    Originally posted by: jvanboga


    janhess is on the money. output card2 should produce a output file for each group of hdr+dtl
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 13.  Re: creating multiple o/p files

    Posted 10/05/07 11:29 AM
      |   view attached

    Originally posted by: SystemAdmin


    i have created a sample scenario and attaching it here...

    my ip file is
    AK,2485226918
    SB,6786440699
    SM,4047254258
    AK,9372454169

    my o/p which iam getting is
    all records in diffn files....so 4 o/p files getting created instead of 3.

    as record AK is repeated, it should be grouped....

    let me know where iam going wrong ???
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender

    Attachment(s)



  • 14.  Re: creating multiple o/p files

    Posted 10/05/07 12:00 PM
      |   view attached

    Originally posted by: janhess


    here's an example of producing the output files from your file in the body of your post. You can figure out the extract yourself.
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender

    Attachment(s)



  • 15.  Re: creating multiple o/p files

    Posted 10/05/07 04:07 PM

    Originally posted by: SystemAdmin


    hey, the attached example is not working ???
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 16.  Re: creating multiple o/p files

    Posted 10/08/07 04:30 AM

    Originally posted by: janhess


    You need 2 subfolders called logs and trace. Otherwise change the map to put the logs & trace where you want them.
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 17.  Re: creating multiple o/p files

    Posted 10/08/07 05:09 AM
      |   view attached

    Originally posted by: janhess


    I've done the work for you again.
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange

    Attachment(s)



  • 18.  Re: creating multiple o/p files

    Posted 10/08/07 11:25 AM
      |   view attached

    Originally posted by: SystemAdmin


    how about doing it this way ......i have tried to use control break while reading the data in type tree itself.....
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender

    Attachment(s)



  • 19.  Re: creating multiple o/p files

    Posted 10/08/07 11:55 AM

    Originally posted by: janhess


    That will work if your input file is sorted. However, my solution will work for an unsorted file.
    You could sort the data in the first output card if it is unsorted and use your method.
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 20.  Re: creating multiple o/p files

    Posted 10/08/07 12:03 PM
      |   view attached

    Originally posted by: janhess


    I think this may be more efficient.
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange

    Attachment(s)



  • 21.  Re: creating multiple o/p files

    Posted 10/08/07 12:04 PM
      |   view attached

    Originally posted by: janhess


    Ignore the last attachment, I forgot to save the map.
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender

    Attachment(s)



  • 22.  Re: creating multiple o/p files

    Posted 10/08/07 01:27 PM

    Originally posted by: SystemAdmin


    you r absolutely right....my method will not work on unsorted file....how do i then sort it?can i use sortup/dwn in the extract ??? the last attachment u sent does not create the req o/p for unsorted file ....
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 23.  Re: creating multiple o/p files

    Posted 10/08/07 02:26 PM
      |   view attached

    Originally posted by: jvanboga


    I must have missed something here. thought you were trying to merge two files. one had header info, the other the detail.

    If that's correct and you have small - med sized datasets you could use this formula. It can be a resource pig but it would work.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender

    Attachment(s)



  • 24.  Re: creating multiple o/p files

    Posted 10/08/07 02:41 PM

    Originally posted by: SystemAdmin


    U did not miss something....just a modification in the o/p that we get, we need to put it in multiple files for each HDR & its corresponding DTL set......

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


  • 25.  Re: creating multiple o/p files

    Posted 10/08/07 03:01 PM
      |   view attached

    Originally posted by: SystemAdmin


    i have done a slight modification to ur work & we now get the req o/p...
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender

    Attachment(s)



  • 26.  Re: creating multiple o/p files

    Posted 10/05/07 12:03 PM

    Originally posted by: jvanboga


    I'd create an output tree defined something like

    file
    .output_group (0:s)
    ..hdr
    ..dtl (1:s)

    Then a rule at the output_group level similar to janhess's or like the below (this is not very efficient if your file is large but will work fine for small - mid size files)

    f_map_hdr (hdr rec, dtl file)

    then in that f_map, rule 1 hdr:rec = hdr:rec, dtl rule = if (dtl condition matchs hdr rec then dtl:rec)

    then output card 2 puts each output_group or runs a map for each output_group creating your files.
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 27.  Re: creating multiple o/p files

    Posted 10/05/07 12:07 PM

    Originally posted by: jvanboga


    btw.... not familiar with the rar file extention. what should i open it with?
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 28.  Re: creating multiple o/p files

    Posted 10/05/07 12:10 PM

    Originally posted by: janhess


    Winrar. You need to download it. It's like winzip but they charge for creating RAR files. But the example doesn't help. I think I answered the output problem 2 posts ago.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender