View previous topic :: View next topic
|
Author |
Message |
kaos
New User
Joined: 24 Apr 2007 Posts: 9 Location: Bangalore
|
|
|
|
Hi,
I want to perform a check on the variable entered. The entered variable should be either a Numeric or Char or Varchar(0-9 or A-z)... No special chars allowed.
I used a function called DATATYPE('Var'), but that is giving a return code as CHAR when Special chars are entered.
Please let me know if there is some other built in function which can be helpful for me.
There is a function called COMAPRE(), but in which i should have the list of all the Special chars and if that is found in the string i can display a valid message.
I want to know if there is something else(easier) which can used for the above purpose. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
I was going to say exactly the same as superk ........ until I tried a test.
Quote: |
If you specify type, returns 1 if string matches the type; otherwise returns 0. If string is null, the function returns 0 (except when type is X, which returns 1 for a null string). The following are valid types. (Only the capitalized and highlighted letter is needed; all characters following it are ignored. Note that for the hexadecimal option, you must start your string specifying the name of the option with x rather than h.)
|
Code: |
000001 /* REXX **/
000002
000003 ABC = "AB2"
000004 A = DATATYPE(ABC,A)
000005 SAY A
000006 ABC = "AB@"
000007 A = DATATYPE(ABC,A)
000008 SAY A
|
RESULT
Code: |
1
7 +++ A = DATATYPE(ABC,A)
Error running TESTPRO2, line 7: Incorrect call to routine
***
|
Is this just me, or is it a general problem / technical glitch ??? |
|
Back to top |
|
|
kaos
New User
Joined: 24 Apr 2007 Posts: 9 Location: Bangalore
|
|
|
|
Its workin for me.. but if the string has any of these !@#$^.? then it is giving an return code of 1 otherwise if others(%*-,) are usesd then its givein a returm code of 0. |
|
Back to top |
|
|
|