WebSphere Transformation Extender excels at rapid, independent processing. There is a special thrill to dropping 1000 files into a directory and seeing 1000 perfectly formatted messages almost instantly appear in an output queue. But there are times when we’d prefer to see 1000 files drop into a directory and see a single file or email or message emerge on the other side. While there are times this can be accomplished by continually appending, this can cause file contention and it can’t be done with e-mails or MQ messages. So let’s look at a way to get true batch processing implemented in WTX.
To motivate our exercise, let’s look at a high-powered executive named Santa R. Claus, who heads up a large import-export business. When you are the recipient of millions of rambling, crayon-written client letters, a tidy executive summary is a necessity. Luckily WTX is well equipped to scan though the mountains of letters and return a single report.
Although this solution will scale up to the millions needed, we start with a sampling of four letters from four high profile clients: Johnny, Timmy, Brooke and Jenny. They are located in a single directory. Here’s Jenny’s:
We feed each line into a functional map. Note at this point we can’t access the content of each file, only the file name. To overcome this, we need to use a simple run map command, calling a map called ExtractData.mmc, while overriding the input file (using the –IF1 command) and echoing back the formatted output (using the –OE1 command).
=RUN("ExtractData.mmc", "-IF1 InputFiles\" + FileName + " -OE1 -AE" )