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

How to remove the Special character from the variable?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Manigandan Aravindhan

New User


Joined: 09 Oct 2007
Posts: 81
Location: India

PostPosted: Thu Jun 25, 2009 7:16 pm
Reply with quote

Dear friends,
Is there any easy way to remove the Special characters from the variable?
By not hard coding the special variables in program.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Jun 25, 2009 7:31 pm
Reply with quote

What is your definition of SPECIAL CHARACTERS?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Jun 25, 2009 7:43 pm
Reply with quote

Code a Working storage which don't allow to move those "special characters" into the Working storage variables..!!
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Jun 25, 2009 8:05 pm
Reply with quote

Anuj Dhawan wrote:
Code a Working storage which don't allow to move those "special characters" into the Working storage variables..!!


?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Jun 25, 2009 8:24 pm
Reply with quote

Was just trying to be sarcastic.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Jun 26, 2009 1:30 am
Reply with quote

Click on the below link -

ibmmainframes.com/viewtopic.php?p=143786&highlight=#143786

Post questions if you're not sure.

Regards,
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: Fri Jun 26, 2009 1:30 am
Reply with quote

Hello,

Quote:
Is there any easy way to remove the Special characters from the variable?
By not hard coding the special variables in program.
Suggest you re-phrase your question and provide a detailed explanation of what you want to accomplish.

One easy to do this is to show some "input" values and explain how you want them dealt with (i.e. what do you want as output?).

Keep in mind that while your question is completely clear to you, it may not be to others.

Also, when someone asks for info, you need to provide it. . .

To Repeat: What is your definition of SPECIAL CHARACTERS?
Back to top
View user's profile Send private message
Manigandan Aravindhan

New User


Joined: 09 Oct 2007
Posts: 81
Location: India

PostPosted: Fri Jun 26, 2009 12:30 pm
Reply with quote

Hi all,
Thanks for your reponses.

Input-Variable ==> 'ABCY156*&*('
Output-Variable ==> 'ABCY156'

The above is the sample input and output which i needed to accomplish.
I have some crazy logic to achieve it as detailed below:

If Input variable(temp-cnt:1) = spaces
or Input variable(temp-cnt:1) is Numeric
or Input variable(temp-cnt:1) is Alphabetic
Move Input variable(temp-cnt:1) to Output variable(get-cnt:1)
add 1 to temp-cnt get-cnt

else

add 1 to temp-cnt

end-if

The above logic is working fine

As i can see there are many well experienced persons in this forum. I thought of asking suggestions from you people to know is there any easy way to accomplish it.....
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: Fri Jun 26, 2009 7:14 pm
Reply with quote

Hello,

That is an easy way "to accomplish it".

Another might be to set up an 88 level with all of the valid values and do only 1 compare rather than multiple. . .
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Jun 26, 2009 7:23 pm
Reply with quote

checking separately for space is not necessary since space is part of the ALPHABETIC class:
ALPHABETIC
identifier-1 consists entirely of any combination of the lowercase or uppercase Latin alphabetic characters A through Z and the space.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Jun 26, 2009 8:27 pm
Reply with quote

Per the input-sample you provide, best approach seems to be what d.sch. (used this just to avoid confusion...) has suggested otherwise how many if constructs or how many "ORs" are you going to use... icon_rolleyes.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Jun 26, 2009 8:44 pm
Reply with quote

you only need two: aphabetic or numeric...................
Back to top
View user's profile Send private message
Manigandan Aravindhan

New User


Joined: 09 Oct 2007
Posts: 81
Location: India

PostPosted: Thu Jul 09, 2009 6:10 pm
Reply with quote

Ya just alphabets and numeric
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Remove leading zeroes SYNCSORT 4
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
Search our Forums:

Back to Top