Skip to Content
0
Former Member
Mar 18, 2009 at 09:32 AM

Appending to a file(to a specified line)

28 Views

Hi Experts,

I am thinking on a way of appending to a file for a specific line.

For example: Suppose "myfile" has content like.

linedata1

linedata2

linedata3

linedata4

linedata5

linedata6

linedata7

linedata8

linedata9

linedata10

linedata11

linedata12

linedata13

linedata14

I want to insert "new_data" after "linedata6" and before "linedata7". Then the file data will be.

linedata1

linedata2

linedata3

linedata4

linedata5

linedata6

new_data

linedata7

linedata8

linedata9

linedata10

linedata11

linedata12

linedata13

linedata14

I thought on a solution that getting the data to an internal table of lines, overwrite the file and add lines with he new additions. However; the data line number that is expected is more than 1.000.000, I think this can create some problems (dumps, performance etc.).

Is there any other and safe way to do this file operation ?

Thanks.