dbload +Steuerzeichen am Zeilenende
Posted in 2003
A user loading a fixed-position text file with dbload (old INFORMIX-SQL on Red Hat Linux) found a stray character stored as "?" at the end of short lines; vi showed it as ^M. Replies identified it as the DOS carriage return from a file created on Windows, and suggested dos2unix or sed 's/^M//g' (the ^M must be a literal CR) to strip it. The poster reported the "?" persisted after the sed attempt, and the thread ends with a question about whether all records really are at least 96 characters long (dbload needs fixed-length records). No confirmed resolution is recorded.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: General Discussion
When I load a file with dbload (INFORMIX) into a table, especially with
variable linelength, the (I suppose) Curridge return-Sign is loaded as well
and is shown as "?" in the table. How can I avoid this?
Thank you for help
Philipp Walderdorff
DBLOAD does NOT convert <CR><LF> to question marks.
If you are using dbload on UNIX machine and unload was made on PC, then I
suggest using dos2unix utility - it converts <CR><LF> pairs into <LF> only
character.
Of course it may be version and machine dependant. It would be nice to know
a little bit more about your environment.
Gorazd
"Philipp Walderdorff" <ph.walderdorff@gmx.at> wrote in message
news:3f7d85df$0$20876$91cee783@newsreader02.highway.telekom.at...
> When I load a file with dbload (INFORMIX) into a table, especially with
> variable linelength, the (I suppose) Curridge return-Sign is loaded as
well
> and is shown as "?" in the table. How can I avoid this?
>
> Thank you for help
> Philipp Walderdorff
I am using the very old version INFORMIX-SQL Version 2.10.00B 1984-1987 on a RedHat LINUX 7.3 and RedHat 6.0 The source-file (file.txt) was created by the austrian health-authority. I do not know, on whitch system they created it, but I suppose on Windows-PC, because they use to write textfiles normaly in .doc extension. The file was sent to me per email direct into my LINUX-PC. This line is loaded into table medikamente as following: 0000388 50ml 155 003M02AC5201 PERFORM: Query Next Previous Add Update Remove Table Screen ... Searches the active database table. ** 1: medikamente table** pharma_nr [0000388] preistext [ ] menge [50 ] mengenart [ml] kp [155 ] kp_per_unit [3 ] atc [M02AC52] laufnr [1 ] staerke [? ] starkdim [ ] f [ ] kommentar [ ] The column "staerke" had loaded "?" Why? he next row: 0000922 25St 225 009N05BA04000,01 2 is loaded as the following: PERFORM: Query Next Previous Add Update Remove Table Screen ... Shows the next row in the Current List. ** 1: medikamente table** pharma_nr [0000922] preistext [ ] menge [25 ] mengenart [St] kp [225 ] kp_per_unit [9 ] atc [N05BA04] laufnr [0 ] staerke [0,01 ] starkdim [ ] f [2?] kommentar [ ] The column "f" has got a ? Why? Isn't it the Marker of the end of the line in the source-file? This "?" is coursing problems with the software, saying unnunderstandable signe. So this "?" is not a "?" It must be some other sign. At another time I could read this sign as "^M", but now I cannot manage to reconstruct, how I did that. I hope, you have enough information to get an idea, what the problem could be. Thanks for help. Philipp
On Fri, 03 Oct 2003 18:01:23 +0200, Philipp Walderdorff
<ph.walderdorff@gmx.at> wrote:
>I am using the very old version INFORMIX-SQL Version 2.10.00B 1984-1987
>on a RedHat LINUX 7.3 and RedHat 6.0
>
>The source-file (file.txt) was created by the austrian health-authority. I
>do not know, on whitch system they created it, but I suppose on Windows-PC,
>because they use to write textfiles normaly in .doc extension. The file was
>sent to me per email direct into my LINUX-PC.
>
>
Fixed length or variable length?
How was the text file copied from the PC to the Linux box?
>
>This line is loaded into table medikamente as following:
>0000388 50ml 155 003M02AC5201
>
>
>PERFORM: Query Next Previous Add Update Remove Table Screen ...
>Searches the active database table. ** 1: medikamente table**
>pharma_nr [0000388]
>preistext [ ]
>menge [50 ]
>mengenart [ml]
>kp [155 ]
>kp_per_unit [3 ]
>atc [M02AC52]
>laufnr [1 ]
>staerke [? ]
>starkdim [ ]
>f [ ]
>kommentar [ ]
>
>
>The column "staerke" had loaded "?"
>
>Why?
Could be garbage from the file. If you're using dbload, then the
record length needs to be fixed.
>
>he next row:
>0000922 25St 225 009N05BA04000,01
> 2
>is loaded as the following:
...clipped...
ps.:
Now I found it out: On my ancient XENIX-PC the editor "vi" shows this sign
at the end of the line as "^M". This sign is loaded by dbload and shown
as "?"
Philipp
>Fixed length or variable length?
>How was the text file copied from the PC to the Linux box?
The textfile was sent per email as a -zip file from the health service
direct onto my LINUX-PC, There I clicked on it and the Konquerer opende it
copied it per "cp file.txt /home/ein" I suppose, I did so. Or I copied it
per RedHat-Konquerer (Drag and drop). I could try again.
Tanks to Richard Thompson, who had written a mail with the advice:
REMOVE THE CURRIDGGGE(CARRIDGE) RETURN FROM THE FILE
Sed 's/^M//g' myfile > newfile
I have done: sed 's/^M//g' medika.txt > medika.txt.c
THEN
/usr/informix/bin/dbload -d arzt -c medika.cmd -l err
file "medika.txt.c"
(fld1 1-7 ,
fld2 8-35,
fld3 36-40 ,
fld4 41-42 ,
fld5 43-51,
fld6 52-60,
fld7 61-67,
fld8 68-69,
fld9 70-79,
fld10 80-88,
fld11 89-90,
fld12 91-96 );
insert into medikamente;
BUT THE "?" STILL REMAINED after the last charakter which has been loaded.
>PERFORM: Query Next Previous Add Update Remove Table Screen ...
>Searches the active database table. ** 1: medikamente table**
>pharma_nr [0000388]
>preistext [ ]
>menge [50 ]
>mengenart [ml]
>kp [155 ]
>kp_per_unit [3 ]
>atc [M02AC52]
>laufnr [1 ]
>staerke [? ]
>starkdim [ ]
>f [ ]
>kommentar [ ]
Very strange!
Any Idea left :-)
Thanks
Philipp
On Fri, 03 Oct 2003 19:25:17 +0200, Philipp Walderdorff
<ph.walderdorff@gmx.at> wrote:
> >Fixed length or variable length?
>>How was the text file copied from the PC to the Linux box?
>
>The textfile was sent per email as a -zip file from the health service
>direct onto my LINUX-PC, There I clicked on it and the Konquerer opende it
>copied it per "cp file.txt /home/ein" I suppose, I did so. Or I copied it
>per RedHat-Konquerer (Drag and drop). I could try again.
>
>
>Tanks to Richard Thompson, who had written a mail with the advice:
>
>REMOVE THE CURRIDGGGE(CARRIDGE) RETURN FROM THE FILE
>
>Sed 's/^M//g' myfile > newfile
>
>I have done: sed 's/^M//g' medika.txt > medika.txt.c
>THEN
>/usr/informix/bin/dbload -d arzt -c medika.cmd -l err
>
> file "medika.txt.c"
> (fld1 1-7 ,
> fld2 8-35,
> fld3 36-40 ,
> fld4 41-42 ,
> fld5 43-51,
> fld6 52-60,
> fld7 61-67,
> fld8 68-69,
> fld9 70-79,
> fld10 80-88,
> fld11 89-90,
> fld12 91-96 );
>
>insert into medikamente;>
>BUT THE "?" STILL REMAINED after the last charakter which has been loaded.
>
Are all the records at least 96 long?