‎2009 Jan 14 5:13 PM
Hi,
I have a variable (type c, len60) and a constant defined as:
CONSTANTS: c_valid(58) TYPE c VALUE
' !"%&()''*+-/,.=;:?_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
I want to determine a condition in the program,
If variable contains any char other than those in c_valid,
variable = some constant value
I think this can be done using CO operator but not sure about how to use it,
Pleas help me code this condition,
Thanks,
CD
‎2009 Jan 14 5:19 PM
IF field CO c_valid.
<do something>
ELSE.
<do something else>
ENDIF.
‎2009 Jan 14 5:19 PM
IF field CO c_valid.
<do something>
ELSE.
<do something else>
ENDIF.
‎2009 Jan 14 5:24 PM
Thanks for the reply,
I always get confused with CO operator,
Will it do the complete comparision or go charcter by charcter..
‎2009 Jan 14 5:32 PM
It will ensure that every character in the "Field" is contained within your constant value. If any character is not in the constant wil will get a FALSE response on the IF.
‎2009 Jan 14 6:16 PM
It aint working,
this what i tried:
data: title(60) TYPE c.
CONSTANTS: c_valid(58) TYPE c VALUE
' !"%&()''*+-/,.=;:?_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
IF NOT title CO c_valid.
title = 'works'.
ENDIF.
But this condition is true for all the cases, am i doing something wrong here,
Here are the examples i've used:
The 48 laws of power
Inglés intermedio
‎2009 Jan 14 6:25 PM