Main Page | Report this Page
Computers Forum Index  »  Computer - Databases - Informix  »  unload and hpl behavior...
Page 1 of 1    

unload and hpl behavior...

Author Message
Floyd Wellershaus...
Posted: Tue Nov 03, 2009 9:53 pm
Guest
I'm pretty sure the answer to this is no, but thought I'd double check.
We are using IDS10.0.FC5.
When we unload with either unload or hp loader, varchar columns that have a blank space in them show up with a backslash. For eg... a 2 column table firstname lastname may unload like this.
|floyd|\ |

I think this has to do with the db_locale and this behavior can't be changed. But am I correct ?

Also, one other thing. There are some newlines within our data that we would like to parse out with sed, but of course not get rid of the newlines at the true end of a record.
Does anyone know the sed syntax that may accomplish that ?

Thank you,
Floyd
 
Floyd Wellershaus...
Posted: Tue Nov 03, 2009 10:41 pm
Guest
Thanks Art !







----- Original Message -----
From: "Art Kagel" >;art.kagel at (no spam) gmail.com
 
Art Kagel...
Posted: Wed Nov 04, 2009 3:36 am
Guest
The quoted blank is to distinguish it from an empty field which would
indicate a NULL value is to be inserted into the column. Since VARCHAR and
LVARCHAR columns strip out trailing spaces, the single space is quoted so
that the space is loaded as a hard space and not as a zero length string.

The embedded newlines are more difficult. Sed cannot, IB, handle them at
all since it only deals with lines of data. You will have to use awk or
perl if you must use a scripting language or write a parser in 'C'. IB the
embedded newlines in the unload file format are quoted with a backslash much
as the spaces you noted. In awk it would be something like

awk '
BEGIN { str=""; }
{
line = $0;
len = length( line );
if ( substr( line, len, 1 ) == "\") {
str = str, line;
next;
} else {
str = line;
}
print str;
str = "";
}' <input.unl >output.unl

Not tested.

Art

Art S. Kagel
Oninit (www.oninit.com)
IIUG Board of Directors (art at (no spam) iiug.org)

Disclaimer: Please keep in mind that my own opinions are my own opinions and
do not reflect on my employer, Oninit, the IIUG, nor any other organization
with which I am associated either explicitly or implicitly. Neither do
those opinions reflect those of other individuals affiliated with any entity
with which I am affiliated nor those of the entities themselves.



On Tue, Nov 3, 2009 at 4:53 PM, Floyd Wellershaus <floyd at (no spam) fwellers.com>wrote:

Quote:
I'm pretty sure the answer to this is no, but thought I'd double check.
We are using IDS10.0.FC5.
When we unload with either unload or hp loader, varchar columns that have a
blank space in them show up with a backslash. For eg... a 2 column table
firstname lastname may unload like this.
|floyd|\ |

I think this has to do with the db_locale and this behavior can't be
changed. But am I correct ?

Also, one other thing. There are some newlines within our data that we
would like to parse out with sed, but of course not get rid of the newlines
at the true end of a record.
Does anyone know the sed syntax that may accomplish that ?

Thank you,
Floyd


_______________________________________________
Informix-list mailing list
Informix-list at (no spam) iiug.org
http://www.iiug.org/mailman/listinfo/informix-list

 
 
Page 1 of 1    
All times are GMT
The time now is Sun Nov 29, 2009 6:58 am