09-23-2008 6:34 AM
Hi All there,
I want to skip last digit in one of varibale how to do that?
e.g. var = 10
I want to take var = 1
Regards
Sagar
09-23-2008 6:39 AM
Hi
you can use command SHIFT.. in your case you can SHIFT your vairable to LEFT by 1 position.
09-23-2008 6:37 AM
Suppose length of your variable is N .Then create another variable V2 and follow the below statement.
V2 = V1+0(N-1).
It'll work.
09-23-2008 6:39 AM
Hi
you can use command SHIFT.. in your case you can SHIFT your vairable to LEFT by 1 position.
09-23-2008 6:39 AM
If its a numeric variable without decimals, you can just divide it by 10.
09-23-2008 6:40 AM
09-23-2008 6:41 AM
hii
use following code
data:
var(3) type c value 'def',
ofset(3) type c,
sub type i,
var1 type i.
var1 = strlen( var ).
sub = var1 - 1.
ofset = var+0(sub).
write var1.
write ofset.
regards
twinkal
09-23-2008 6:42 AM
Hi Sagar,
Try this way :
Data:
VAR type i value 10.
VAR = VAR Div 10.
Write 😕 VAR.
Regards,
Swapna.
09-23-2008 6:53 AM
Hi,
plz write the code this way , it will surely work.
data: var1 type string.
var1 = '10'.
shift var1 right deleting trailing '0' .
write: var1.
thanx.
09-23-2008 7:13 AM
Hi,
All the above mentioned codes will require data type conversion. However heres a direct approach.
1. divide by 10
2. Use the arithmatic function trunc to get the integer value.
Hope this helps,
Kind Regards,
Rajat
09-23-2008 3:01 PM
Just shift the variable 1 place right to achieve this.
Regards
Farzan