on 06-14-2005 12:38 AM
Hi Everyone,
I have to display something like this
the var TNAME TYPE
/BIC/ADEO_0100 A ( If it ends with 00)
/BIC/ADEO_0140 N ( IF it ends with 40)
so in my if condition i specified like this
If TNAME = '/BIC/A%00
TYPE = 'A'.
But it does display anything, the usual one '/BIC/A' works but my requirement is as explained. How do I achieve this result. Any help will be of great help.
Thanks,
Prabhu.
If you are only considering the two values(/bic/adeo_0100 and /bic/adeo_0140) given in your post, you could do something like this.
data: tname(30) type c value '/bic/adeo_0140'.
data: type(1) type c.
if tname cs '00'.
type = 'A'.
elseif tname cs '40'.
type = 'N'.
endif.
Write:/ type.
Regards,
Rich Heilman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is another solution.....
I like this one better cause its looking directly at the last 2 characters of the value.
data: tname(30) type c value '/bic/adeo_0140'.
data: type(1) type c.
data: length type i.
length = ( strlen( tname ) - 2 ).
case tname+length(2).
when '00'.
type = 'A'.
when '40'.
type = 'N'.
endcase.
If this needs to be an IF statement...
data: tname(30) type c value '/bic/adeo_0140'.
data: type(1) type c.
data: length type i.
length = ( strlen( tname ) - 2 ).
IF tname+length(2) = '00'.
type = 'A'.
ElseIf tname+length(2) = '40'.
type = 'N'.
EndIf.
Hope this helps.
Regards,
Rich Heilman
Hi Rich,
Thanks for the reply, but this information data is from a table, and i want to display the tname which <b>ends</b> with zero zero as the type 'N' and the tname which ends with 40 as 'A'.
which of the string operations will be much suitable. Any help will be of great to me.
Thanks,
Prabhu.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.