|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
esql cast decimal to character |
« View previous topic :: View next topic » |
Author |
Message
|
Thomas2ab |
Posted: Thu Apr 02, 2015 5:35 am Post subject: esql cast decimal to character |
|
|
Acolyte
Joined: 07 Mar 2014 Posts: 51
|
Hello everyone,
I am trying to implement to following rule using the cast esql function.
I have a mandatory decimal (from xsl) input and needs to set a string at the output with a specific format.
The output length always have to be 18.
The integer part has a length of 10 and the decimal a length of 8.
So if the input is 0 the output would be 000000000000000000 (as string)
If the input is 1 the output would be 000000000100000000 (as string)
If the input is 1.1 the output would be 000000000110000000 (as string)
If the input is 123456.78 the output would be 000012345678000000 (as string)
etc.
I saw about the '#' pattern within the cast function but I am not sure it could work in that case.
What would be the adequate pattern for that?
Thanks,
Regards, |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Apr 06, 2015 5:18 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You shouldn't populate the logical message tree with physical formatted data.
You should use the output model to transform the logical message into the correct physical message. |
|
Back to top |
|
 |
Thomas2ab |
Posted: Mon Apr 06, 2015 6:05 am Post subject: |
|
|
Acolyte
Joined: 07 Mar 2014 Posts: 51
|
Thank you but what does that mean technically/programatically?
Regards, |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Apr 06, 2015 6:08 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Thomas2ab wrote: |
Thank you but what does that mean technically/programatically?
Regards, |
That is as technical/programmatic as I can get.
Inside a message flow, all of your code works with a logical message tree, that does not have information about the physical construction of the data that is being proccesed.
It is only when the data is parsed or serialized by a message model (a DFDL model, and XML Schema, etc.) that the physical format is interpreted or used to write out data.
So if you want the output string to be 18 characters in length, then you construct your model to indicate that. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Apr 06, 2015 6:41 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Thomas2ab wrote: |
Thank you but what does that mean technically/programatically? |
It means you should (ideally) build the output character string in the model to reflect your desired output or CAST the final output sting rather than the intermediate decimal.
If I'm reading the requirement correctly, you can't do that in a single CAST and would need either a few lines of ESQL or an output message field 18 characters across with an implied decimal point. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|