Author |
Message
|
Sachin20 |
Posted: Tue Sep 09, 2014 7:07 am Post subject: Replace null character in mapping node in V8. |
|
|
Newbie
Joined: 15 Nov 2009 Posts: 5
|
Hi,
I am using graphical data mapping node to transform cobol to xml. one of the copybook field i am getting null character. I need to replace with 0 and tried below and did not replace null characters.
custom xpath
fn:replace($AMT,'NUL','0')
fn:replace($AMT,'<NUL>','0')
fn:replace($AMT,NULL,'0').
Please share your thoughts. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Sep 09, 2014 7:12 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You should adjust the incoming message model (DFDL or MRM) to do this replacement for you. |
|
Back to top |
|
 |
Sachin20 |
Posted: Tue Sep 09, 2014 9:54 am Post subject: |
|
|
Newbie
Joined: 15 Nov 2009 Posts: 5
|
I selected check box for Recognize null values for all fields when i defined message model for cobol data. did not help. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Sep 09, 2014 10:56 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Sachin20 wrote: |
I selected check box for Recognize null values for all fields when i defined message model for cobol data. did not help. |
You should probably try something else then.......
I wonder if there's more than one option you can specify.
I wonder if (as it's v if you're using DFDL or MRM? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Sep 10, 2014 6:13 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
So your input format allows null characters ( 0x00 ) but the output format ( XML ) does not. You need to translate the null characters to a valid character, or else remove them.
DFDL and MRM cannot perform character substitutions on string values - that is the task of a transformation language, not a parser.
I suggest that you do this in ESQL or Java if you cannot make the Mapping node do what you require. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
Sachin20 |
Posted: Wed Sep 10, 2014 6:50 am Post subject: |
|
|
Newbie
Joined: 15 Nov 2009 Posts: 5
|
|
Back to top |
|
 |
martinb |
Posted: Fri Sep 12, 2014 12:08 am Post subject: |
|
|
Master
Joined: 09 Nov 2006 Posts: 210 Location: UK
|
A new topic was added to the IIB v9 Knowledge Center "Handling nulls in message maps".
You need to confirm if your model defines the field as nillable, if so you can detect the nilled value using the fn:nilled() function in the map. If it's not then it's likely the NULL value will be represented as an empty field. Assuming a character type, you could use a test for empty string in a map using,
So to transform this in a Graphical Map you can use an If Else transform with a condition on the input value and either use a Move transform to pass the valid value to your target XML, or an Assign transform to set the required value when the input is NULL
Note Alternatively if the target XML element was modeled as nillable, then setting it from a nilled source would create an empty XML element with the xsi:nil attribute set to true. |
|
Back to top |
|
 |
|