ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Making a PACKED field = STRING

Post new topic  Reply to topic
 Making a PACKED field = STRING « View previous topic :: View next topic » 
Author Message
lung
PostPosted: Mon Feb 09, 2004 10:39 pm    Post subject: Making a PACKED field = STRING Reply with quote

Master

Joined: 27 Aug 2002
Posts: 291
Location: Malaysia

Okay, in my previous post, I have managed to convert from a PACKED field to a STRING field, successfully.

But now I'm trying to achieve the opposite way round, and am having some complications.

Let's say fieldA is a packed value of '123456', hence it will appear as '4V' in string. But what if I want it to appear as '123456' in string?

Eg.

SET fieldB = CAST(fieldA AS CHAR CCSID 500);

Thus, fieldB = '4V'

To make fieldB = '123456' instead, I've tried the following code

SET fieldB = CAST(fieldA AS CHAR);

And fieldB becomes 'X'123456'' (note: with the X in the string!)

How do I remove this 'X' thingy from my string?

I hope you all get what I'm trying to say here...
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
kirani
PostPosted: Mon Feb 09, 2004 11:11 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Lung,

Try following code ..
Code:

DECLARE fieldB BLOB;
SET fieldB = CAST (fieldA as BLOB CCSID InputProperties.CodedCharSetId);


This will store X'123456' into fieldB
_________________
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
View user's profile Send private message Visit poster's website
lung
PostPosted: Tue Feb 10, 2004 1:27 am    Post subject: Reply with quote

Master

Joined: 27 Aug 2002
Posts: 291
Location: Malaysia

kirani, thanks for the reply, but I think you misunderstood what I meant.

My fieldB is supposed to be a STRING variable. I do not want to store the value in hex format, as it is already in hex format in fieldA.

Assume this code...

DECLARE fieldA CHAR;
DECLARE fieldB CHAR;
SET fieldA = CAST(x'123456' AS CHAR CCSID 500);
-- In which case, fieldA = '4V';
SET fieldB = CAST(fieldA AS BLOB CCSID 500);
-- Will give me error since fieldB is a CHAR type variable

Now what is the syntax to use, if fieldB is to be assigned a STRING value of '123456'?
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
jefflowrey
PostPosted: Tue Feb 10, 2004 4:09 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

lung wrote:
Now what is the syntax to use, if fieldB is to be assigned a STRING value of '123456'?

Code:
declare fieldB CHAR;
set fieldB = '123457';

or
Code:
declare fieldA CHAR;
declare fieldB CHAR;

set fieldA = CAST(x'123456' as CHAR CCSID 500);
set fieldB = CAST(CAST(fieldA as BLOB CCSID 500) as CHAR); --no CCSID on the outer cast!
set fieldB = SUBSTRING(fieldB from 3 to (length(fieldB) - 1));

That might need to be from 2 instead of from three. The basic idea is to get rid of the "x'" and closing ' on the string.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
lung
PostPosted: Tue Feb 10, 2004 8:06 pm    Post subject: Reply with quote

Master

Joined: 27 Aug 2002
Posts: 291
Location: Malaysia

Thanks, Jeff. I've tried your solution, and it works!

However, a much serious problem has arisen.

You see, after I managed to get fieldB to display the STRING I wanted, I tried the following code.

SET OutputRoot.MRM.FieldC = fieldB;

In my MRM, FieldC is defined as Packed Decimal, Signed.

Now somehow, whenever the message reaches the OutputNode, MQSI will generate a coredump. The coredump causes the broker to hang in a suspended state, not picking up any new messages. All deployment will fail. Only solution I found so far is to stop and start the broker. Any ideas on how to fix this?

Here is part of the system dump as seen in the system log...

Code:
IEA995I SYMPTOM DUMP OUTPUT 193                                 
SYSTEM COMPLETION CODE=0C4  REASON CODE=00000011                 
 TIME=11.40.15  SEQ=02049  CPU=0000  ASID=00A4                   
 PSW AT TIME OF ERROR  078D0400   F72AC4DE  ILC 4  INTC 11       
   ACTIVE LOAD MODULE           ADDRESS=77200000  OFFSET=000AC4DE
   NAME=SPECIALNAME                                             
        61A4A299 61939797 61A69498 89619389 */usr/lpp/wmqi/li*   
        9361D4A3 89C99482 D78199A2 85994B93 *l/MtiImbParser.l*   
        8993                                *il              *   
   DATA AT PSW  772AC4D8 - 90185000  D1885821  EFE41222         
   AR/GR 0: 8C31375A/13F5EDE8   1: 00000000/FFFFF008             
         2: 00000000/11974CC0   3: 00000000/0E2B3948             
         4: 00000000/772AC19C   5: 00000000/772C9470             
         6: 00000000/00000000   7: 00000000/16CFD0E8             
         8: 00000000/00017E10   9: 00000000/13F5EDD0             
         A: 00000000/00018770   B: 00000000/772C95BC             
         C: 00000000/0E2AA200   D: 00000000/0E2B3980             
         E: 0E2B36CC/00000000   F: 0B050E18/773C8178
 END OF SYMPTOM DUMP


By the way, the broker resides in an OS/390 system.

So all the experts out here... Please help. What is the cause of the coredump? And how do I fix it (other than restarting the broker)?

Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
EddieA
PostPosted: Wed Feb 11, 2004 12:37 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
FieldC is defined as Packed Decimal, Signed.

In which case, you didn't need to do any of this:

SET OutputRoot.MRM.FieldC = 123456 and the MRM will convert it to PD.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Making a PACKED field = STRING
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.