IBM Sterling Transformation Extender

 View Only
Expand all | Collapse all

How to send multiple records in a file as a single call to RUN child map

  • 1.  How to send multiple records in a file as a single call to RUN child map

    Posted Sun January 14, 2024 02:55 AM

    Hi,

    I have the below data where 000 & 002 are header and trailer record and 001 is the detail record.

    1234 in the detail record is the sequence number,so based on the unique sequence number i need to pass the data to child map.

    Since there are 2 unique sequence number in the below data so the child map supposed to be called twice with the matching detail record.

    000

    0011234Test

    0011234Test1

    0011234Test2

    0011233Tess

    0011233Tess

    002

    1st call-parent map should send the below records to child map

    0011234Test

    0011234Test1

    0011234Test2

    2nd call-parent map should send the below records to child map

    0011233Tess

    0011233Tess

    Please suggest if there is any way to achieve it.

    Thanks

    Santanu



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


  • 2.  RE: How to send multiple records in a file as a single call to RUN child map

    Posted Wed January 17, 2024 12:18 AM

    Hi Santanu,

    It is not clear (to me) if you want each complete record set or just the detail records...  but the process is relatively the same.  You will want to have a simple loop defined in a type tree with just a text field that loops in a record (s) times.  This is where you will call your RUN and send in the appropriate information.  If you just want each record set as a separate send to the run map the process is very simple:
     VALID(
                       RUN(RunMapPath, RunMapSettings + ECHOIN(1, PACKAGE(RecordSet)) + " -OF1 " + Directory + FileName )
                     , "Failed RUN of " + Directory + FileName + " with " + LASTERRORMSG() + SYMBOL(10) + PACKAGE(RecordSet)
                     )

    I always wrap in a VALID with an intelligent error message so I can log well.  Insert your path to the map, map settings, ECHOIN to which ever card number the dataset you want to use in the RUN map call using PACKAGE to capture initiators, terminators, delimiters etc.and override any output card settings as necessary.  I can't really tell you what your call will be becuase I don't know how your environment or the called map is expected to operate.

    If you need to do something fancy and EXTRACT the same sequence number detail records from 1 or more header/trailer sets, then the set up gets slightly more complicated.  To *me*, the easiest way of doing this is to create a new batch structure with your sequence key as the header and then your detail lines and then have that structure repeat.  Then create a functional map to EXTRACT(DetailLine, UNIQUE(SeqNum)) and create your keyed loop.  Then you can run the same process above, but now on the consolidated UNIQUE sequence number batch - you can then PACKAGE just the detail records for each Key sequence number in the RUN map call of the interim structure.
    Interim structure:

    1234

    0011234Test

    0011234Test1

    0011234Test2

    0011234Test3
    1233

    0011233Test

    0011233Test1

    0011233Test2
    0011233Test6
    1235

    0011235Test

    etc...

    Happy mapping!



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