View previous topic :: View next topic
|
Author |
Message |
sashi
New User
Joined: 14 Sep 2005 Posts: 54 Location: Chennai
|
|
|
|
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 |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
|
sashi
New User
Joined: 14 Sep 2005 Posts: 54 Location: Chennai
|
|
|
|
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 |
|
|
sashi
New User
Joined: 14 Sep 2005 Posts: 54 Location: Chennai
|
|
|
|
What is MAINVAR??
Sashi |
|
Back to top |
|
|
sashi
New User
Joined: 14 Sep 2005 Posts: 54 Location: Chennai
|
|
|
|
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 |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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.. |
|
Back to top |
|
|
sashi
New User
Joined: 14 Sep 2005 Posts: 54 Location: Chennai
|
|
|
|
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.. |
Thats OK... |
|
Back to top |
|
|
sashi
New User
Joined: 14 Sep 2005 Posts: 54 Location: Chennai
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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.. |
Thats OK... |
I hope Solution helps you.. |
|
Back to top |
|
|
sashi
New User
Joined: 14 Sep 2005 Posts: 54 Location: Chennai
|
|
|
|
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 |
|
|
sashi
New User
Joined: 14 Sep 2005 Posts: 54 Location: Chennai
|
|
|
|
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.. |
Thats OK... |
I hope Solution helps you.. |
Yeah its working ...but can you explain how?? |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Quote: |
Yeah its working ...but can you explain how??
|
What is there to explain?
Quote: |
Joined: 14 Sep 2005
Occupation: Software Eng
Mainframe Skills: COBOL/JCL/DB2/IMS-DB
|
|
|
Back to top |
|
|
sashi
New User
Joined: 14 Sep 2005 Posts: 54 Location: Chennai
|
|
|
|
Sambhaji wrote: |
Quote: |
Yeah its working ...but can you explain how??
|
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 |
|
|
|