Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to check repeated chars.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to check repeated chars.
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: MOVE WS-NAMES TO TEMPVAR.
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    Post subject:
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    Post subject:
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    Post subject: Re: MOVE WS-NAMES TO TEMPVAR.
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    Post subject: Re: MOVE WS-NAMES TO TEMPVAR.
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    Post subject:
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    Post subject: Re: MOVE WS-NAMES TO TEMPVAR.
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    Post subject:
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    Post subject: Re: MOVE WS-NAMES TO TEMPVAR.
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
No new posts Syntax to check the first 4 digits of... kshirabdhi DFSORT/ICETOOL 10 Tue May 03, 2016 12:21 pm
No new posts Check special resource availability w... pinimo JCL & VSAM 8 Fri Apr 15, 2016 8:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us