|
|
| Author |
Message |
ashimer
Senior Member
Joined: 13 Feb 2004 Posts: 360 Location: Bangalore
|
|
|
|
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 |
|
 |
References
|
|
 |
Robert Sample
Senior Member
Joined: 06 Jun 2008 Posts: 941 Location: Atlanta, GA
|
|
|
|
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 |
|
 |
ssprabhu
Active User
Joined: 25 Apr 2005 Posts: 54 Location: pune
|
|
|
|
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 |
|
 |
ssprabhu
Active User
Joined: 25 Apr 2005 Posts: 54 Location: pune
|
|
|
|
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 |
|
 |
ssprabhu
Active User
Joined: 25 Apr 2005 Posts: 54 Location: pune
|
|
|
|
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 |
|
 |
ssprabhu
Active User
Joined: 25 Apr 2005 Posts: 54 Location: pune
|
|
|
|
| all, please tell me how to convert the 'alpha nuerics to 'XXXXXXXX' |
|
| Back to top |
|
 |
Robert Sample
Senior Member
Joined: 06 Jun 2008 Posts: 941 Location: Atlanta, GA
|
|
|
|
| Based on the latest information you provided, you're not going to get any simpler than three INSPECT statements. |
|
| Back to top |
|
 |
ssprabhu
Active User
Joined: 25 Apr 2005 Posts: 54 Location: pune
|
|
|
|
Yes robert , but there is no other way i have to 3 inispect stmt...
if any other way please advise me... |
|
| Back to top |
|
 |
ashimer
Senior Member
Joined: 13 Feb 2004 Posts: 360 Location: Bangalore
|
|
|
|
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 |
|
 |
ssprabhu
Active User
Joined: 25 Apr 2005 Posts: 54 Location: pune
|
|
|
|
| superb ashimeer..... |
|
| Back to top |
|
 |
ssprabhu
Active User
Joined: 25 Apr 2005 Posts: 54 Location: pune
|
|
|
|
All,
please tell me how to convert the 'alpha nuerics to 'XXXXXXXX'
what is the synatx...please |
|
| Back to top |
|
 |
ashimer
Senior Member
Joined: 13 Feb 2004 Posts: 360 Location: Bangalore
|
|
|
|
| Alpha numeric will be treated as character .... what exactly do you want to convert ? |
|
| Back to top |
|
 |
ssprabhu
Active User
Joined: 25 Apr 2005 Posts: 54 Location: pune
|
|
|
|
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 |
|
 |
ssprabhu
Active User
Joined: 25 Apr 2005 Posts: 54 Location: pune
|
|
|
|
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 |
|
 |
dbzTHEdinosauer
Senior Member
Joined: 20 Oct 2006 Posts: 1639 Location: germany
|
|
|
|
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 |
|
 |
|
|