473,405 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

db2 Script and Outputlinesize

Hi, there .....

coming from the Oracle World I am wondering if there is a DB2 command
like "set linesize 1000" in SQL*Plus.

The DB2 Commandline inserts <CR> after n Characters but I want all
characters from a SELECT Row in one line.

How do I do that with DB2.

Sorry for my bad english.

Kind regards

Michael

Nov 12 '05 #1
14 8976
> coming from the Oracle World I am wondering if there is a DB2 command
like "set linesize 1000" in SQL*Plus.


oracle has a lot of built-in functionality for creating primitive
reports from sql. I suspect that today this is mostly used for
exporting data to files (since the oracle export utility is an add-on
cost).

db2 doesn't have much functionality for creating reports directly out
of sql - but it has a free export utility. So, it really doesn't need
this functionality much.

buck

Nov 12 '05 #2
Correct.

I am not exporting any data. i have a simple script that reads some
data for monitoring the db2 instance.

the output of the script is displayed on a web page (NAGIOS) to show
the status of the database.

script is :

SELECT CASE(HI_ID)
WHEN 1001 THEN 'state of the database'
WHEN 1002 THEN 'shared sorting mem util'
WHEN 1003 THEN 'percent sort overflow'
WHEN 1004 THEN 'max sort mem used'
WHEN 1005 THEN 'fullness of transaction log'
WHEN 1006 THEN 'fullness of log FS'
WHEN 1007 THEN 'rate of deadlock'
WHEN 1008 THEN 'locklist utilization'
WHEN 1009 THEN 'DB lock esc. rate'
WHEN 1010 THEN 'percent apps waiting on locks'
WHEN 1011 THEN 'package cache hitratio'
WHEN 1012 THEN 'catalog cache hitratio'
WHEN 1013 THEN 'shared SQL workspace hitratio'
WHEN 1014 THEN 'heap utilization'
WHEN 1015 THEN 'manual reorg required'
WHEN 1016 THEN 'hadr op status'
WHEN 1017 THEN 'hadr delay'
WHEN 1018 THEN 'manual backup required'
WHEN 1022 THEN 'runstats'
ELSE CHAR(HI_ID)
END as "AREA OF ISSUE",
HI_ALERT_STATE_DETAIL AS STATUS,
HI_VALUE, substr(HI_ADDITIONAL_INFO,1,100) as HI_ADDITIONAL_INFO
FROM DB2$HEALTH_DB_HI
WHERE HI_ALERT_STATE != 1

and the view DB2$HEALTH_DB_HI is defined as

create view DB2$HEALTH_DB_HI as select * from
table(health_db_hi('',-1)) as sntable;

The work has been done by a guy named eaton. I am just in the process
to build a simple naggios plugin to monitor db2

kind regards

Michael

Nov 12 '05 #3
Ian
mi****************@web.de wrote:
Hi, there .....

coming from the Oracle World I am wondering if there is a DB2 command
like "set linesize 1000" in SQL*Plus.

The DB2 Commandline inserts <CR> after n Characters but I want all
characters from a SELECT Row in one line.


The DB2 CLP does *not* insert line breaks. If you are seeing data that
appears to be on multiple lines that is your shell wrapping the long
lines.

i.e. db2 -x "select really,long,column,list from table" > x.out

should have N number of lines, where N = number of rows in table.

Nov 12 '05 #4
it *does* at least this one :-)

db2inst1@db2host:/home/db2inst1 # db2 -tf /nagios/bin/health_check.sql
/var/tmp/lala

db2inst1@db2host:/home/db2inst1 # wc /var/tmp/lala
7 13 353 /var/tmp/lala
db2inst1@db2host:/home/db2inst1 # cat /var/tmp/lala

AREA OF ISSUE STATUS HI_VALUE
HI_ADDITIONAL_INFO
----------------------------- -------------------- --------
----------------------------------------------------------------------------------------------------

0 Satz/Sätze ausgewählt.

Nov 12 '05 #5
Hi Michael,

if you investigate the result file you might find that there is one
empty row at the start and 3 empty rows at the end of the file.

Even the switch "-x" adds one empty row at the end.

regards,

Norbert
Nov 12 '05 #6
Yes ! And then ... ?-)

-x means suppress column headers. It does not seem to be so simple.I
think I gonna write a small perl/python script

Nov 12 '05 #7
Buck Nuggets wrote:

since the oracle export utility is an add-on cost.

The oracle export utility is not an add-on cost
Nov 12 '05 #8
Michael,

mi****************@web.de schrieb:
Yes ! And then ... ?-)

-x means suppress column headers. It does not seem to be so simple.I
think I gonna write a small perl/python script


This was just to show you that this is no option as well and db2 is
_NOT_ wrapping lines. Sorry for the confusion.

For nagios, I would write a wrapper around that which gives proper
return-codes and just one short line of (HTML) text linking to the
"long"-Output.

regards,

Norbert

Nov 12 '05 #9
mi****************@web.de wrote:
it *does* at least this one :-)

db2inst1@db2host:/home/db2inst1 # db2 -tf /nagios/bin/health_check.sql
/var/tmp/lala db2inst1@db2host:/home/db2inst1 # wc /var/tmp/lala
7 13 353 /var/tmp/lala
db2inst1@db2host:/home/db2inst1 # cat /var/tmp/lala

AREA OF ISSUE STATUS HI_VALUE
HI_ADDITIONAL_INFO
----------------------------- -------------------- --------

----------------------------------------------------------------------------------------------------
0 Satz/Sätze ausgewählt.


Have a look at /var/tmp/lala using "ls -S" as it will preserve the line
wraps exactly as they are in the file. You'll see that DB2 does not
include any <cr>s.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Nov 12 '05 #10
Hi there,

_it_ _does_ .... The following pipe Script recognizes them and filters
them out. The Problem is solved for me. I will post the
"nagios-pluggin" to the nagios projekt

#!/usr/bin/env python
# -*- coding: latin_1 -*-
# $Id:$

import os
import sys
import string

# ---------------------------------------------------------------------

def wrapit (data, stdout):

wrapped = data.replace ("\n", " ").split ("XXXX")
for line in wrapped:
stdout.write (line)

return

# ---------------------------------------------------------------------

if __name__ == "__main__":

stdin = sys.stdin
stdout = sys.stdout

data = stdin.read ()

wrapit (data, stdout)

Nov 12 '05 #11
mi****************@web.de wrote:
Hi there,

_it_ _does_ .... The following pipe Script recognizes them and filters
them out. The Problem is solved for me. I will post the
"nagios-pluggin" to the nagios projekt


Seriously, DB2 does not include any line breaks in the middle of the rows
(only at the end of each row, of course). So you are addressing symptoms
if your output or changes that come from another place.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Nov 12 '05 #12
*hm* :-) we must have some critters inserting <cr>'s. I am talking
about

db2inst1@db2host:/home/db2inst1 # db2
(c) Copyright IBM Corporation 1993,2002
Befehlszeilenprozessor für DB2 SDK 8.2.3

Running on AIX 5.2

Regards

Michael

Nov 12 '05 #13
mi****************@web.de wrote:
*hm* :-) we must have some critters inserting <cr>'s. I am talking
about

db2inst1@db2host:/home/db2inst1 # db2
(c) Copyright IBM Corporation 1993,2002
Befehlszeilenprozessor für DB2 SDK 8.2.3

Running on AIX 5.2


Run

db2 -x "<query>" > <file>

and have a look at <file> with a hex-editor.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Nov 12 '05 #14
Munich .... Oktoberfest ...

Working the day after a couple of Wiesn Maß is not the best idea

Kind Regards

Michael

Nov 12 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Sticks | last post by:
ok... im not quite sure how to describe my problem. i have a php script that runs through my entire php site and writes the resulting output to html files. this is necessary as the nature of the...
6
by: Mike Daniel | last post by:
I am attempting to use document.write(pageVar) that displays a new html page within a pop-up window and the popup is failing. Also note that pageVar is a complete HTML page containing other java...
3
by: Water Cooler v2 | last post by:
Questions: 1. Can there be more than a single script block in a given HEAD tag? 2. Can there be more than a single script block in a given BODY tag? To test, I tried the following code. None...
2
by: bilaribilari | last post by:
Hi all, I am using Tidy (C) for parsing html pages. I encountered a page that has some script as follows: <script> .... var abc = "<script>some stuff here</" + "script>"; .... </script>
19
by: thisis | last post by:
Hi All, i have this.asp page: <script type="text/vbscript"> Function myFunc(val1ok, val2ok) ' do something ok myFunc = " return something ok" End Function </script>
3
by: rsteph | last post by:
I have a script that shows the time and date. It's been working on my site for quite a while now. Suddenly it stops showing up, after getting my drop down menu to work. If I put text between the...
3
by: Angus | last post by:
I have a web page with a toolbar containing a Save button. The Save button can change contextually to be a Search button in some cases. Hence the button name searchsavechanges. The snippet of...
7
by: imtmub | last post by:
I have a page, Head tag Contains many Scripts and style sheet for Menu and Page. This code working fine and displaying menus and page as i wanted. Check this page for reference....
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.