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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is a DATA LINE ESCAPE(CHR(16)?

Status
Not open for further replies.

culleoka

Programmer
May 16, 2002
85
US
I am using a third-party database program to pull information on 211,000+ part numbers.

I enter the part numbers into a data file(copy fieldname SDF), and run the batch form of the program. It then generates a comma delimited text file and I append the delimited file to a Foxpro table.

This program, in it's many different variations, has worked
fine for me for 6 years.

Today, after installing this months version, it is coming up with weird data. Some of the records have a chr(16) inserted at the beginning of the noun field. A little research showed that chr(16) is a Data Line Escape.

This only happens to about half the records.

Can anyone tell me where this character might be coming from or an example of what it might be used for?

I am pretty sure the third-party software is an Oracle database with a VB front end.

Pat
 
Before importing the fitle, do a strtran() on the file and do a filetostr() and then, str2file ...

Ali Koumaiha
TeknoSoft Inc
Farmington Hills, Michigan
 
Pat,

Don't waste time trying to find what 'data line escape' means. The term is a hang-over from teletype days, when the first 32 ASCII characters were all used for special control functions.

Just regard the character in question as rubbish and strip it out, for example using Ali's suggestion. Your code would look something like this:

MyVar = FileToStr('MySDFFile.txt')
MyVar = strtran(MyVar,chr(16),"")
StrToFile(MyVar,'MyNewSDFFile')

then import MyNewSDFFile.

Mike



Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Thanks to Mike Lewis and Ali Koumaiha!
I appreciate the time you took to respond to my post. Although the aggregate solution proposed will probably strip that particular character, there are three other ascii characters in this file also and a varying number of alpha-numeric characters on each side of them.
I have contacted the third-party vendor who provides this database software since this post, and they agree there is a problem with the data output from their database.
Since the number of corrupt char's varies from four to seven in different records, and there is no way to tell which char's are the corrupt ones, it looks like I will just have to muddle through with January's data until they fix it.
But, thanks again for your attempt to help!

Patrick McGreevy
(Culleoka)
 
Pat,

You could always write a little program to strip out ALL characters whose ASCII code is less than 32. Something like this (not tested):

MyVar = FileToStr('MySDFFile.txt')
MyNewVar = ""
FOR J = 1 TO LEN(MyVar)
IF ASC(SUBSTR(MyVar,J,1)) >= 32
MyNewVar = MyNewVar + SUBSTR(MyVar,J,1)
ENDIF
ENDFOR
StrToFile(MyNewVar,'MyNewSDFFile')

But, as you say, the only real solution is to find out how the corruption got there in the first place and to get rid of it.

Mike



Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top