"Fastest" one-on-one file update 
Author Message
 "Fastest" one-on-one file update

For example, in a lot of ASCII-files, I want to change "1-800-BUSY"
to "1-800-1879". It's always an Overlay()-situation (new string and
old string have the same length). Using "classic" REXX, what is the
fastest (or, FWIW, a fast) way to do this file-I/O when the updated
file should replace the old one too ?


Tue, 06 Feb 2001 03:00:00 GMT  
 "Fastest" one-on-one file update

Quote:

> For example, in a lot of ASCII-files, I want to change "1-800-BUSY"
> to "1-800-1879". It's always an Overlay()-situation (new string and
> old string have the same length). Using "classic" REXX, what is the
> fastest (or, FWIW, a fast) way to do this file-I/O when the updated
> file should replace the old one too ?

Fastest? The fastest way to program it is to write a new file as you do
the replacement data logic. Then you can rename or delete the original
input file, rename new output file to the file name you started with.

If you want to spend a lot of time writing "fast" I/O in a difficult to
understand, difficult to maintain program, then you can do true overlay
replacement in the input file by using STREAM(..SEEK..) to manipulate
the file pointer.
  LINEIN() to read the file
  PARSE to review the content of each line
  SUBSTR to do the replacement
  STREAM SEEK to reset file pointer before
  LINEOUT replacement

As I recall, you have to explicitly STREAM OPEN the file as WRITE.

You didn't mention the platform but the OS/2 online REXX doc has
sufficient STREAM info.



Tue, 06 Feb 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. update more then one files through one form

2. One more "Giant Canvas" question

3. "There is not one typical learner."

4. "One-Touch-Logo"

5. POLS (with one case: "class variable")

6. OT - "ONE" and grammar

7. PHP is "one screen behind"

8. lpa prolog predicate "one"

9. One more stupid doubt (character ":")

10. 1 to "one"

11. multiple "stations" on one PC

12. "One year Contract in New York"

 

 
Powered by phpBB® Forum Software