Originally posted by: paul.brett
In the Example1.java code installed with the WTX Design Studio, the resulting class expects to find the test1.mmc file in the current directory.
Sure you can hard code an alternative, by changing:
MMap map = new MMap("test1.mmc");
to
MMap map = new MMap("Y:\\Maps\\test1.mmc");
...for example.
But then the code has to be re-compiled if the directory structure of project changes, and the maps are moved to a different location.
An alternative is to read an operating system variable, and append to that, the sub folder (if required) and name of the map.
I have executed:
set maproot=y:\maps
...and then the enclosed example, produces:
Map status: Map completed successfully (0)
...if the maps and input file are located in the Y:\Maps\ directory.
The key lines changed are:
String value = System.getenv("MAPROOT");
and
MMap map = new MMap(value+"\\Test1.mmc");
You could always use this technique to grab the map suffix (.aix, .lnx, .sun etc) from an environment variable.
Thank-you.
Paul.
Follow me on Twitter
#IBM-Websphere-Transformation-Extender#IBMSterlingTransformationExtender#DataExchange