Writing to file - example

va2rc

New Member
Hello to you, i'm looking to have an example how to read my database and write somes information to a .txt file.

I'm using an old version of databse, 8.3b

thank you for help.

Francois
 

rstanciu

Member
something like ...
DEFINE STREAM ls.
OUTPUT STREAM ls TO c:\temp\test.txt.
FOR EACH Customer NO-LOCK:
PUT STREAM ls UNFORMATTED CustNum AT 3.
PUT STREAM ls UNFORMATTED Name AT 7.
PUT STREAM ls UNFORMATTED City AT 45 SKIP.
END.
OUTPUT STREAM ls CLOSE.
 

TomBascom

Curmudgeon
8.3b isn't just "old"...

It is ancient (as in primeval), obsolete (not even y2k compatible and missing so many good new features that my head hurts) and very, very unsupported.

None the less it is a release that I feel a certain residual fondness for. Even if doing so does reveal me to be a living dinosuar :awink:
 

va2rc

New Member
Thank you for the example.

Yes this version is verry old, we are moving to Oracle 10g on this one.

Thank you.

Francois
Quebec City, Canada
 

TomBascom

Curmudgeon
If you're extracting data then you might prefer to do something like:

Code:
output to "customer.txt".
for each customer no-lock:
  export customer.
end.
output close.

This will produce a space delimited data file with quoted strings. Which is usually what you want if you're extracting the data to be used elsewhere.

I'm not 100% sure (v8 was a very, very long time ago) but I think that v8 supports an optional delimiter so if you would prefer something else (perhaps a comma) you could do:

Code:
output to "customer.txt".
for each customer no-lock:
  export delimiter "," customer.
end.
output close.
 
Top