Originally posted by: Liv2luv
I am trying to develop a map which contains two Input cards. Input Card 1 passes some values and Input Card 2 passes another set of elements into the OutPut card.
Problem is there is a loop (for same number of times) in the Input and Output cards in which sub-string of the output card has to be updated based on the input cards. While this is the problem abstract, I will try to explain by a simple example:
Following is how Input card 1 (ic1) data looks like :
1. Id element in response is unique and need to be matched with Input card 2 (ic2) Request element value at offset 5
2. Considering Id matches - Value1, Value2 and Value3 to be SUBSTITUTED at offset 10, 15 and 20 respectively
<?xml version=
"1.0" encoding=
"UTF-8"?> <Response> <Header> <Looptimes>3</Looptimes> <SomeElement>blah!</SomeElement> <AnotherElement>blah!!</AnotherElement> </Header> <ResponseDetail> <!-- Response element repeats
for 3 times as indicated by the value of Looptimes --> <!-- Id has a unique value --> <Response> <Id>Q</Id> <Value1>ABC</Value1> <Value2>XYZ</Value2> <Value3>FGK</Value3> </Response> <Response> <Id>T</Id> <Value1>123</Value1> <Value2>YOK</Value2> <Value3>DSL</Value3> </Response> <Response> <Id>G</Id> <Value1>SLT</Value1> <Value2>TKR</Value2> <Value3>LAF</Value3> </Response> </ResponseDetail> </Response>
Input Card 2 (ic2) data looks like:
<?xml version=
"1.0" encoding=
"UTF-8"?> <Request> <Header> <Looptimes>3</Looptimes> <SomeElement>blah!</SomeElement> <AnotherElement>blah!!</AnotherElement> </Header> <RequestDetail> <!-- Request Element is a string of fixed length (50 characters) --> <Request>THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG AGAIN!</Request> <Request>THE TIME FOX JUMPED OVER THE LAZY DOG, PROGRESSED!</Request> <Request>OWING TO THE WIDESPREAD KNOWLEDGE OF THE PHRASE AN</Request> </RequestDetail> </Request>
Output card (oc1) data needs to look like (Expected result):
<?xml version=
"1.0" encoding=
"UTF-8"?> <Response> <Header> <Looptimes>3</Looptimes> <SomeElement>blah!</SomeElement> <AnotherElement>blah!!</AnotherElement> </Header> <ResponseDetail> <!-- Some text needs to be SUBSTITUTED from
'ic1' based on Id value at offset 5 of the response element value --> <Response>THE QUICKABCOWXYZOXFGKMPS OVER THE LAZY DOG AGAIN!</Response> <Response>THE TIME 123 JYOKEDDSLER THE LAZY DOG, PROGRESSED!</Response> <Response>OWING TO SLT WTKRSPLAFD KNOWLEDGE OF THE PHRASE AN</Response> </ResponseDetail> </Response>
The need is to get the result updated with value1, value2 and value3 element valuesat offset 10, 15 and 20 respectively.
What function I need to use to match the Id value with offset 5 and update other values accordingly? Thank you for the help.
#DataExchange#IBMSterlingTransformationExtender#IBM-Websphere-Transformation-Extender