View previous topic :: View next topic
|
Author |
Message |
ssprabhu
New User
Joined: 25 Apr 2005 Posts: 67 Location: pune
|
|
|
|
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 |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
what exectly do you want to achieve ? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
ssprabhu
New User
Joined: 25 Apr 2005 Posts: 67 Location: pune
|
|
|
|
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 |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
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 |
|
|
GrantP
New User
Joined: 12 Aug 2008 Posts: 8 Location: Johannesburg
|
|
|
|
@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 |
|
|
ssprabhu
New User
Joined: 25 Apr 2005 Posts: 67 Location: pune
|
|
|
|
Iam just asking if INSPECT stmt finds the string, straightly how to pass the control in to another section. |
|
Back to top |
|
|
Cristopher
New User
Joined: 31 Jul 2008 Posts: 53 Location: NY
|
|
|
|
No it can't.... as your cntr1 will only contain a value which needs to be evaluated. |
|
Back to top |
|
|
GrantP
New User
Joined: 12 Aug 2008 Posts: 8 Location: Johannesburg
|
|
|
|
@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 |
|
|
ssprabhu
New User
Joined: 25 Apr 2005 Posts: 67 Location: pune
|
|
|
|
Iam little sad about the inspect but more happy about your replies
Many thanks all for your time...
Cheers,
Sathish |
|
Back to top |
|
|
ssprabhu
New User
Joined: 25 Apr 2005 Posts: 67 Location: pune
|
|
|
|
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 |
|
|
ssprabhu
New User
Joined: 25 Apr 2005 Posts: 67 Location: pune
|
|
|
|
I want to replace the account details with character "X" |
|
Back to top |
|
|
GrantP
New User
Joined: 12 Aug 2008 Posts: 8 Location: Johannesburg
|
|
|
|
Are the account details always going to be numeric and always only replaced by "X" |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
ssprabhu
New User
Joined: 25 Apr 2005 Posts: 67 Location: pune
|
|
|
|
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 |
|
|
GrantP
New User
Joined: 12 Aug 2008 Posts: 8 Location: Johannesburg
|
|
|
|
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 |
|
|
ssprabhu
New User
Joined: 25 Apr 2005 Posts: 67 Location: pune
|
|
|
|
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 |
|
|
ssprabhu
New User
Joined: 25 Apr 2005 Posts: 67 Location: pune
|
|
|
|
It s bit tough now...isn't it ?? |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
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 |
|
|
GrantP
New User
Joined: 12 Aug 2008 Posts: 8 Location: Johannesburg
|
|
|
|
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 |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
Quote: |
With the additional complication you've added, the INSPECT is not the tool to use |
in this case , at the first place itself you shudnt have recommended this ...and btw how does adding a BEFORE clause to your post increase the complication ? i just gave some value addition ...
For finding the location of AC1 and AC2 either you will have to do a perform checking for the exact value or else you have to use INSPECT ... let the OP decide whether he wants performance or simpler code ...
But i would strongly suggest using PERFORM |
|
Back to top |
|
|
GrantP
New User
Joined: 12 Aug 2008 Posts: 8 Location: Johannesburg
|
|
|
|
@ashimer
Apologies for any misunderstanding. "additional complication" comment was directed at OP with regards
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 |
|
|
ssprabhu
New User
Joined: 25 Apr 2005 Posts: 67 Location: pune
|
|
|
|
Thanks all, this also work isn't it ? please suggest how to reduce the 2 inspect stmt as one .
INSPECT DATA1 CONVERTING
"0123456789" TO "XXXXXXXXXX"
AFTER INITIAL "AC1: " BEFORE ", AC2"
INSPECT DATA1 CONVERTING
"0123456789" TO "XXXXXXXXXX" AFTER ", AC2" |
|
Back to top |
|
|
|