Author |
Message
|
m.arunprasad1 |
Posted: Wed Mar 27, 2013 11:27 pm Post subject: How to remove the '-' sign when we have a negative sign |
|
|
Novice
Joined: 11 Feb 2013 Posts: 19
|
Hi
I am using Message Broker 6.0.2 version and I am generating a fixed length format message where I have got an requirement that Amount whose length is 13 digits. Whenever I receive a negative value(eg:-2500 is coming as -000000002500 where as I need as 0000000002500). Basically, I need to ignore the negative '-' sign in the output message but I am getting an '-' sign. I have highlighted the values in bold
Acutal Output Message:
Code: |
EUROX0090724100400000220000103012GB911412765 [b]-000000003000[/b][b]-000000002500[/b] 00000000[b]-000000002600[/b] |
Expected Output Message:
Code: |
EUROX0090724100400000220000103012GB911412765 [b]0000000003000[/b][b]0000000002500[/b] 00000000[b]0000000002600[/b] |
Please Help [/b] |
|
Back to top |
|
 |
praj1740 |
Posted: Thu Mar 28, 2013 1:00 am Post subject: |
|
|
 Apprentice
Joined: 05 Feb 2013 Posts: 29 Location: INDIA
|
Hi,
Use the trim function For removing negative sign when mapping the input root to output Root.
For example
Code: |
TRIM('b' FROM 'bbbaaabbb') |
returns 'aaa'. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Mar 28, 2013 1:37 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I am generating a fixed length format message |
Some questions:
- which domain are you using?
- if domain is MRM, state whether CWF or TDS
- what is the simple type of this element ( string/integer/decimal )?
praj1740: If the OP is using the MRM domain to write this message format then the field in OutputRoot might not be a string, in which case the TRIM function would not be an option |
|
Back to top |
|
 |
m.arunprasad1 |
Posted: Thu Mar 28, 2013 2:43 am Post subject: |
|
|
Novice
Joined: 11 Feb 2013 Posts: 19
|
Quote: |
Some questions:
- which domain are you using?
- if domain is MRM, state whether CWF or TDS |
I am using MRM Domain with TDS
Quote: |
- what is the simple type of this element ( string/integer/decimal )? |
I have defined the simple type as INTEGER
Solution which I tried out and is working:
In the message set, I have made the negative sign as '0' instead of '-'
Kimbert, Please let know this is a right way of acheiving the expected output? |
|
Back to top |
|
 |
kimbert |
Posted: Thu Mar 28, 2013 2:53 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
In the message set, I have made the negative sign as '0' instead of '-'
Kimbert, Please let know this is a right way of acheiving the expected output? |
So you are
- putting a negative integer value into OutputRoot.MRM
- telling the TDS parser that the field is signed
- telling the TDS parser to write the sign as '0' instead of '-'
Well, that will work, I guess. It wouldn't be my first choice, though. The straightforward solution would be
- Use the ABS function to create an unsigned value in OutputRoot.MRM
- tell the TDS parser that the number is unsigned
- set the pad character to '0' ( probably already done ) |
|
Back to top |
|
 |
|