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.  Splitting Files without using submap

    Posted 08/18/26 08:38 AM

    Hi,

    I have a map where i am generating a outputfiles in outputcard1 after translation which has 5 records.

    so i need to split it into 2 records per each file so 3 files has to be created.

    is there any way to achieve it using a functional map in a outputcard as i can't use submap and batch the output in to 2 record per batch. 

    Thanks in advance for your thoughts.



    ------------------------------
    Santanu Baral
    ------------------------------


  • 2.  RE: Splitting Files without using submap

    Posted 08/19/26 01:08 PM

    There are only two ways to get multiple files out of a map.

    1. Have 3 output cards, each pointing to a different file.
    2. Use the PUT("FILE"..) function in either an executable map or functional map.

    Given that the number of files you want seems to be static, Option 1 makes the most sense.  Option 2 would be more useful if you didn't know in advance how many files you wanted to create.

    Rich McFate



    ------------------------------
    Rich McFate
    ------------------------------



  • 3.  RE: Splitting Files without using submap

    Posted 08/19/26 01:16 PM

    I just re-read your original post and I think I see your issue.  You're mapping the input(s) into an output card and then need to do further mapping to split that up into 3 outputs.

    I suggest you add output cards #2, #3, and #4 and simply map them from what you already have in outputcard1.  To make that easier, right-click on the gray bar at the top of the card and select Move to 'left side'.  That will put outputcard1 on the left side of the Map Designer and make it easier to map to the other three cards.

    Rich



    ------------------------------
    Rich McFate
    ------------------------------



  • 4.  RE: Splitting Files without using submap
    Best Answer

    Posted 08/19/26 08:07 PM
    Edited by Santanu Baral 08/24/26 06:02 AM

    I have a little bit different take on your post than Rich.  It kinda sounds like your wanting to stay within a single output card to do all the work.  I do this kind of thing often and I have a utility type tree that I built for chunking off files in whatever kind of grouping I like.  Basically it is layers of repeating records with a blob text item at it's heart with an optional Key field so that I can identify my groups if necessary for naming etc.  Structure looks like this...  You can use delimiters at group definitions however you'd have to remember to strip them off in a PUT function depending on how you use it.

    Grp: LabelList(s)

              itm: label (1:1)

              grp: List(s)

                       itm: blob(s)

    From this structure, I can then index as many or as few groups as I need to accomplish my tasks - so in your case - I would maybe just have my output card point to the group "LabelList" and have 3 indexed instances and set the remaining (s) to NONE.  Then make a functional map that will PACKAGE the records you want into a blob and then do the PUT function on the inside.  Depending on how you need to group the records that could be using EXTRACT for a particular criteria or use PACKGE(CHOOSE Record 1) + PACKAGE(CHOOSE(record 2)) to get the desired payload for the PUT and pass in any other items needed for file naming etc.

    1-1# PutFiles (LabelList Data)
    Output Rule
    PutFiles  
    LabelList [1]  
    Label Field ="Records1&2"
    List (s) =f_PutRecs(PACKAGE(CHOOSE(Record, 1)) + PACKAGE(CHOOSE(Record, 2)), filename)
    LabelList [2]  
    Label Field ="Records3&4"
    List (s) =f_PutRecs(PACKAGE(CHOOSE(Record, 3)) + PACKAGE(CHOOSE(Record, 4), filename)
    LabelList [3]  
    Label Field ="Record5"
    List (s) =f_PutRecs(PACKAGE(CHOOSE(Record, 5)), filename)
    LabelList [s] =NONE

    Then inside the f_PutRecs functional map do the PUT function with the packaged blob you've passed in on an index of you blob.

    1-1# PutRecs (List Data)
    Output Rule
    PutRecs  
    List   

    blob Field [1]

    =PUT("File", filename, PACKAGE(input))
    blob Field (s) =NONE

    I would wrap the PUT in a VALID to catch errors/deal with errors too.  But if you're limited on cards you can use for output this is one way to do it all in a single output card and write multiple outputs.

    Happy mapping!



    ------------------------------
    Lisa Edwards
    Software Engineer / Subject Matter Expert
    Rainbow Data Systems, Inc
    ------------------------------



  • 5.  RE: Splitting Files without using submap

    Posted 08/24/26 06:03 AM

    Thank you so much for these detail information. It really helps a lot.



    ------------------------------
    Santanu Baral
    ------------------------------



  • 6.  RE: Splitting Files without using submap

    Posted 08/20/26 01:39 AM
      |   view attached

    Hi,

    You can dynamically write to as many files using PUT function inside a functional map. You just have to define your type tree with as many records you want in the output and create an extra output card to parse the output. I am attaching a sample split map that creates a file per 2 lines.

    Regards,

    Premkumar



    ------------------------------
    Premkumar Madheswaran
    ------------------------------

    Attachment(s)

    zip
    split_map.zip   4 KB 1 version


  • 7.  RE: Splitting Files without using submap

    Posted 08/24/26 06:05 AM

    Thank you so much for the sample. Definitely it will help to get a direction.



    ------------------------------
    Santanu Baral
    ------------------------------



  • 8.  RE: Splitting Files without using submap

    Posted 08/24/26 06:10 AM
    Edited by Santanu Baral 08/24/26 06:11 AM

    I am using ITX v10 and i am getting error while opening the map as "Error Loading File Make sure the file is not already opened". Type tree also failed to open...is it build in higher version?



    ------------------------------
    Santanu Baral
    ------------------------------