substitue of values.

$db2 connection ...........Q

a=`$db2 -x "select A from tablename where z in (select z from tablename Q where condition fetch first 1 rows only ) with ur"`
b=`$db2 -x "select B from tablename where z in (select z from tablename Q where condition fetch first 1 rows only) with ur"`

$db2 connection ...........W

c=`$db2 -x "select C from tablename W where R in ('$a') with ur"`

this is a part in my script.

The problem is the value of a is not getting substituted in '$a'. Please help.

There is nothing in what you posted which would seem to disable variable expansion. Indeed, you can test it on the command line:

vnix$ db2=echo
vnix$ a=`$db2 -x "select A from tablename where z in (select z from tablename Q where condition fetch first 1 rows only ) with ur"`
vnix$ c=`$db2 -x "select C from tablename W where R in ('$a') with ur"`
vnix$ set | grep ^c=
c='-x select C from tablename W where R in ('\''-x select A from tablename where z in (select z from tablename Q where condition fetch first 1 rows only ) with ur'\'') with ur'

Thx a lot for trying to help me.

Now i have rectified that mistake.

can we use substr for the decimal type of data?

I get Error like this
SQL0440N No authorized routine named "SUBSTR" of type "FUNCTION" having
compatible arguments was found. SQLSTATE=42884