View previous topic :: View next topic
|
Author |
Message |
kaleelahamed
New User
Joined: 08 Jun 2006 Posts: 45 Location: Trumbull, CT
|
|
|
|
Hi All,
I have to code a Easytrieve program in which, I have to check whether any special character is present in that variable. The variable is of length 1 only.
I believe I can code like checking whether the given variable is Alphabet or numeric. and when this condition does not match i can say that the variable is a special Character or blank.
Can anybody help me out in checking whether a variable is Alphabet or Numeric like in COBOL we have "IS ALPHABETIC" or "IS NUMERIC". Is there there any equivalent to this in Easytrieve?
Thanks in advance |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You will need to define what exactly is a "special character" for your requirement.
For example, is a lowerr-case letter a special character? Is a hex zero-five (tab) a special character? Etc. . .
Once you have defined your ist of special characters, you can test for them.
If i've not understood what you want to do, please clarify. |
|
Back to top |
|
|
ratheesh_1983
New User
Joined: 11 Apr 2007 Posts: 19 Location: hyderabad
|
|
|
|
Hi kaleelahamed,
list all the special characters as constants in the working storage section as follows:
W-SP1 W 3 A VALUE '@'
W-SP2 W 20 A VALUE '#'
lets say WS-VAR is the variable u r checking...
IF WS-VAR = W-SP1 OR +
WS-VAR = W-SP2
PERFORM some section name.
Hope this helps............ |
|
Back to top |
|
|
kaleelahamed
New User
Joined: 08 Jun 2006 Posts: 45 Location: Trumbull, CT
|
|
|
|
But my requirement is like I dont know the special character I will encounter. So I think I will have to define all the Alphabets and numbers in variables and check them for my validation.
Aren't there any option like the one I mentioned earlier?
Quote: |
Can anybody help me out in checking whether a variable is Alphabet or Numeric like in COBOL we have "IS ALPHABETIC" or "IS NUMERIC". Is there there any equivalent to this in Easytrieve? |
Thanks for the reply. |
|
Back to top |
|
|
kaleelahamed
New User
Joined: 08 Jun 2006 Posts: 45 Location: Trumbull, CT
|
|
|
|
Thanks to both you.
I have used the reply of urs in another topic with subject "Length of Alpha numeric field/string in Easytrieve".
Its working fine for me. Since I am new to Easytrieve I dint try the option at first hand itself.
Thanks once again for the help.
I have used like,
Code: |
IF <fieldname> ALPHABETIC OR <fieldname> NUMERIC |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome |
|
Back to top |
|
|
|