Search & Replace Last Digit

SKaushal

New Member
Hi Everybody,

Problem: I have to change the last digit of a negative number as follows:

if a negative number ends in "0" then change last digit to "}"
if a negative number ends in "1" then change last digit to "K"
and so on..................

e.g if negative number is " - 34.01" THEN it should be like " - 34.0K"

Help me out Please.

Thanx
 
U

Unregistered

Guest
I have something similar, you may be able to make changes to this idea as you see fit. The call would look like this:

def var v-char as char.
v-char = "34.01".
{x.i v-char}
display v-char.


/* x.i converts negative ebcdic to ascii */

if index('}JKLMNOPQR', substr({1},length({1}),1)) <> 0
then
substr({1},length({1})) =
string(
index('}JKLMNOPQR', substr({1},length({1}),1)) - 1
) + '-'.
 
Top