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
 

 

INSPECT with PERFORM statement
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Wed Aug 13, 2008 10:00 pm    Post subject: INSPECT with PERFORM statement
Reply with quote

Hi,

Is it possible if inspect with perform stmt.

ex:-

INSPECT TEXT1 TALLYING
CNTR FOR ALL 'my name '

If "my name" string found in TEXT1 then i want to move my control in to another section. using PERFORM stmt or any other.

but dont want to use perform stmt after checkinig CNTR value..

Any one have idea about this ...please..
Back to top
View user's profile Send private message

ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Wed Aug 13, 2008 10:25 pm    Post subject:
Reply with quote

what exectly do you want to achieve ?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Aug 14, 2008 2:22 am    Post subject:
Reply with quote

Hello,

Quote:
Any one have idea about this ...please..
Probably not until you provide some clarification. . .

Quote:
but dont want to use perform stmt after checkinig CNTR value..
Why not? What might you prefer?

If you post some better sample data and how you want the process to operate, we may be better able to offer suggestions.
Back to top
View user's profile Send private message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Thu Aug 14, 2008 4:26 pm    Post subject:
Reply with quote

Iam sorry, please see the example below...

NOTES-TEXT contains X123ZZZZ

Code below:-

INSPECT NOTES-TEXT TALLYING
CNTR1 FOR ALL 'X123Z'

EVALUATE TRUE
WHEN CNTR1 = 1
PERFORM CREATE-SEC
WHEN OTHER
DISPLAY ' NO note hit '
END-EVALUATE.

Actually what i want is i want to skip the evaluate condition straightly i want to go to CREATE-SEC section

Is it possible ?
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Thu Aug 14, 2008 4:57 pm    Post subject:
Reply with quote

Why do you want to go to the para if the counter is not equal to 1 ... remove the evaluate and just code perform para ...
Back to top
View user's profile Send private message
GrantP

New User


Joined: 12 Aug 2008
Posts: 8
Location: Johannesburg

PostPosted: Thu Aug 14, 2008 5:02 pm    Post subject:
Reply with quote

@ashimer

CREATE-SEC should only be performed when a certain string is found in NOTES-TEXT otherwise an error message is displayed

As far as I know the inspect statement doesn't cater for specific conditions (like when clause in evaluate).
Back to top
View user's profile Send private message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Thu Aug 14, 2008 5:25 pm    Post subject:
Reply with quote

Iam just asking if INSPECT stmt finds the string, straightly how to pass the control in to another section.
Back to top
View user's profile Send private message
Cristopher

New User


Joined: 31 Jul 2008
Posts: 53
Location: NY

PostPosted: Thu Aug 14, 2008 5:34 pm    Post subject: Reply to: INSPECT with PERFORM statement
Reply with quote

No it can't.... as your cntr1 will only contain a value which needs to be evaluated.
Back to top
View user's profile Send private message
GrantP

New User


Joined: 12 Aug 2008
Posts: 8
Location: Johannesburg

PostPosted: Thu Aug 14, 2008 5:36 pm    Post subject:
Reply with quote

@ssprabhu

The INSPECT can be used to scan a source string from left to right counting, replacing or converting characters. This is achieved using the TALLYING, REPLACING or CONVERTING phrases and related options.

As far as I know there is no way of transferring control to elsewhere in the program directly using the INSPECT verb
Back to top
View user's profile Send private message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Thu Aug 14, 2008 5:46 pm    Post subject:
Reply with quote

Iam little sad about the inspect but more happy about your replies
Many thanks all for your time...

Cheers,
Sathish
Back to top
View user's profile Send private message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Thu Aug 14, 2008 5:58 pm    Post subject:
Reply with quote

Guys , i have one more query ..please help

Text is below:-

Set up cancelled by KA123 ; AC1: 88888888, AC2: 77777777

using INSPECT hot to change it as below

Set up cancelled by KA123 ; AC1: XXXXXXXX, AC2: XXXXXXXX
Back to top
View user's profile Send private message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Thu Aug 14, 2008 5:59 pm    Post subject:
Reply with quote

I want to replace the account details with character "X"
Back to top
View user's profile Send private message
GrantP

New User


Joined: 12 Aug 2008
Posts: 8
Location: Johannesburg

PostPosted: Thu Aug 14, 2008 6:07 pm    Post subject:
Reply with quote

Are the account details always going to be numeric and always only replaced by "X"
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Thu Aug 14, 2008 6:09 pm    Post subject:
Reply with quote

Use reference modification -- find the AC1: and replace the following characters. Unless you have one or a few fixed AC1 fields, INSPECT is not the tool to use.
Back to top
View user's profile Send private message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Thu Aug 14, 2008 6:16 pm    Post subject:
Reply with quote

Yes the account details always be numeric but i want to change only account deatis.. not all the numeric fields there is a text KA123 is there
i dont want to change

I tried this

INSPECT DATA1 REPLACING
CHARACTERS BY "X" AFTER "AC1: " BEFORE ", AC2: "
CHARACTERS BY "X" AFTER ", AC2: " BEFORE - - - - -

But i dont know how to replace the AC2 details thatz why i given dahsed lines...any one can please fill it up or give me some alternative solutions..
Back to top
View user's profile Send private message
GrantP

New User


Joined: 12 Aug 2008
Posts: 8
Location: Johannesburg

PostPosted: Thu Aug 14, 2008 6:31 pm    Post subject:
Reply with quote

You don't need the "BEFORE" bit of code at the end there...
It seems to works just fine like this:

Code:

INSPECT DATA1                                       
REPLACING                                           
   CHARACTERS BY "X" AFTER "AC1: " BEFORE ", AC2: " 
   CHARACTERS BY "X" AFTER "AC2: "                   
Back to top
View user's profile Send private message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Thu Aug 14, 2008 7:57 pm    Post subject:
Reply with quote

iam sorry , forgot to say one thing

that text is 100 bytes total if i do like this then it will replace X till 100 bytes .

From AC2 just i want to replace "X" for 8 bytes.
Back to top
View user's profile Send private message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Thu Aug 14, 2008 7:58 pm    Post subject:
Reply with quote

It s bit tough now...isn't it ??
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Thu Aug 14, 2008 8:19 pm    Post subject:
Reply with quote

Quote:

It s bit tough now...isn't it ??


Individual decision

Code:


INSPECT DATA1                                       
REPLACING                                           
   CHARACTERS BY "X" AFTER "AC1: " BEFORE ", AC2: " 
   CHARACTERS BY "X" AFTER "AC2: "  BEFORE INITIAL "  "     



before 2 spaces ... but this wont work if your last 7 is in 99th position ...
Back to top
View user's profile Send private message
GrantP

New User


Joined: 12 Aug 2008
Posts: 8
Location: Johannesburg

PostPosted: Fri Aug 15, 2008 3:16 pm    Post subject:
Reply with quote

With the additional complication you've added, the INSPECT is not the tool to use. See Robert's post below

Robert Sample wrote:
Use reference modification -- find the AC1: and replace the following characters. Unless you have one or a few fixed AC1 fields, INSPECT is not the tool to use.
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
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm
This topic is locked: you cannot edit posts or make replies. Updating value of key using rewrite s... ParminderKumar COBOL Programming 4 Thu Aug 04, 2016 12:46 am
No new posts Inspect statement spoorni COBOL Programming 5 Mon Jun 06, 2016 9:53 pm


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