Warning: Illegal offset type in /home/free2code/vhosts/free2code.net/httpdocs/jtdb/drivers/mysql/mysql.php on line 305
VMS help
|
|||
|
Rank: Unregistered
|
Hello world
Im looking for a little help in VMS. I need to find a way of creating a program that will search a txt file for a particular "string" when its found this string to delete anything above it in the file (Through the editor?). If there anyway that this can be done. All help would be appriciated. Thanks Limey |
||
|
|||
|
|||
|
Rank: Unregistered
|
You can't delete backwards, but what you CAN do is open a file, read it, and when you find the string you're looking for you open a second file (or a new version of the file you're reading and start writing.
file = x.x string XYZ DCL off the top of my head: $! open the file you want to read $! $ open/read F1 X.X $! $! open a new version of the file to write to $! $ open/write F2 X.X $! $! loop 1 $! $ LP1: $! $! read a record if error or EOF goto ENDE1 $! $ read/err=ENDE1 F1 REC1 $! $! if the string doesn't contain XYZ goto LP (and read next record) $! $ if f$locate("XYZ",REC1) .eq. f$length(REC1) then goto LP1 $! $! if we're here we've found the record with XYZ in it. $! write it to F2 $! $ write F2 REC1 $! $! next loop $! $ LP2: $! $! read F1 to EOF and write to F2 $! $ read/err=ende1 F1 $! $ write F2 REC1 $! $ goto LP2 $! $ ENDE1: $! $! we're either at EOF or hit an error $! so close the files $! $ close F1 $ close F2 $! $ exit |
||
|
Please login or register to post a reply.