View previous topic :: View next topic
|
Author |
Message |
Chaketh Ram
New User
Joined: 16 Nov 2011 Posts: 7 Location: India
|
|
|
|
I have a requirement to find a particular string in a file and if a match is found,then an indicator has to be appended to that line.
I have coded upto searching for the string and creating an updated string with the added indicator.
Code: |
address isredit
"macro noprocess"
"isredit reset"
"isredit cursor = 1 1"
"isredit find next abcdef 13" /*srching for test string abcdef*/
if rc < 4 then
do
"isredit (lnc) = linenum .zcsr"
"isredit (cline) = line .zcsr"
job = substr(cline,1,12)
cline = left(job,12)||Y
|
One way to get the updated line would be to delete the old line and insert the new line.
Is there a way to directly update the existing line with the indicator. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
I think that is what you may need to do |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
A whoopie, a yes/no question: YES |
|
Back to top |
|
|
Chaketh Ram
New User
Joined: 16 Nov 2011 Posts: 7 Location: India
|
|
|
|
Figured out a way to do it.
Keyword MASKLINE is used for this.
Code: |
address isredit
"macro noprocess"
"isredit reset"
"isredit cursor = 1 1"
"isredit find next abcdef 13" /* search string abcdef*/
if rc < 4 then
do
"isredit (lnc) = linenum .zcsr"
"isredit (cline) = line .zcsr"
job = substr(cline,1,12)
cline = left(job,12)||Y
/*say cline*/
"isredit line" lnc "= maskline +(cline)"
|
Please let know if there is a better way to do it
Thanks |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Chaketh Ram wrote: |
Figured out a way to do it.
Keyword MASKLINE is used for this." |
No, it isn't, but someday, after screwing up badly, you will find out why. |
|
Back to top |
|
|
Michael Jakob
New User
Joined: 13 Mar 2011 Posts: 17 Location: Switzerland
|
|
|
|
If you like you can change your line with:
In this case your marker will be placed at first empty place.
ADDRESS "ISREDIT" "CHANGE ' ' '"cline" .zcsr .zcsr"
With
ADDRESS "ISREDIT" "LINE .ZCSR = (cline)"
you fill you replace the line in the file with cline. |
|
Back to top |
|
|
|