Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Regarding Inspect
Goto page Previous  1, 2
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL
Author Message
Krishna Velamur

New User


Joined: 22 Aug 2008
Posts: 22
Location: Hyderabad

PostPosted: Fri Oct 10, 2008 10:22 am    Post subject:
Reply with quote

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
Code:
''''''''
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
View user's profile Send private message
References
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 8733
Location: 221 B Baker St

PostPosted: Fri Oct 10, 2008 12:06 pm    Post subject:
Reply with quote

Hello,

I am having trouble relating your post to the requirement of this topic icon_confused.gif

Maybe if you explain the string of quotes ( '''''''' ), it will help me understand.
Back to top
View user's profile Send private message
Anuj D.

Global Moderator


Joined: 22 Apr 2006
Posts: 2229
Location: Phoenix, AZ

PostPosted: Fri Oct 10, 2008 12:42 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Krishna Velamur

New User


Joined: 22 Aug 2008
Posts: 22
Location: Hyderabad

PostPosted: Fri Oct 10, 2008 2:25 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 8733
Location: 221 B Baker St

PostPosted: Fri Oct 10, 2008 8:45 pm    Post subject:
Reply with quote

Hello,

Yes, but where did the requirement to tally a string of single-quotes come from icon_confused.gif

It is not part of the requirement that Sri asked about.
Back to top
View user's profile Send private message
Krishna Velamur

New User


Joined: 22 Aug 2008
Posts: 22
Location: Hyderabad

PostPosted: Fri Oct 10, 2008 11:35 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Terry Heinze

Active User


Joined: 14 Jul 2008
Posts: 176
Location: Richfield, MN, USA

PostPosted: Fri Oct 10, 2008 11:39 pm    Post subject:
Reply with quote

Krishna,
Please use BBCode to preserve accurate spacing. See FAQ.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Senior Member


Joined: 20 Oct 2006
Posts: 1639
Location: germany

PostPosted: Sat Oct 11, 2008 12:48 am    Post subject:
Reply with quote

what is wrong with definining a variable PIC X(02) value ''''. ?
Back to top
View user's profile Send private message
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 8733
Location: 221 B Baker St

PostPosted: Sat Oct 11, 2008 1:48 am    Post subject:
Reply with quote

Hello,

Quote:
This is the requirement right!!!!
Yup, sure is icon_smile.gif

The "string" of quotes did not equate to one pair of consecutive single-quotes to my (easily confused) mind icon_redface.gif

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
View user's profile Send private message
Krishna Velamur

New User


Joined: 22 Aug 2008
Posts: 22
Location: Hyderabad

PostPosted: Mon Oct 13, 2008 11:16 am    Post subject:
Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL All times are GMT + 6 HoursGoto page Previous  1, 2
Page 2 of 2