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

Keeping some characters and removing rest


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

New User


Joined: 16 May 2007
Posts: 3
Location: Novato,California

PostPosted: Wed May 16, 2007 11:56 pm
Reply with quote

Hi,

In the name of a person field(This is assuming name is in last name, comma, first name, middle initial(optional) format) I want to Remove all characters except characters 'A' THRU 'Z' and '-' '/' ''' ',' ' '
Can Someone help me with example how to do that?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu May 17, 2007 12:42 am
Reply with quote

What do you want to do with the holes left in the field?
Do you want the unwanted characters squeezed out or replaced with something else?
Back to top
View user's profile Send private message
Sanjay Mishra

New User


Joined: 16 May 2007
Posts: 3
Location: Novato,California

PostPosted: Thu May 17, 2007 1:34 am
Reply with quote

Hi William,

Many Thanks for your response .I want unwanted characters squeezed out .

example
*Willi*&am should be converted to William
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu May 17, 2007 2:16 am
Reply with quote

What I did, in a similar requirement, was to set up a "class" in special names and do a perform with reference modification squeezing out, from left to right, the characters that did not fall into that class....
Back to top
View user's profile Send private message
Sanjay Mishra

New User


Joined: 16 May 2007
Posts: 3
Location: Novato,California

PostPosted: Thu May 17, 2007 3:49 am
Reply with quote

Hi William,

I think We are approaching towards solution .Can You please provide one example for the proposed solution.Many Thanks.

CLASS VALID-CHAR 'A' THROUGH 'Z' , '-' , '/' , "" , ',' , ' '

suppose var1 is *Sanjay Ku*mar Mishra so it should be converted to Sanjay Kumar Mishra
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu May 17, 2007 4:21 am
Reply with quote

Sanjay Mishra wrote:
suppose var1 is *Sanjay Ku*mar Mishra so it should be converted to Sanjay Kumar Mishra
Special names section is where I would define the characters I wanted to be valid.
Preform varying an if valid move with reference modification will squeeze out the junk....
It's my bedtime.....Tomorrow, but look in the Fine manual, it is not that hard...
Back to top
View user's profile Send private message
Sharmila Jagadish

New User


Joined: 07 Mar 2006
Posts: 4
Location: Texas, USA

PostPosted: Thu May 17, 2007 6:30 am
Reply with quote

Hi,
if you have found a way to do this , please give the details on how to do it. I am interested to know .
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu May 17, 2007 6:35 am
Reply with quote

Sharmila Jagadish wrote:
if you have found a way to do this , please give the details on how to do it. I am interested to know .
Jeez, what, you have two ids?
It's pretty much a "no brainer"... The clues so far, should be enough, why can't you start to work it out?
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: Thu May 17, 2007 7:06 am
Reply with quote

Quote:
It's my bedtime.....

Go back to bed icon_smile.gif You've got multiple folks interested.


For the interested folks -
.. did you understand the "class" special-names definition?
.. do you understand reference modification?

If both of those make sense to you, create an "output name" field of the same length as the original. Move spaces to the output name field. Iterate using reference modification on both the input and output name fields move each valid byte from the input field to the output field. Increment both reference modifiers on a valid character and only increment the input modifier when the value is not valid. When the modifier reached the end of the input, your name field has been built.

Put together a small bit of test code and if you have questiojs/problems, post them and someone will have suggestions.
Back to top
View user's profile Send private message
Sharmila Jagadish

New User


Joined: 07 Mar 2006
Posts: 4
Location: Texas, USA

PostPosted: Thu May 17, 2007 7:13 am
Reply with quote

thanks dick scherrer
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: Thu May 17, 2007 8:17 am
Reply with quote

You're welcome

Please let us know how it works for you.

Good luck icon_smile.gif
Back to top
View user's profile Send private message
SHAILESH OZA

New User


Joined: 10 Jun 2005
Posts: 21
Location: Mumbai

PostPosted: Thu May 17, 2007 3:24 pm
Reply with quote

i am telling little bit longer solution but hopefully this will work.

you are taking only last name. genarally last name might be upto 20 to 30 charecters.

just write the code

unstring last-name-field delimited by "," or ";" (write all the special charecter)

into field1,field2,field3, field4.............

After that string field1,field2, field3.......... delimited by SIZE
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: Thu May 17, 2007 7:13 pm
Reply with quote

Hello,

Please try your solution before posting. You might use the sample originally posted.

I'm reasonably sure this will not do what was requested.
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 Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
No new posts Count the number of characters in a f... CA Products 1
No new posts Removing date values lines/records fr... SYNCSORT 2
No new posts Tilde Characters Changing to COLONs i... CLIST & REXX 22
Search our Forums:

Back to Top