Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read ASCII File in Clarion 6.3

Status
Not open for further replies.

mlowe9

Programmer
Apr 3, 2002
221
US
I am trying to read an ASCII file in Clarion 6.3, and I'm having a little trouble with it. I've tried 2 methods, one where I define the file using FILE,DRIVER('ASCII'... and one using the AsciiFileClass, but I can't get either to work for me.

Could someone please give me some very simple sample code using either method that I can use as a base? I've tried using the examples in the Help files, but also to no avail.

Thank you in advance.
 
Hi!

The first thing I need to know is what is the format of the file you are reading i.e. does it have data separators, is it fixed length, etc? If you past the first few lines here it will help me understand your requirement better.

An example is shown below ::

1. Add ASCII driver to your project Database Drivers.

2. Data Section of procedure ::

ADTFILE FILE,DRIVER('ASCII'),PRE(ADT),NAME(GLO:ADTFile),CREATE
RECORD RECORD
Data STRING(194)
. .

3. Code Section - in the embed you want ::

OPEN(ADTFile, 12H)
IF ERRORCODE() ... END

SET(ADTFILE)
LOOP
NEXT(ADTFILE)

IF ERRORCODE() THEN BREAK.

...
END

CLOSE(ADTFILE)

Regards
 
Beautiful. I think that's sufficient. I'll be back if I get stuck again, but this is what I was looking for.

I was missing the database driver and the SET command. What exactly does the SET command do?
 
Hi!

SET() for an ASCII/BASIC/DOS driver, it initiates sequantial processing from the beginning or at a particular byte offset.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top