IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Check whether a variable is special character or not


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kaleelahamed

New User


Joined: 08 Jun 2006
Posts: 45
Location: Trumbull, CT

PostPosted: Sat Jun 30, 2007 2:59 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Jun 30, 2007 5:08 pm
Reply with quote

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
View user's profile Send private message
ratheesh_1983

New User


Joined: 11 Apr 2007
Posts: 19
Location: hyderabad

PostPosted: Sun Jul 01, 2007 11:29 am
Reply with quote

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............ icon_lol.gif
Back to top
View user's profile Send private message
kaleelahamed

New User


Joined: 08 Jun 2006
Posts: 45
Location: Trumbull, CT

PostPosted: Mon Jul 02, 2007 9:22 am
Reply with quote

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
View user's profile Send private message
kaleelahamed

New User


Joined: 08 Jun 2006
Posts: 45
Location: Trumbull, CT

PostPosted: Mon Jul 02, 2007 12:10 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jul 02, 2007 5:56 pm
Reply with quote

You're welcome icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts How to check whether who renamed the ... JCL & VSAM 3
Search our Forums:

Back to Top