home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: InfoMgt / InfoMgt.zip / random31.zip / Upgrade.cmd < prev   
OS/2 REXX Batch file  |  2000-05-24  |  1KB  |  51 lines

  1. /*
  2.      Upgrade.cmd
  3.      Randomizer v3.1 by Don Eitner, 2000
  4.  
  5.      Upgrades your existing Randomizer v2.2 datafiles to v3.0 format.
  6.  
  7.      This code is neither supported nor under warranty.  Feel free to
  8.      examine and modify this script for your own purposes.  See the
  9.      included readme.txt for additional information.
  10. */
  11.  
  12. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  13. call SysLoadFuncs
  14.  
  15. fields = linein('RandomField.dat',,1)
  16.  
  17. x1 = lastpos(' ', fields) /* That's ASCII code Alt-255 */
  18. do while x1 <> '0'
  19.     data2 = substr(fields, x1+1)
  20.     data1 = substr(fields, 1, x1-1)
  21.     fields = data1||''||data2
  22.     x1 = lastpos(' ', fields) /* ASCII Alt-255 again */
  23. end
  24.  
  25. count = words(fields)
  26.  
  27. do num = 1 to count
  28.     item.num = linein('RandomData.dat',,1)
  29.     x1 = lastpos(' ', item.num) /* That's ASCII code Alt-255 */
  30.     do while x1 <> '0'
  31.        data2 = substr(item.num, x1+1)
  32.        data1 = substr(item.num, 1, x1-1)
  33.        item.num = data1||''||data2
  34.        x1 = lastpos(' ', item.num) /* ASCII Alt-255 again */
  35.     end
  36. end
  37.  
  38. call lineout('RandomField.dat')
  39. call lineout('RandomData.dat')
  40.  
  41. rc = SysFileDelete('RandomField.dat')
  42. rc = SysFileDelete('RandomData.dat')
  43.  
  44. call lineout 'RandomData.dat', fields
  45. do num = 1 to count
  46.     call lineout 'RandomData.dat', item.num
  47. end
  48. call lineout('RandomData.dat')
  49.  
  50. exit
  51.