Author |
Message
|
sirsi |
Posted: Thu May 18, 2006 9:26 am Post subject: REPLACE function |
|
|
Disciple
Joined: 11 Mar 2005 Posts: 177
|
I want to remove '~~' ( x'7e7e' ) from a blob string. For that i am using
RELACE( <input_blob>, <remove_blob>)
input_blob = blob string
remove_blob = x'7E7E'
My problem is the above REPLACE function is not removing x'7E7E' its actually replacing x'7E7E' with x'00' and x'01' , which are NULL and SOH respectively. Any idea why this is happening?
I am running on WBIMB v5 |
|
Back to top |
|
 |
dsriksha |
Posted: Thu May 18, 2006 10:06 am Post subject: Re: REPLACE function |
|
|
 Voyager
Joined: 27 Feb 2005 Posts: 95
|
We can assume that if Hex values or changing means its an issue with CCSID. So you need a function that can be applied with CCSID. Forgive me if this is not true.
Last edited by dsriksha on Thu May 18, 2006 12:27 pm; edited 1 time in total |
|
Back to top |
|
 |
JT |
Posted: Thu May 18, 2006 10:36 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Post the exact REPLACE statement as it exists in your code. |
|
Back to top |
|
 |
sirsi |
Posted: Thu May 18, 2006 11:52 am Post subject: |
|
|
Disciple
Joined: 11 Mar 2005 Posts: 177
|
thanks for the reply guys...
here is the code...
DECLARE remove_blob BLOB X'7E' || X'7E';
SET OutputRoot.BLOB.BLOB = replace(InputRoot.BLOB.BLOB, remove_blob) ;
according to esql pdf:
Quote: |
If you do not specify the replace string expression, the replace string defaults to an empty string and the behavior of the function is to delete all occurrences of the search string from the result. |
but in my case its not deleting |
|
Back to top |
|
 |
dsriksha |
Posted: Thu May 18, 2006 12:31 pm Post subject: |
|
|
 Voyager
Joined: 27 Feb 2005 Posts: 95
|
sirsi wrote: |
DECLARE remove_blob BLOB X'7E' || X'7E';
|
Try by modifying above statements with your Input message CCSID.
BTW, dont do any
Code: |
SET OutpuRoot= InputRoot or Copy Entire message |
 |
|
Back to top |
|
 |
sirsi |
Posted: Thu May 18, 2006 12:59 pm Post subject: |
|
|
Disciple
Joined: 11 Mar 2005 Posts: 177
|
Hi dsriksha,
I tried your method but that also doesnt work. My problem is not with x'7E7E', the REPLACE function is able to identify x'7E7E' properly... but it s not deleting it.
i even tried :-
SET OutputRoot.BLOB.BLOB = replace(InputRoot.BLOB.BLOB, remove_blob,cast('' as blob)) ;
this also gives the same result ( x'0001' ) |
|
Back to top |
|
 |
dilse |
Posted: Thu May 18, 2006 1:10 pm Post subject: |
|
|
 Master
Joined: 24 Jun 2004 Posts: 270
|
sirsi,
There is a method with which you can accomplish your task but it may not be effective. Here it is.
Try to convert your BLOB to STRING and then use the REPLACE function and then convert back to BLOB. |
|
Back to top |
|
 |
sirsi |
Posted: Thu May 18, 2006 1:14 pm Post subject: |
|
|
Disciple
Joined: 11 Mar 2005 Posts: 177
|
well i thought of this to do... but didnt feel like proper way to do. If REPLACE can take BLOB as input than it should work as mentioned.
Will give a try though. |
|
Back to top |
|
 |
dilse |
Posted: Thu May 18, 2006 1:30 pm Post subject: |
|
|
 Master
Joined: 24 Jun 2004 Posts: 270
|
I suggested this because earlier I used TRIM function on BLOB but it was not working even though I used CCSID on it. So I had to convert it to CHAR and convert back to BLOB.
This is just another way... |
|
Back to top |
|
 |
sirsi |
Posted: Thu May 18, 2006 1:35 pm Post subject: |
|
|
Disciple
Joined: 11 Mar 2005 Posts: 177
|
oh Man... got it...
the problem is not with REPLACE function its with my incoming data...
the data sometimes comes with x'0001' and sometimes not... should have checked it out...
sorry for wasting your time guys...
Thanks all for replying |
|
Back to top |
|
 |
|