Author |
Message
|
sitkpw |
Posted: Wed Dec 16, 2009 4:20 pm Post subject: Error converting AS400 packed field using VB |
|
|
Newbie
Joined: 16 Dec 2009 Posts: 2
|
I have problems retrieving packed decimal field sent from AS400 using VB. I manage to convert it but the amount is incorrect. Have created a function using C and call the function from my program. I have tried calling that function by using C and it works fine but when it's call by VB, the result return incorrectly.
I have search for the solution, I have saw a post that saying that "you must not be using a native data retrieval method". May I know how should I retrieve it as in my mq msg I have both normal string and packed decimal field.
Can I retrieve it using binary? If yes, how should I get start? |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Dec 16, 2009 5:13 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Well if your message contains String data and non String data (i.e. packed decimal formats) you have to send the message as a byte message or MQFMT_NONE....
You will then need to retrieve the bytes for the packed decimal at the right position, for the right length.
You may have to adjust for endian-ness (byte order).
You know of course what the representation of the packed decimal is like at the byte level...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
sitkpw |
Posted: Wed Dec 16, 2009 6:24 pm Post subject: |
|
|
Newbie
Joined: 16 Dec 2009 Posts: 2
|
Don't really get you, what do you mean with MQFMT_NONE? I'm using MQ standard procedure. Please help as I need it urgently. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Dec 16, 2009 6:54 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
sitkpw wrote: |
Don't really get you, what do you mean with MQFMT_NONE? |
If the message isn't a string (because it contains packed decimal data) then you can't use any of the built in formats. Hence MQFMT_NONE.
sitkpw wrote: |
I'm using MQ standard procedure. |
No such thing. WMQ applications do what you code them to do. The only notice WMQ takes of message content is converting strings from one code page to another, if strict conditions are met.
sitkpw wrote: |
Please help as I need it urgently. |
Then you need help from IBM, or the services of a qualifed professional. We're just a bunch of concerned volunteers with no SLA on our responses. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu Dec 17, 2009 6:32 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
WMQ supports a user-created data conversion utility for such mixed-format messages. The utility is installed on the receiver-end. The creating application places the utility name in the MQMD format field.
Search WMQ APR and APG fro data conversion. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
bruce2359 |
Posted: Sat Dec 26, 2009 10:06 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Packed-decimal is one of the supported data types in WMQ.
Read the Packed-decimal-integer encoding section of the WMQ APR manual. MQENC_DECIMAL_NORMAL identifies packed-decimal data type. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
markiecork |
Posted: Mon Apr 19, 2010 3:14 am Post subject: |
|
|
Newbie
Joined: 18 Apr 2010 Posts: 4
|
I have also problem so I have tried with WMQ.
BUT the problem was not solved.
I got error using WMQ. _________________ r4 dsi |
|
Back to top |
|
 |
bruce2359 |
Posted: Mon Apr 19, 2010 5:33 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Quote: |
I got error using WMQ. |
Any details you care to share with us? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
gbaddeley |
Posted: Mon Apr 19, 2010 3:28 pm Post subject: Re: Error converting AS400 packed field using VB |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
sitkpw wrote: |
I have problems retrieving packed decimal field sent from AS400 using VB. I manage to convert it but the amount is incorrect. Have created a function using C and call the function from my program. I have tried calling that function by using C and it works fine but when it's call by VB, the result return incorrectly. |
Are you able to post the C code and the VB code? We may be able to spot the difference in functionality.
Quote: |
I have search for the solution, I have saw a post that saying that "you must not be using a native data retrieval method". May I know how should I retrieve it as in my mq msg I have both normal string and packed decimal field. |
In general, do not mix printable data and non-printable characters (eg. packed decimal?) in MQ message data and then set MQMD.Format = MQFMT_STRING. The results will probably be inconsistent and unexpected when MQ does automatic conversion between CCSIDs.
Its easier to use unpacked decimal formats (ie. pure numeric digits, signs and symbols) if its going to be mixed with other printable characters in the same MQ message. The alternative is lots of parsing and data marshalling, which is slow, messy and error prone. _________________ Glenn |
|
Back to top |
|
 |
bruce2359 |
Posted: Mon Apr 19, 2010 4:07 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Quote: |
non-printable characters (eg. packed decimal?) |
Unprintable?? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
|