home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: SysTools / SysTools.zip / crontab.zip / convert.cmd next >
OS/2 REXX Batch file  |  1998-01-18  |  2KB  |  56 lines

  1. /************************************************************************/
  2. /* install.cmd                                                          */
  3. /* Created: 18 Jan 1998                                                 */
  4. /* Author: J. Pedone                                                    */
  5. /* jpedone@flash.net                                                    */
  6. /************************************************************************/
  7.  
  8. Call RxFuncAdd SYSLOADFUNCS, REXXUTIL, SYSLOADFUNCS
  9. call SysLoadFuncs
  10. Signal on Halt
  11. tab='09'x
  12. cr = '0d'x
  13. lf = '0a'x
  14. workdir = Directory()
  15. fworkdir = workdir||'\'
  16.  
  17. arg data_file
  18. if data_file = ' ' The Do
  19.     data_file = 'CRONTAB'
  20. End
  21. i = 0
  22. do while lines(data_file) > 0
  23.     i = i+1
  24.     table.0 = i
  25.     line = linein(data_file)
  26.     parse var line table.i.minutes'/'table.i.hours'/'table.i.dates'/'table.i.months'/'table.i.days'/'table.i.years'/'table.i.session'/'table.i.file table.i.parameters
  27.     if pos('~',table.i.parameters) > 0 Then Do
  28.         table.i.type = 'Message'
  29.         temp_sep=lastpos('~',table.i.parameters)
  30.         temp_end = length(table.i.parameters)
  31.         temp_sep=temp_sep-1
  32.         table.i.file = substr(table.i.parameters,1,temp_sep)
  33.         temp_sep=temp_sep+2
  34.         table.i.parameters=substr(table.i.parameters,temp_sep,temp_end)
  35.         table.i.close = 'Yes'
  36.         table.i.workdir = ' '
  37.         table.i.session = 'Default'
  38.     End
  39.     Else Do
  40.         table.i.type = 'Program'
  41.         table.i.close = 'Yes'
  42.         temp_end=lastpos('\',table.i.file)
  43. /*        temp_end=temp_end+1 */
  44.         table.i.workdir=substr(table.i.file,1,temp_end)
  45.     End
  46. End
  47. Do i = 1 to table.0
  48.     If pos('#',table.i.minutes) = 0 Then Do
  49.         cron.i = table.i.minutes'≡'table.i.hours'≡'table.i.dates'≡'table.i.months'≡'table.i.days'≡'table.i.years'≡'table.i.session'≡'table.i.type'≡'table.i.file'≡'table.i.parameters'≡'table.i.workdir'≡'table.i.close
  50.         rc=lineout('newdata',cron.i)
  51.     End
  52. End
  53.  
  54. halt:
  55. rc = Stream('newdata','C','Close')
  56.