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
 
how to identify the next location of the specific word.
Goto page Previous  1, 2
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL
Author Message
ashimer

Senior Member


Joined: 13 Feb 2004
Posts: 360
Location: Bangalore

PostPosted: Mon Jul 28, 2008 8:55 pm    Post subject:
Reply with quote

If in your data numerics occur only for cust ac, cust name and cust code

use this

Code:


inspect data-1 converting    "0123456789"
to "xxxxxxxxxx"  after initial "cust ac NO = "

Back to top
View user's profile Send private message
References
Robert Sample

Senior Member


Joined: 06 Jun 2008
Posts: 941
Location: Atlanta, GA

PostPosted: Mon Jul 28, 2008 8:55 pm    Post subject:
Reply with quote

Something like
Code:
WORKING-STORAGE SECTION.

01  WS-DATA.
    05  WS-DATA-OLD            PIC X(80) VALUE
    'cust Ac No= 12121211, cust Name = SBI , cust code = 212121'.
    05  WS-DATA-NEW            PIC X(80) VALUE
    'cust Ac No= 12121211, cust Name = SBI , cust code = 212121'.


PROCEDURE DIVISION.

    INSPECT WS-DATA-NEW CONVERTING '1234567890' TO 'XXXXXXXXXX'.
    INSPECT WS-DATA-NEW REPLACING CHARACTERS BY 'X'
            AFTER 'cust Name = '
            BEFORE ' ,'.
    DISPLAY WS-DATA-OLD.
    DISPLAY WS-DATA-NEW.

producing
Code:
 cust Ac No= 12121211, cust Name = SBI , cust code = 212121
 cust Ac No= XXXXXXXX, cust Name = XXX , cust code = XXXXXX
?
Back to top
View user's profile Send private message
ssprabhu

Active User


Joined: 25 Apr 2005
Posts: 54
Location: pune

PostPosted: Mon Jul 28, 2008 9:02 pm    Post subject:
Reply with quote

i got the soln...all please chk and tell me is there any other simplified soln available.... problem is delimiter just i changed it.


INSPECT DATA1

REPLACING CHARACTERS BY "X" AFTER "cust ac no = "
BEFORE ",cust name ="


INSPECT DATA1

REPLACING CHARACTERS BY "X" AFTER "cust name = "
BEFORE ",cust code = "

INSPECT DATA1

REPLACING CHARACTERS BY "X" AFTER "cust code = "
BEFORE ", "

DISPLAY DATA1
STOP RUN.
Back to top
View user's profile Send private message
ssprabhu

Active User


Joined: 25 Apr 2005
Posts: 54
Location: pune

PostPosted: Mon Jul 28, 2008 9:09 pm    Post subject:
Reply with quote

I got the soln..see below i any one knows the simpler than this please kindly let me know...


INSPECT DATA1

REPLACING CHARACTERS BY "X" AFTER "cust ac no = "
BEFORE ", cust NAME ="


INSPECT DATA1

REPLACING CHARACTERS BY "X" AFTER "cust NAME = "
BEFORE ", cust code = "

INSPECT DATA1


REPLACING CHARACTERS BY "X" AFTER "cust code = "
BEFORE ", "

DISPLAY DATA1
STOP RUN.


thanks
Back to top
View user's profile Send private message
ssprabhu

Active User


Joined: 25 Apr 2005
Posts: 54
Location: pune

PostPosted: Mon Jul 28, 2008 9:14 pm    Post subject:
Reply with quote

Yes robert u r right...but problem is there could be so many other numeric field as wll in the text ..that we should not change ..only this fields we need to change ..

plz chk my solution and give me the simpler soln than that
Back to top
View user's profile Send private message
ssprabhu

Active User


Joined: 25 Apr 2005
Posts: 54
Location: pune

PostPosted: Mon Jul 28, 2008 9:16 pm    Post subject:
Reply with quote

all, please tell me how to convert the 'alpha nuerics to 'XXXXXXXX'
Back to top
View user's profile Send private message
Robert Sample

Senior Member


Joined: 06 Jun 2008
Posts: 941
Location: Atlanta, GA

PostPosted: Mon Jul 28, 2008 9:21 pm    Post subject:
Reply with quote

Based on the latest information you provided, you're not going to get any simpler than three INSPECT statements.
Back to top
View user's profile Send private message
ssprabhu

Active User


Joined: 25 Apr 2005
Posts: 54
Location: pune

PostPosted: Mon Jul 28, 2008 9:24 pm    Post subject:
Reply with quote

Yes robert , but there is no other way i have to 3 inispect stmt...
if any other way please advise me...
Back to top
View user's profile Send private message
ashimer

Senior Member


Joined: 13 Feb 2004
Posts: 360
Location: Bangalore

PostPosted: Mon Jul 28, 2008 9:32 pm    Post subject:
Reply with quote

do this in one INSPECT

If input is

'HAI cust ac NO = 21212212,cNAME = sbi,cUST = 333'.

Code:


inspect ws-name1 replacing
characters by "x" after initial "cust ac NO = " before
initial ",c"
characters by "x" after initial "cNAME = " before
initial ",cU"
characters by "x" after initial "CUST = "



but here you have to make sure the before clause changes for each replacing ...it should not be the same ...for No use before ',c' for name add one more letter to the before clause and do not forget to put a before clause for cUST or else the entire string till the max will be filled with "X"

so is cUST is the last in the data use before initial space [/code]
Back to top
View user's profile Send private message
ssprabhu

Active User


Joined: 25 Apr 2005
Posts: 54
Location: pune

PostPosted: Mon Jul 28, 2008 9:43 pm    Post subject:
Reply with quote

superb ashimeer.....
Back to top
View user's profile Send private message
ssprabhu

Active User


Joined: 25 Apr 2005
Posts: 54
Location: pune

PostPosted: Mon Jul 28, 2008 9:44 pm    Post subject:
Reply with quote

All,

please tell me how to convert the 'alpha nuerics to 'XXXXXXXX'

what is the synatx...please
Back to top
View user's profile Send private message
ashimer

Senior Member


Joined: 13 Feb 2004
Posts: 360
Location: Bangalore

PostPosted: Mon Jul 28, 2008 9:46 pm    Post subject:
Reply with quote

Alpha numeric will be treated as character .... what exactly do you want to convert ?
Back to top
View user's profile Send private message
ssprabhu

Active User


Joined: 25 Apr 2005
Posts: 54
Location: pune

PostPosted: Mon Jul 28, 2008 10:01 pm    Post subject:
Reply with quote

ok..ok...In case my date is like this PASSWORD = 12-34-21 .
so in this case i believe your above soln also do so ..am i rite ?

plz correct me if iam wrong...
Back to top
View user's profile Send private message
ssprabhu

Active User


Joined: 25 Apr 2005
Posts: 54
Location: pune

PostPosted: Mon Jul 28, 2008 10:12 pm    Post subject:
Reply with quote

Hai ,

Some times the text contains different naming conventions like
CUST ACCCOUNT NUMBER (or) CUST AC NO (OR) CUST NO.etc..

so is there any other way in one INSPECT command... like by using OR (or) AND type ...please let me know...


Many thanks in ADVANCE....
Back to top
View user's profile Send private message
dbzTHEdinosauer

Senior Member


Joined: 20 Oct 2006
Posts: 1639
Location: germany

PostPosted: Tue Jul 29, 2008 12:14 am    Post subject: Reply to: how to identify the next location of the specific
Reply with quote

instead of using literals in the INSPECT command syntax,
use variables
(personally, I would table everything),
and loop thru one (1) <there, you won your stupid bet>
INSPECT command,
modifying the variables before each invocation.
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