home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / MEDIAPOINT3.DMS / in.adf / ARexx.lha / Dbase.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1993-10-15  |  835 b   |  27 lines

  1. /* Create an ASCII file from a binary file for use in MediaPoint*/
  2. /* This example can e.g. be used to extract stock information and
  3.    save it as a file which can be crawled */
  4.  
  5. ADDRESS COMMAND
  6. OPTIONS RESULTS
  7.  
  8. CALL OPEN('infile','m:arexx/rek2.dbf','R')            /*Open the binary file*/
  9. CALL OPEN('outfile','ram:CrawlFile','W')                /*Open the new file*/
  10. OFFSET=256                                                                            /*Skip the header?*/
  11. streamin = READCH('infile',2000)                                /*Read 2000 bytes from file*/
  12.  
  13. do i = OFFSET to 2000
  14.     CALL Filter(i)                                                                /*Filter out obsolete bytes*/
  15. end 
  16. exit
  17.  
  18. Filter:
  19. arg(i)
  20. IF C2D(substr(streamin,i,1))>47 then                        /*Only text and digits*/
  21.     IF C2D(substr(streamin,i,1))<123 then 
  22.         CALL WRITECH('outfile',substr(streamin,i,1))
  23. IF C2D(substr(streamin,i,1))=32 then                        /*Keep the spaces*/
  24.     CALL WRITECH('outfile',D2C(10))
  25. return
  26.  
  27.