Posted: Fri Apr 25, 2003 9:17 am Post subject: checking Hex values!!
Acolyte
Joined: 04 Jan 2002 Posts: 65 Location: usa
Hi,
I would like to check if an element with 10 chars contains hex values from A1 to A9 delete that char and generate a new element.
I would appreciate help in writing ESQL
DECLARE STR_IN = CAST(<input hexa value>); --you will get a string value: X'hhhh'
DECLARE POS INT;
DECLARE POS_H INT;
DECLARE I INT;
I = 1;
WHILE I <= 9 DO
POS = 0;
POS = POSITION( (A || CAST(I AS CHAR)) IN STR_IN);
POS_H = POS/2;
IF(POS > o AND (2*POS_H = POS)) THEN --You mast check every 2 characters
--generate yor output when
END IF;
SET I=I+1;
END WHILE;
You will need modify this code according your requirments.
If you only need recognize A1 - A9 in input element, you can use some flag.
If you need to replase those values from element -use SUBSTRING.
use CAST AS BLOB in case you output also hexadecimal...
Hope it will help _________________ Best regards.
Yaakov
SWG, IBM Commerce, Israel
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