home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / vrac / etelr15.zip / ETFIX15.CMD < prev    next >
OS/2 REXX Batch file  |  1994-05-30  |  3KB  |  108 lines

  1. /* Use this script to convert ET_FIX.INI and ET_FIXED.INI from version 1.x of
  2.    E-Teller to version 1.5
  3.  
  4.    To convert these files, simply run etfix15.cmd
  5. */
  6. '@echo off'
  7. 'cls'
  8. say 'E-Teller 1.5 ET_Fix/ET_Fixed file conversion utility.'
  9. say ''
  10. fix = 'ET_FIX.INI'
  11. newfix = 'et_fix.dat'
  12. fixed = 'ET_FIXED.INI'
  13. newfixed = 'et_fixed.dat'
  14. rcfix = stream( fix, 'c', 'query exists' )
  15. rcfixed = stream( fixed, 'c', 'query exists' )
  16. if rcfix <> '' then do
  17.    filename = fix
  18.    call FixFile
  19. end
  20. if rcfixed <> '' then do
  21.    filename = fixed
  22.    call FixFile
  23. end
  24. exit
  25.  
  26. FixFile:
  27. if RxFuncQuery( 'SysIni' )then do
  28.     call RxFuncAdd 'SysIni', 'RexxUtil', 'SysIni'
  29. end
  30. if filename = 'ET_FIX.INI' then
  31.    NFileName = 'et_fix.dat'
  32. else
  33.    NFileName = 'et_fixed.dat'
  34.  
  35. call SysIni filename, 'ALL:', 'days'
  36. if days.0 <> 0 then do
  37.     do i = 1 to days.0
  38.       if( DataType( days.i ) = 'NUM' ) then do
  39.          if( Length( days.i ) = 1 )then
  40.             WDay = '[0'||days.i||']'
  41.          else
  42.             WDay = '['||days.i||']'
  43.          say 'Writing entry for day: 'WDay
  44.          call lineout NFilename, WDay                    /* write the day to *.dat */
  45.       end
  46.       call SysIni filename, days.i, 'ALL:', 'names'   /* names = *.ldg */
  47.       do j = 1 to names.0
  48.          value = SysIni( filename, days.i, names.j )
  49.          parse var value '"' date '","' number '","' info '","' credit '","' debit '","' memo '","' cat '"' .
  50.          if( DataType( days.i ) = 'CHAR' )then do
  51.             cls
  52.             say 'E-Teller 1.4 contained an error.'
  53.             say 'As a result, the incorrect day-of-month was saved along with the following'
  54.             say 'transaction:'
  55.             say ''
  56.             say '    Date:  'date
  57.             say '    Num:   'number
  58.             say '    Info:  'info
  59.             say '    Trans: 'trans
  60.             say '    Memo:  'memo
  61.             say '    Categ: 'cat
  62.             say ''
  63.             parse var date yy '/' mm '/' dd
  64.             say 'Should 'dd' be used for this entry (Y/n)?'
  65.             parse upper pull answer
  66.             if answer = 'N' then do
  67.                say 'Please enter a day-of-month value: '
  68.                do until Datatype( answer ) = 'NUM' & answer <= 31
  69.                   parse pull answer
  70.                   if( Datatype( answer ) <> 'NUM' | answer > 31 )then do
  71.                      call beep 2048,256
  72.                      say 'Please enter a valid number.'
  73.                   end
  74.                end
  75.                dd = answer
  76.             end
  77.             if( Length( dd ) = 1 )then
  78.                dd = '[0'||dd||']'
  79.             else
  80.                dd = '['||dd||']'
  81.             call lineout NFileName, dd
  82.          end
  83.          call lineout NFileName, names.j              /* write the filename.ldg to *.dat */
  84.          call lineout NFileName, number
  85.          call lineout NFileName, info
  86.          if credit = 0 then
  87.             trans = '-'||debit
  88.          else
  89.             trans = credit
  90.          call lineout NFileName, trans
  91.          call lineout NFileName, memo
  92.          if cat <> '-' then
  93.             call lineout NFileName, cat
  94.          else
  95.             call lineout NFileName, ''
  96.          call lineout NFileName, '----------'
  97.       end
  98.    end
  99. end
  100. return
  101.  
  102. StopProcess:
  103. say ''
  104. say 'Filename 'ldgFile' does not exist.  Process stopped.'
  105. call stream filename, 'c', 'close'
  106. exit
  107.  
  108.