priyanthan
Programmer
Can someone tell me a way to Convert a Decimal number to hex number.
Working with DB2 and CR 8.5.
Thanks.
Working with DB2 and CR 8.5.
Thanks.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
whileprintingrecords;
numbervar v_decimal := {yournumericfield);
stringvar v_hex;
stringvar v_hex2;
numbervar v_digit;
v_digit := v_decimal/16;
v_hex := totext((v_digit - floor(v_digit)) * 16,"#",0);
select v_hex
case "10": v_hex := "A"
case "11": v_hex := "B"
case "12": v_hex := "C"
case "13": v_hex := "D"
case "14": v_hex := "E"
case "15": v_hex := "F"
default: v_hex;
while floor(v_digit) > 0
do
(
v_digit := floor(v_digit)/16;
v_hex2 := totext((v_digit - floor(v_digit)) * 16,"#",0);
select v_hex2
case "10": v_hex2 := "A"
case "11": v_hex2 := "B"
case "12": v_hex2 := "C"
case "13": v_hex2 := "D"
case "14": v_hex2 := "E"
case "15": v_hex2 := "F"
default: v_hex2;
v_hex := v_hex + v_hex2);
strreverse(v_hex)