RE: OUTPUT ... and File Layout
Posted in 2003
Topics: Server Administration, Migration, Import/Export & Data Conversion
Flattery will get you everywhere!
TJ
>From: "Dirk Moolman" <DirkM@mxgroup.co.za>
>To: "The Joker" <monsieur_argent@hotmail.com>
>CC: <informix-list@iiug.org>
>Subject: RE: OUTPUT ... and File Layout
>Date: Thu, 22 May 2003 15:19:53 +0200
>
>Excellent !! Thanks, I used this principle, changing the output to an
>unload, like in your example, and then used "sed" to fill in the rest.
>
>Works like a dream !
>
>Thanks TJ
>
>
>Regards
>Dirk
>
>
>
>-----Original Message-----
>From: The Joker [mailto:monsieur_argent@hotmail.com]
>Sent: Thursday, May 22, 2003 2:57 PM
>To: Dirk Moolman
>Subject: RE: OUTPUT ... and File Layout
>
>Dirk
>
>If this is to be passed into another script or just written to a file then
>I
>would unload the data required and reformat in say [n]awk or sed. It should
>be easy and just as efficient.
>
>For example: [not full code]
>
>dbaccess -e DBNAME <<SQLEND 2>&1>UNLOAD TO '/path/myfile' DELIMITER '|'
> SELECT UNIQUE tabname, colname
> FROM systables a, syscolumns b, sysindexes c
> WHERE a.tabid = b.tabid
> AND b.tabid = c.tabid
> AND b.colno = c.part1
> AND a.tabid > 99
> AND tabtype = 'T'>;
>SQLEND
>
>if [ -s "/path/myfile" ]; then
> nawk -D"|" '
> { # Process each line into SQL
> printf "UPDATE STATISTICS HIGH FOR TABLE %s (%s)\\n",$1,$2
> printf " DISTRIBUTIONS ONLY;\\n"
> }' /path/myfile > /path/mywfile.new
>
> # If you then want to action file
> cat /path/myfile.new | dbaccess -e DBNAME - 2>&1
>fi
>
>
>If that is what you want and I would suggest you hold DBNAME and file names
>in variables. I have not fully tested this script but I have many like this
>one I use all the time. Do you have enough room to swing the cat, cause you
>can skin it many ways!! Play with it, you'll get it to work .... ;-)
>
>TJ
>
>_________________________________________________________________
>On the move? Get Hotmail on your mobile phone
>http://www.msn.co.uk/msnmobile
>
_________________________________________________________________
Hotmail messages direct to your mobile phone http://www.msn.co.uk/msnmobile
"The Joker" <monsieur_argent@hotmail.com> wrote in message news:bailtm$anf$1@terabinaries.xmission.com... > > Flattery will get you everywhere! > > TJ That and a couple of beers...