TIP: Click on subject to list as thread! ANSI
echo: clipper
to: BEN CAVANAGH
from: DIRK STUIJFZAND
date: 1998-04-05 15:12:00
subject: Text File

On 02-04-1998, Ben Cavanagh wrote to All:
BC> I need to translate text files into DBF files. The filesize of these
BC> files are around 500k.
BC> 
BC> I want to read the text file line by line and add each lines into the
BC> DBF file. Like readln() in Pascal
Create a temp DBF with one CHAR field, lenght >= longest line length
in txt file. Example: TEXT.DBF, field LINE, type C, LEN 80
USE TEXT
ZAP
APPE FROM text.doc SDF
This is very simple, even works in dBaseIII! Now you have a DBF where
every line from the textfile is a record in TEXT.DBF. You can loop
trough this dbf and parse it at will:
dbSelectArea('TEXT')
WHILE !EOF()
  cName := SUBS(Text->Line,1,30)
  cPhone:= SUBS(Text->Line,60,15)
  dbSelectArea('PERSON')
  APPEND BLANK
  Person->Name := cName
  Person->Phone:= cPhone
  dbSelectArea('TEXT')
  dbSkip()
ENDD
Dirk
Cliphead since 1988
--- Maximus/2 2.02
---------------
* Origin: Chat OS2BBS * Koog a/d Zaan NL * (2:280/801)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.