If they're sequential (open for output) files, you don't have to do
anything.
They're already readable. If they're random or relative files
use a GW-BASIC program to read them in and PRINT them to a sequential file.
It will help greatly to know what FIELD statement was used to create them.
If you don't it will take more work but it's not impossible.
Tom Lake
Thank you
"Tom Lake" <toml_...@hotmail.com> wrote in message
news:5B4B06F4-D274-49BB...@microsoft.com...
>When I look at the DAT files with a text editor I see all kinds of control
>characters in the files. How do I just get the data out of the fies
>cleanly?
As Tom pointed out, a sequential file written by GW (or Q)Basic is a simple falt
ascii file without the formatting crud that word-porcessors often add. If there
are any characters other than the actual data or CR/LF in there, it is
part_of_the_data that was written. The problem boils down to either writing
some lines of code to parse the files you have, or fix the source that is
creating these files.
Can you give us an example of what you are seeing - preferably with a hex editor
so we can see the actual "codes"?
The control characters could be data stored in bit form. If by "get the data
out of the files cleanly", you mean to just remove all non-alpha-numeric
characters, that can be done easily with the following code. If you want to
also remove all CR and LF characters, then remove the "10, 13," from the
CASE line. If you want anything cleaner than that, then you will have to
provide the program code that created the data file and/or provide the data
file.
OPEN "MyData.dat" FOR BINARY AS #1
OPEN "Output.txt" FOR OUTPUT AS #2
in$ = " "
FOR i = 1 TO LOF(1)
GET #1, i, in$
SELECT CASE ASC(in$)
CASE 32 TO 126
ii = ii + 1
PRINT #2, in$;
END SELECT
NEXT i
CLOSE
--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)
Records appear to be 300 characters in length. This will insert CRLF every
300 characters in the output file so you can identify field lengths.
OPEN "supplier.dat" FOR BINARY AS #1
OPEN "Output.txt" FOR OUTPUT AS #2
in$ = SPACE$(300)
FOR i = 1 TO LOF(1) STEP 300
GET #1, i, in$
PRINT #2, in$; CHR$(13); CHR$(10);
Thank you very much.
How did you determine the record length I have 2 or three more files I must
do the same with.
"Todd Vargo" <tlv...@sbcglobal.netz> wrote in message
news:%23faB5JJ...@TK2MSFTNGP02.phx.gbl...
Deductive reasoning. I looked at the file for a pattern and then counted the
number of characters. Luckily, there was no header to skip over. If you
change the names in the code and try it on the other files you might get
lucky.