IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

how to identify the next location of the specific word.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Mon Jul 28, 2008 1:22 pm
Reply with quote

Can we acheive this by using INSPECt command?

customer dtails , cust Ac No = 21212212, cust Name = ssp , PAN number = 212121,

i want to change this as below..

customer dtails , cust Ac No = XXXXXXXX, cust Name = XXX , passport number = XXXXXX,
Back to top
View user's profile Send private message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Mon Jul 28, 2008 1:45 pm
Reply with quote

SORRY , TYPO ERROR

Can we acheive this by using INSPECt command?

customer dtails , cust Ac No = 21212212, cust Name = ssp , PAN number = 212121,

i want to change this as below..

customer dtails , cust Ac No = XXXXXXXX, cust Name = XXX , PAN number = XXXXXX,

i mean , need to replace all the confidentioal datas to 'XXXXXX'

there is no constant position of these fields..it would vary at different places .. need your valuable inputs please...
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Mon Jul 28, 2008 3:17 pm
Reply with quote

Why is this change ? if you change the confidential data how will you retrieve it ??
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jul 28, 2008 5:30 pm
Reply with quote

Quote:

customer dtails , cust Ac No = 21212212, cust Name = ssp , PAN number = 212121,


what is constant in the record? what can be used to identify the above combination?
when that is known, then suggestions for UNSTRING, INSPECT, etc... will come.

as far as why? I image you are de-customerizing production data.
Do the data values for either cust Ac No or PAN number always have to remain numeric?
(do you expect to use this data to populate a vsam file or db2 tables?)
Back to top
View user's profile Send private message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Mon Jul 28, 2008 6:33 pm
Reply with quote

Yes , constant fields are cust Ac No , cust Name and PAN number
i have to obscure all the datas by replacing 'XXXXXXX'

how to acheive this..i have tried so many inspect menthods bu not working ..please advise me...
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Mon Jul 28, 2008 6:46 pm
Reply with quote

Hi

Then, constants seam to be "=" in front and ";" at end of the specific data. Unstring them into diverse fields, transform data in the three fields, you have to make unreadable, and them string them back together.
Back to top
View user's profile Send private message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Mon Jul 28, 2008 6:57 pm
Reply with quote

UmeySan,

Exactly you got it.. but constant i want to consider as " cust Ac No = "
" cust Name = " and "PAN number = "

because there are so many text must have" = " symobol so we cant only consider this "=" sign..

Please give me the code for this ..UmeySan

Many Thanks in advance
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Jul 28, 2008 7:10 pm
Reply with quote

perform varying x1 from 1 by 1 until x1 > record-length - 14
if record( x1 : 14) = ' Cust Ac no = '
move 'xxxxxxxx' to record (x1 + 14: 8)
end-if
etc
end-perform.
Back to top
View user's profile Send private message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Mon Jul 28, 2008 7:26 pm
Reply with quote

Many Thanks craq ...

but i guess we can achieve this by using INSPECT command...please see below..

01 DATA1 PIC X(100) VALUE ' hai cust ac no= 21212212 ,, NAME = 21212 '.

INSPECT DATA1
REPLACING CHARACTERS BY "X" AFTER "cust ac no = "
BEFORE ','

it's successfully replaced for 'xxxxxxxxx' for cust ac no but the same way when i try for cust name and pan number it 's not replacing i dont know the reason....

how can we do it ..what is the problem in logic...


plz plzz....advise
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Jul 28, 2008 7:39 pm
Reply with quote

Is 'cust name =' in your test data?
Back to top
View user's profile Send private message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Mon Jul 28, 2008 7:51 pm
Reply with quote

No craq,

cust name is not my test date only "name" only is my data ...pplease suugest

this is how i defined-see below ..but this is my testing purpose once i got the logic i will sweep the database and take this different text from database for each account


01 DATA1 PIC X(100) VALUE ' hai cust ac no= 21212212 ,
NAME = 21212 '.
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Mon Jul 28, 2008 8:13 pm
Reply with quote

can you please post your other INSPECT stmts for name and pan ???
Back to top
View user's profile Send private message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Mon Jul 28, 2008 8:22 pm
Reply with quote

please check...

01 DATA1 PIC X(100) VALUE
'HAI cust ac NO = 21212212,NAME = 21212,'.


INSPECT DATA1

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

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

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Jul 28, 2008 8:25 pm
Reply with quote

To convert the NUMERICS to X, couldn't you issue -

Code:

INSPECT CUST-DTL CONVERTING '0123456789' TO 'XXXXXXXXXX'.

Afterwards, begin at the last byte of field CUST-DTL and proceed backwards until you find the literal 'NAME', then go forward, find the '=' and move 'X' to each byte of the customer name, until you hit a subsequent ',' or the end of the field.

Maybe I'm oversimplifying this or I'm not quite understanding the number of sub-fields (and how to identify them) in the CUST-DTL string.

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

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Mon Jul 28, 2008 8:43 pm
Reply with quote

Thanks Bill,

I tried this option but probem is see my actual data look like this .so in this case converting statement would work.

cust Ac No= 12121211, cust Name = SBI , cust code = 212121

i want is as below

cust Ac No= XXXXXXXX, cust Name = XXX , cust code = XXXXXX (

constant fields are "cust Ac No= " , "cust Name = " , " cust code = "

in case if u know please throw the soln..
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Mon Jul 28, 2008 8:55 pm
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
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Mon Jul 28, 2008 8:55 pm
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

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Mon Jul 28, 2008 9:02 pm
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

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Mon Jul 28, 2008 9:09 pm
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

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Mon Jul 28, 2008 9:14 pm
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

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Mon Jul 28, 2008 9:16 pm
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

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Mon Jul 28, 2008 9:21 pm
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

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Mon Jul 28, 2008 9:24 pm
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

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Mon Jul 28, 2008 9:32 pm
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

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

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

superb ashimeer.....
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Mainframe openings in Techmahnidra fo... Mainframe Jobs 0
No new posts Search two or more word with FILEAID Compuware & Other Tools 17
No new posts How to identify the transaction categ... IMS DB/DC 3
No new posts replace word 'MONTH' with current mon... SYNCSORT 11
Search our Forums:

Back to Top