Author |
Message
|
RocknRambo |
Posted: Tue Jul 20, 2004 6:06 am Post subject: removing special charecters in the input message |
|
|
Partisan
Joined: 24 Sep 2003 Posts: 355
|
hello everybody...
I'm trying to remove the special charecters coming in the input message, a particular element in the message can have a charecter like..
<xxx>COARSE 1/2" ° SANDING DISCS</xxx>
<xxx>6142 SUPPORT PILLAR 1.5"Ï</xxx>
the one before SANDING DISCS , at the end of the element value Ï are special charecters where my destination system does'nt need that. I need to scan the element and remove it.
can anybody give me suggestions.
thanks in advance.
-sanu |
|
Back to top |
|
 |
JT |
Posted: Tue Jul 20, 2004 7:22 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
I'm sure there are a number of elegant solutions, this isn't one of them (although it is effective):
Code: |
DECLARE Location INTEGER 1;
DECLARE current_Position INTEGER 1;
DECLARE tempBLOB BLOB;
WHILE Location > 0 DO
SET Location = POSITION(X'B0' IN SUBSTRING(InputRoot."BLOB"."BLOB" FROM current_Position));
IF Location > 0 THEN
IF tempBLOB IS NULL THEN
SET tempBLOB = SUBSTRING(InputRoot."BLOB"."BLOB" FROM current_Position FOR (Location -1));
ELSE
SET tempBLOB = tempBLOB || SUBSTRING(InputRoot."BLOB"."BLOB" FROM current_Position FOR (Location -1));
END IF;
SET current_Position = current_Position + Location;
END IF;
END WHILE;
IF tempBLOB IS NULL THEN
SET tempBLOB = InputRoot."BLOB"."BLOB";
ELSE
SET tempBLOB = tempBLOB || SUBSTRING(InputRoot."BLOB"."BLOB" FROM current_Position);
END IF; |
|
|
Back to top |
|
 |
RocknRambo |
Posted: Thu Jul 22, 2004 11:46 am Post subject: |
|
|
Partisan
Joined: 24 Sep 2003 Posts: 355
|
Thanks JT....
but with this code..I'm able to just remove the first special charecter only...the second still persisits..
<xxx>COARSE 1/2" ° SANDING DISCS</xxx>
<xxx>6142 SUPPORT PILLAR 1.5"Ï</xxx>
any suggestions...to achieve this.
thanks in advance.
-sanu[/b] |
|
Back to top |
|
 |
JT |
Posted: Thu Jul 22, 2004 12:19 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Quote: |
but with this code..I'm able to just remove the first special charecter only...the second still persisits.. |
Not if you modify the code yourself to include another loop for the second value. My intent was to supply you with an example of how this can be accomplished. The rest is now up to you.
Good luck ! |
|
Back to top |
|
 |
RocknRambo |
Posted: Thu Jul 22, 2004 1:51 pm Post subject: |
|
|
Partisan
Joined: 24 Sep 2003 Posts: 355
|
Actually, I have put my question in a wrong way...
sorry for that..
the special charecter can be anything, so I was trying to get passed all the charecters ..I mean to pass all which as ASCII values from 0 to 127,
In other words, ASCII 0 to 127 are valid charecters.
sanu |
|
Back to top |
|
 |
kirani |
Posted: Thu Jul 22, 2004 2:29 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Sanu,
This thread might help.
http://www.mqseries.net/phpBB2/viewtopic.php?t=15931 _________________ 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 |
|
 |
RocknRambo |
Posted: Wed Jul 28, 2004 6:58 am Post subject: |
|
|
Partisan
Joined: 24 Sep 2003 Posts: 355
|
Hello kirani,
the thread gave me enough help me to succeed. but I have an other pblm now.
the way I'm dealing the situation with the following code.
WHILE (CURR_POS <= TOT_LEN) DO
SET tempBLOB = SUBSTRING(InputRoot."BLOB"."BLOB" FROM CURR_POS FOR 1);
IF (tempBLOB <= X'7F') THEN ELSE
SET outputBLOB = OVERLAY(inputBLOB PLACING X'00' FROM CURR_POS FOR 1);
END IF;
SET CURR_POS = CURR_POS + 1;
END WHILE;
this doing my job, but taking huge time for processing. apprx 2-3 seconds/message.
can anybody suggest me.....for making it better processing.
thanks in advance.
sanu |
|
Back to top |
|
 |
JT |
Posted: Wed Jul 28, 2004 7:29 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Do you want to remove the invalid characters or replace them, there is a differnece? In your original posting you indicated you wanted to remove them. If I'm not mistaken it appears the code you posted is replacing the invalid values with x'00'.
If that's the case, there's a REPLACE function available in v5 that may be more efficient (don't believe it's available in v2.x).. |
|
Back to top |
|
 |
RocknRambo |
Posted: Wed Jul 28, 2004 7:40 am Post subject: |
|
|
Partisan
Joined: 24 Sep 2003 Posts: 355
|
actually, removing or replacing....either of them works for me.
I just used OVERLAY....rather then substring the spl char and concatenation with the rest.
any suggestions, which one wud be for better processing.
sanu. |
|
Back to top |
|
 |
JT |
Posted: Wed Jul 28, 2004 7:41 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Are you using v5.0 or v2.x ? |
|
Back to top |
|
 |
RocknRambo |
Posted: Wed Jul 28, 2004 8:01 am Post subject: |
|
|
Partisan
Joined: 24 Sep 2003 Posts: 355
|
I'm working on....WBIMB Version: 5.0.3 |
|
Back to top |
|
 |
JT |
Posted: Wed Jul 28, 2004 8:08 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Then take a look at the REPLACE or TRANSLATE function(s). |
|
Back to top |
|
 |
RocknRambo |
Posted: Wed Jul 28, 2004 9:55 am Post subject: |
|
|
Partisan
Joined: 24 Sep 2003 Posts: 355
|
hi JT,
I have tried with both TRANSLATE and REPLACE functions, but not luck with the processing time. |
|
Back to top |
|
 |
|