|
|
| Author |
Message |
Krishna Velamur
New User
Joined: 22 Aug 2008 Posts: 22 Location: Hyderabad
|
|
|
|
Hi all,
I tried the below solution but it didn't work and the count was zero.
| Code: |
| INSPECT STR-1 TALLYING W-CNT FOR ALL '''''''' |
But when I moved
to a variable and tried it worked.
i.e.
| Code: |
MOVE " '''''''' " TO STR-2
INSPECT STR-1 TALLYING W-CNT FOR ALL STR-2. |
Corrections are welcome. |
|
| Back to top |
|
 |
References
|
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 9192 Location: 221 B Baker St
|
|
|
|
Hello,
I am having trouble relating your post to the requirement of this topic
Maybe if you explain the string of quotes ( '''''''' ), it will help me understand. |
|
| Back to top |
|
 |
Anuj D.
Global Moderator
Joined: 22 Apr 2006 Posts: 2352 Location: Mumbai, India
|
|
|
|
Krishna,
Edited your post with BBCode, in case it didn't reflect what you actually wanted to convey, please PM to me. BTW, I echo Dick.
-Ad |
|
| Back to top |
|
 |
Krishna Velamur
New User
Joined: 22 Aug 2008 Posts: 22 Location: Hyderabad
|
|
|
|
Hi Dick,
To find out consecutive occurence of ' (single code) I will inspect the string with " '''''''' ". (Here '''' will represent one single code).
But when I harcoded codes in the inspect statement (as given below) it was not working. The count was zero.
INSPECT STR-1 TALLYING W-CNT FOR ALL ''''''''
Instead of harcoding, I moved " '''''''' " into another variable and used it in the inspect statement and it worked (as given belwo).
MOVE " '''''''' " TO STR-2
INSPECT STR-1 TALLYING W-CNT FOR ALL STR-2.
Hope Iam clear. Corrections are welcome. |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 9192 Location: 221 B Baker St
|
|
|
|
Hello,
Yes, but where did the requirement to tally a string of single-quotes come from
It is not part of the requirement that Sri asked about. |
|
| Back to top |
|
 |
Krishna Velamur
New User
Joined: 22 Aug 2008 Posts: 22 Location: Hyderabad
|
|
|
|
Hi Dick,
The solution that I had provided would find out the number of occurances of two consecutive ' (single code). This is the requirement right!!!! Correct me if Iam wrong. |
|
| Back to top |
|
 |
Terry Heinze
Active User
Joined: 14 Jul 2008 Posts: 258 Location: Richfield, MN, USA
|
|
|
|
Krishna,
Please use BBCode to preserve accurate spacing. See FAQ. |
|
| Back to top |
|
 |
dbzTHEdinosauer
Senior Member
Joined: 20 Oct 2006 Posts: 1673 Location: germany
|
|
|
|
| what is wrong with definining a variable PIC X(02) value ''''. ? |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 9192 Location: 221 B Baker St
|
|
|
|
Hello,
| Quote: |
| This is the requirement right!!!! |
Yup, sure is
The "string" of quotes did not equate to one pair of consecutive single-quotes to my (easily confused) mind
When i've needed to use one or more quotes as a data value, i've put something in ws (like dbz recommended or with the value QUOTE), or i've used the hex value inline. |
|
| Back to top |
|
 |
Krishna Velamur
New User
Joined: 22 Aug 2008 Posts: 22 Location: Hyderabad
|
|
|
|
Hi Dick,
It was a mistake from my side. Actually I moved the string of quotes into STR-2 which was defined as X(02). Thats the reason why my code was working. As suggested by Dick B, we can move " '' " into a string and use in inspect.
Ex:
| Code: |
STR-2 PIC X(02) VALUE "''".
INSPECT STR-1 TALLYING W-CNT FOR ALL STR-2
|
or we can use
| Code: |
INSPECT STR-1 TALLYING W-CNT FOR ALL ''''''
|
Hope this helps. Corrections are welcome. |
|
| Back to top |
|
 |
|
|