Author |
Message
|
dilse |
Posted: Thu Feb 03, 2005 2:40 pm Post subject: Converting integers into Packed Decimal format |
|
|
 Master
Joined: 24 Jun 2004 Posts: 270
|
Hi Guys,
I need ur help here. I am importing a COBOL copybook into my message set which contains two variables of type COMP-3. My input is coming as an XML and I need to convert it to MRM format.
05 PRSEQ PIC 9(0003) COMP-3.
05 PRSUB PIC 9(0007) COMP-3.
I am able to get integers from input XML but I am not able to convert these integers into COMP-3 variable. Output is showing some garbage characters when I assigned them as integers. How would I assign integer into packed decimal format. Any kind of input is appreciated.
Thanks,
DilSe.. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Feb 03, 2005 2:57 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Look at your integer and get its absolute value.
Transform into string and add qualifier for sign at the end ("F","C","D")
Left padd with 0 until you have the right length (remember total number of bytes for your packed number)
Add "0x" in front of it.
Use the Decode function. You should get a byte array representing your packed 3 number....
This will need working on a little bit but you get the general idea
Enjoy  |
|
Back to top |
|
 |
EddieA |
Posted: Thu Feb 03, 2005 4:01 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
I am not able to convert these integers into COMP-3 variable |
You shouldn't have to. If you have imported the COBOL copy book, it should have set the attributes correctly. in the MRM.
All you need do, is SET the field with the integer value.
Quote: |
Output is showing some garbage characters |
If you look at the data on the queue that's what it might appear, becasue it's not a human "readable" format.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
kirani |
Posted: Fri Feb 04, 2005 12:30 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Also, make sure you set correct CCSID and Encoding on your output message. Otherwise the receiving platform might have some problems when reading this message. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
dilse |
Posted: Fri Feb 04, 2005 6:18 am Post subject: |
|
|
 Master
Joined: 24 Jun 2004 Posts: 270
|
Thanks for all the replies. I'll try to solve it. |
|
Back to top |
|
 |
LearnMQSI |
Posted: Sun Mar 05, 2006 7:19 pm Post subject: |
|
|
 Centurion
Joined: 20 Aug 2002 Posts: 137
|
Hey Dilse,
Did you resolve your COMP-3 issue. I too have the same issue. Like you said, my input also coming from an XML but my MRM is not accepting the value in it. Actually I throw 123456789 value in one of my field, probably its taking as a string '123456789'.
I have set Physical type for this particular field is as Integer 4 but just now came to know that it has to be a Packed Decimal. I will try it and let you know in case I'm success. In the mean time if you resolved it, please let me know.
Thanks!!! _________________ IBM Certified System Administrator - WebSphere MQ 5.3 |
|
Back to top |
|
 |
|