Subject Re: separator for CSV file to be imported into dBase
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Wed, 23 Sep 2020 19:31:24 +0530
Newsgroups dbase.getting-started

> I have some large CSV files to get imported into dBase.
> the fields separators being ";" dBase does not like that
> Since I cannot change the fields separators. How could i go around the limitation and find a way to import the CSV file into dBase


Good Evening Jean,
You will have to opt in for DIY route.

The following code should give you some ideas. It is replacing Tab (chr
9) with ,

Regards
Akshat

       set safety off
       use attend.dbf excl
       zap
       fout = new file()
       fin = new file()
       in_file = getfile("AGL_0001.txt")
       if not empty(in_file)
          fin.open(in_file)
          fout.create("attendance.csv")
          for a = 1 to 5
             chr_str = fin.readln()
          endfor
          do while not fin.eof()
             chr_str = fin.readln()
             do while at(chr(9),chr_str) >0
                chr_str = stuff(chr_str,at(chr(9),chr_str),1,",")
             enddo
             fout.writeln(chr_str)
          enddo
          fin.close()
          fout.close()
          append from attendance.csv delimited with ","
          go top
          mname = attend->name
          mdate = new date(attend->date_time)
          do while not eof()
             skip
             if mname = attend->name and (mdate - new
date(attend->date_time))*24*60*60 <45
                delete
             else
             endif
             mname = attend->name
             mdate = new date(attend->date_time)
          enddo
       endif
       use