home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / icetag26.zip / iceidx26.cmd < prev    next >
OS/2 REXX Batch file  |  1997-02-22  |  1KB  |  52 lines

  1. /* REXX script to read icequote files */
  2. /* and attach them to PMMail e-mails  */
  3. /* (c) 1997 Ahmad Al-Nusif            */
  4. /*          morpheus@moc.kw           */
  5. /*        Version 2.6          */
  6.  
  7. Parse Arg destfile
  8. '@echo off'
  9.  
  10. /* if the file you're using is different, change the name below */
  11. File='pqf4.quo'
  12. Index="pqf4.idx"
  13. call rxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  14. call sysloadfuncs
  15.  
  16.  
  17. call SysFileDelete index
  18. call IndexIt
  19. rc = LineOut(,"Done. The file produced is "index)
  20.  
  21. IndexIt:
  22.             charcount='0'
  23.         cnt = '0'
  24.         line='0'
  25.         tlines='0'
  26.             do While Lines(File) > 0
  27.         rc=lineout(index,charcount)
  28.             /* i think it's counting the CR+LF at the end of each line */
  29.                do forever
  30.           line=line+1
  31.           /* tlines=tlines+1 */
  32.                   tmpline=LineIn(File)
  33.           charcount=charcount+length(tmpline)
  34.                   test=pos('#',tmpline)
  35.                   if test\='0' then do
  36.             rc=lineout(index,line)
  37.             charcount=charcount+(line*2)
  38.             line='0'
  39.             leave
  40.                      end
  41.                 end
  42.             end
  43. return
  44.  
  45. CountLines:
  46.             count = 0
  47.             do While Lines(File) > 0
  48.                count = count + 1
  49.                tmp=linein(file)
  50.             end
  51. return
  52.