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

How to check repeated chars.


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

New User


Joined: 14 Sep 2005
Posts: 54
Location: Chennai

PostPosted: Mon Mar 01, 2010 5:03 pm
Reply with quote

Hi all,
I have one requirement as following.

01 WS-CUST-INFO
05 WS-NAMES X (35)
05 WS-ACC-NO 9(09)
I need to check the WS-NAME field whether its having repeated values like AAAAAA, BBBBB
XXXXXXXXXXXX.

Please help me how to get this.


Thanks
Sashi
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Mon Mar 01, 2010 6:25 pm
Reply with quote

Hi Sashi,

Could you be more specific... and more over your requirement seems a little weird...

Say for example the name is George Clooney... Will "oo" in Clooney be considered as repeatable... Without disclosing any proprietary information, it would be helpful if you could provide what you intend to do if you find the repeated characters...
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Mar 01, 2010 6:30 pm
Reply with quote

I Guess this will work for you.
Code:

MOVE WS-NAMES TO TEMPVAR.                         
INSPECT TEMPVAR REPLACING ALL WS-NAMES(1:1) BY ' '.
IF TEMPVAR =  SPACES THEN                         
DISPLAY 'GOT REPEATED CHARS'.                     
Back to top
View user's profile Send private message
sashi

New User


Joined: 14 Sep 2005
Posts: 54
Location: Chennai

PostPosted: Mon Mar 01, 2010 6:34 pm
Reply with quote

Binop,

That is acceptable.
Name with all same character should be suppressed.
Invalid names:
1.AAAAAAAAA
2.CCCCCCCCCCCCC
3.XXXX
4.1111111
5.555555
6.&&&&&&
It should also eliminate all numbers and Spl chars also
Valid names:
1.BOOSE
2.ROOP
3.AAAX
4.RYYYYYYY

Thanks
Sashi
Back to top
View user's profile Send private message
sashi

New User


Joined: 14 Sep 2005
Posts: 54
Location: Chennai

PostPosted: Mon Mar 01, 2010 6:38 pm
Reply with quote

What is MAINVAR??


Sashi
Back to top
View user's profile Send private message
sashi

New User


Joined: 14 Sep 2005
Posts: 54
Location: Chennai

PostPosted: Mon Mar 01, 2010 6:45 pm
Reply with quote

Binop B wrote:
Hi Sashi,

Could you be more specific... and more over your requirement seems a little weird...

Say for example the name is George Clooney... Will "oo" in Clooney be considered as repeatable... Without disclosing any proprietary information, it would be helpful if you could provide what you intend to do if you find the repeated characters...



Binop,

That is acceptable.
Name with all same character should be suppressed.
Invalid names:
1.AAAAAAAAA
2.CCCCCCCCCCCCC
3.XXXX
4.1111111
5.555555
6.&&&&&&
It should also eliminate all numbers and Spl chars also
Valid names:
1.BOOSE
2.ROOP
3.AAAX
4.RYYYYYYY
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Mon Mar 01, 2010 8:12 pm
Reply with quote

Hi Sasha,

Need one more clarification in your input.
Will it be always a single word?

If its a single word, then certainly you go by Sambhaji's suggestion... If there is a possibility of having more than one word, you will need to do some UNSTRING statements before the INSPECT ...
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Mar 02, 2010 12:49 pm
Reply with quote

sashi wrote:
What is MAINVAR??


Sashi

No MAINVAR there now... Check again.

Actually I copied one inspect statement from some program and pasted here. Then I changed variable name with yours. At first time I forgot to change MAINVAR.
but I updated it in next minute.. icon_smile.gif
Back to top
View user's profile Send private message
sashi

New User


Joined: 14 Sep 2005
Posts: 54
Location: Chennai

PostPosted: Tue Mar 02, 2010 4:30 pm
Reply with quote

Sambhaji wrote:
sashi wrote:
What is MAINVAR??


Sashi

No MAINVAR there now... Check again.

Actually I copied one inspect statement from some program and pasted here. Then I changed variable name with yours. At first time I forgot to change MAINVAR.
but I updated it in next minute.. icon_smile.gif

Thats OK... icon_surprised.gif
Back to top
View user's profile Send private message
sashi

New User


Joined: 14 Sep 2005
Posts: 54
Location: Chennai

PostPosted: Tue Mar 02, 2010 4:31 pm
Reply with quote

Binop B wrote:
Hi Sasha,

Need one more clarification in your input.
Will it be always a single word?

If its a single word, then certainly you go by Sambhaji's suggestion... If there is a possibility of having more than one word, you will need to do some UNSTRING statements before the INSPECT ...


Yeah...
Its singlwe word only and without any spaces in between...
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Mar 02, 2010 4:32 pm
Reply with quote

sashi wrote:
Sambhaji wrote:
sashi wrote:
What is MAINVAR??


Sashi

No MAINVAR there now... Check again.

Actually I copied one inspect statement from some program and pasted here. Then I changed variable name with yours. At first time I forgot to change MAINVAR.
but I updated it in next minute.. icon_smile.gif

Thats OK... icon_surprised.gif

I hope Solution helps you.. icon_smile.gif
Back to top
View user's profile Send private message
sashi

New User


Joined: 14 Sep 2005
Posts: 54
Location: Chennai

PostPosted: Tue Mar 02, 2010 5:55 pm
Reply with quote

Sambhaji wrote:
I Guess this will work for you.
Code:

MOVE WS-NAMES TO TEMPVAR.                         
INSPECT TEMPVAR REPLACING ALL WS-NAMES(1:1) BY ' '.
IF TEMPVAR =  SPACES THEN                         
DISPLAY 'GOT REPEATED CHARS'.                     


Thanks.....Its working ...
Back to top
View user's profile Send private message
sashi

New User


Joined: 14 Sep 2005
Posts: 54
Location: Chennai

PostPosted: Tue Mar 02, 2010 6:04 pm
Reply with quote

Sambhaji wrote:
sashi wrote:
Sambhaji wrote:
sashi wrote:
What is MAINVAR??


Sashi

No MAINVAR there now... Check again.

Actually I copied one inspect statement from some program and pasted here. Then I changed variable name with yours. At first time I forgot to change MAINVAR.
but I updated it in next minute.. icon_smile.gif

Thats OK... icon_surprised.gif

I hope Solution helps you.. icon_smile.gif


Yeah its working ...but can you explain how??
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Mar 02, 2010 6:19 pm
Reply with quote

Quote:

Yeah its working ...but can you explain how??

icon_eek.gif What is there to explain?
Quote:

Joined: 14 Sep 2005
Occupation: Software Eng
Mainframe Skills: COBOL/JCL/DB2/IMS-DB
Back to top
View user's profile Send private message
sashi

New User


Joined: 14 Sep 2005
Posts: 54
Location: Chennai

PostPosted: Tue Mar 02, 2010 6:23 pm
Reply with quote

Sambhaji wrote:
Quote:

Yeah its working ...but can you explain how??

icon_eek.gif What is there to explain?
Quote:

Joined: 14 Sep 2005
Occupation: Software Eng
Mainframe Skills: COBOL/JCL/DB2/IMS-DB


Yeah... I know...
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 keylist key definition longer than 40... TSO/ISPF 2
No new posts Using Multiple IFTHEN and WHEN condit... SYNCSORT 12
No new posts sort to find out the char which repea... Mainframe Interview Questions 10
No new posts Check if CICS is online in JCL CICS 10
No new posts SCOPE PENDING option -check data DB2 2
Search our Forums:

Back to Top