I am trying to do a tool to search for a old value and to replace with new value.
i am reading from one file ,once i face the old value i am changing that to new value. See the code snippet as follows:
"Alloc da(filename) f(outdd) shr"
"execio * diskr outdd (finis stem recdd."
Do i=0 to recdd.0
if (pos(str2find,recdd.i) > 0) then
LINE_NUM = i
Now i have the updated DATA. i want to write the variable DATA into the line LINE_NUM.
Anyone know how to call EXECIO with line number to be written
Joined: 26 Apr 2004 Posts: 4650 Location: Raleigh, NC, USA
I don't get it.
You're reading the entire DD into a stem variable (recdd.). All you need to do is to loop through the stem variables until you meet your criteria for the change. Change the value of that particular stem variable (recdd.i). Leave the loop. Then, just write the DD from the stem variable:
"execio * diskw outdd (finis stem recdd."
Essentially, you'll just re-write the contents of the entire DD. With the SHR disposition, that shouldn't cause any problems.