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 » Substring fixlength msg error.Why?

Post new topic  Reply to topic
 Substring fixlength msg error.Why? « View previous topic :: View next topic » 
Author Message
nheng
PostPosted: Mon Aug 17, 2009 2:55 am    Post subject: Substring fixlength msg error.Why? Reply with quote

Apprentice

Joined: 07 Dec 2007
Posts: 39

Messageflow description:------------------------------
InputNode: No fix format message domain
ResetContent Desciptor:Set blob format
Compute node:Substring of Fixmsg and propagate it each row.


Example Msg.---------------------------------------------------
82276920000077135933W FOUR P'S CLOTHING CO.,LTD.
COTTMCP09072184100345 I'M CURIO CO.,LTD.
82276920000077135933W PLz help me.


**Shotcut message
esql:---------------------------------------------------

DECLARE STR BLOB InputRoot.BLOB.BLOB;
DECLARE TMP BLOB InputRoot.BLOB.BLOB;
DECLARE CNT INTEGER 0;
DECLARE MAXINT INTEGER;
IF LENGTH(STR) > 200 THEN
SET MAXINT = LENGTH(STR) / 202;
IF MOD(LENGTH(STR),202) = 200 THEN
SET MAXINT = MAXINT + 1;-- Do on the last line
END IF;
ELSE
SET MAXINT = 0;
IF LENGTH(STR) = 200 THEN
SET MAXINT = 1;
END IF;
END IF;

WHILE CNT < MAXINT DO -- If it has EOL at the end of line use this method
CALL CopyMessageHeaders();
SET TMP = SUBSTRING(STR FROM (CNT*200) + (CNT*2) + 1 FOR 200);
SET OutputRoot.BLOB.BLOB = TMP;
PROPAGATE;
SET CNT = CNT + 1;
END WHILE;
RETURN FALSE;

---------------------------------------------------
Result:I will got only third line in output node



Please help me.
Back to top
View user's profile Send private message MSN Messenger
Luke
PostPosted: Mon Aug 17, 2009 6:19 am    Post subject: Reply with quote

Centurion

Joined: 10 Nov 2008
Posts: 128
Location: UK

I'm struggling to determine exactly what your code is trying to do here.

Are these 200 byte records, separated by carriage return/line feed?

Why do you need to use the MOD function? The code seems over complicated to start with, so I'd try and simplify it if I were you. Get the length of the input, use a pointer for your FROM in the substring and increment it each time you loop until your pointer >= length of input.

Alternatively, maybe build a very simple TDS model with CR/LF as delimeter? Or even a CWF model?

If you have to do it manually, I'd re-write the code, then use trace or debug if you still have problems to see what's happening with your values.

Cheers
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Aug 17, 2009 10:34 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Please describe the format of your input message.
Back to top
View user's profile Send private message
nheng
PostPosted: Mon Aug 17, 2009 6:25 pm    Post subject: hi Reply with quote

Apprentice

Joined: 07 Dec 2007
Posts: 39

kimbert wrote:
Please describe the format of your input message.

82276920000077135933W FOUR P'S CLOTHING CO.,LTD.
COTTMCP09072184100345 I'M CURIO CO.,LTD.
82276920000077135933W PLz help me.

This is input msg.Length of row equal 200 and plus 2( For enter charactor)
Back to top
View user's profile Send private message MSN Messenger
nheng
PostPosted: Mon Aug 17, 2009 6:32 pm    Post subject: Reply with quote

Apprentice

Joined: 07 Dec 2007
Posts: 39

Luke wrote:
I'm struggling to determine exactly what your code is trying to do here.

Are these 200 byte records, separated by carriage return/line feed?

Why do you need to use the MOD function? The code seems over complicated to start with, so I'd try and simplify it if I were you. Get the length of the input, use a pointer for your FROM in the substring and increment it each time you loop until your pointer >= length of input.

Alternatively, maybe build a very simple TDS model with CR/LF as delimeter? Or even a CWF model?

If you have to do it manually, I'd re-write the code, then use trace or debug if you still have problems to see what's happening with your values.

Cheers



This code can work without problem when the message hasn't single quote.

I know what do u try to tell mee about what do u think.But your answer not help anything.


Thank for help.
Back to top
View user's profile Send private message MSN Messenger
sebastianhirt
PostPosted: Mon Aug 17, 2009 11:30 pm    Post subject: Re: Substring fixlength msg error.Why? Reply with quote

Yatiri

Joined: 07 Jun 2004
Posts: 620
Location: Germany

nheng wrote:
Messageflow description:------------------------------
InputNode: No fix format message domain
ResetContent Desciptor:Set blob format
Compute node:Substring of Fixmsg and propagate it each row.



Example Msg.---------------------------------------------------
82276920000077135933W FOUR P'S CLOTHING CO.,LTD.
COTTMCP09072184100345 I'M CURIO CO.,LTD.
82276920000077135933W PLz help me.



The MRM (TDS) parser is your friend. Should make things somewhat easier.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Aug 18, 2009 1:21 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I know what do u try to tell mee about what do u think.But your answer not help anything.
I think Luke's answer was very good. Either fix your code ( we are not going to do that for you ), or let the TDS parser take the strain.
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 » Substring fixlength msg error.Why?
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.