home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rio111.zip / example2.cmd next >
OS/2 REXX Batch file  |  1996-08-19  |  1KB  |  43 lines

  1. /* The corresponding OS/2 REXX procedure of
  2.    the example2.nrx (see that).
  3.    Note: The pure REXX version is 5.5 
  4.    times faster on my system:
  5.    486dx4-120, 32meg RAM, 2xFireball 1.2g HD. */
  6.  
  7.  say ' '
  8.  say 'This program creates a copy of an existing'
  9.  say 'binary file.'
  10.  say 'The result file of the copy is placed in'
  11.  say 'this directory, under the name TEMP.BIN.'
  12.  say ' '
  13.  say 'WARNING! This example takes forever to execute'
  14.  say 'with large files..'
  15.  do until length(fname) \= 0
  16.    say ' '
  17.    say 'Please enter a valid file name..'
  18.    say ' '
  19.    say 'Example: c:\filename.exe'
  20.    say ' '
  21.    ok=charout(,"File name>")
  22.    fname = linein()
  23.    if length(stream(fname,"c", "query exists")) = 0 then
  24.    do
  25.      fname = ""
  26.      say "That file doesn't exists."
  27.    end
  28.  end
  29.  
  30.  "@del temp.bin"
  31.  
  32.  ok = stream(fname, "c","open read")
  33.  ok = stream("temp.bin","c","open write")
  34.  
  35.  count = 0
  36.  
  37.  do while chars(fname) > 0
  38.   bytes = charin(fname)
  39.   count = count + 1
  40.   ok = charout("temp.bin", bytes)
  41.  end
  42.  say count 'bytes copied.'
  43.