Lenovo ThinkPad T40p IBM System Information Center Administrator's Guide - Page 50

Performing, other, advanced, functions

Page 50 highlights

5. When the task executes, the custom report is executed and the results are saved as a CSV file. Note: The first line of the CSV will contain the header row. The actual values will start with the second line. 6. The CSV file can then be imported into DB2. To do this, create a batch or command file with the following line and name it IMPORT.BAT: db2 -f import.ddl 7. Next, create the IMPORT.DDL file using a plain text editor such as Notepad. This file should contain lines similar to the following example: -- Edit the following line to include the correct userid/password for your database. CONNECT TO MYUSERS USER db2admin USING password -- Clear the table DELETE FROM MY.USERS WHERE USERID '' -- Import the latest data IMPORT FROM.\custom_report_name.csv OF DEL INSERT INTO MY.USERS -- Clear the headers from the .csv file DELETE FROM my.users WHERE userid='USERID' This file will execute as a DB2 script. The script first connects the DB2 administrator account to the MYUSERS database. Next, the script clears the old contents of the MY.USERS table (where MY is the schema under which the USERS table was created). Next, the script imports the contents of the CSV into the MY.USERS table. Finally, the script removes the row containing the headers by selecting based on a value in that row. In this example, the first column contains the userid. In the row that contains the headers, the value in the userid column equals USERID. Based on this, that row is deleted. 8. To initiate the import of the CSV file into your database, run the DB2CMD IMPORT.BAT command. This will open a DB2 Command Environment and execute the IMPORT.BAT file, which, in turn, executes the DB2 importing script - IMPORT.DDL. Since the task within the System Information Center program can be scheduled, this whole process can be set up to run automatically so that data in an external database can be synchronized with the data in the System Information Center database. Note: Each time the task generates a new CSV file, the previous file will be overwritten. Performing other advanced functions There are a number of other advanced functions that can be performed using the System Information Center interface. The following list highlights other advanced functions available through the System Information Center. For details about performing other advanced functions, see the IBM System Information Center online help system. v Checking asset security: You can check security conditions of all client computers. v Viewing logs and server status: You can view application logs and server status to help diagnose a problem. v Interrupting the Task Scheduler: In addition to modifying the task scheduler, you can interrupt, or stop, the scheduler to allow for other processing to take place, thereby increasing performance. 42

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108

5.
When
the
task
executes,
the
custom
report
is
executed
and
the
results
are
saved
as
a
CSV
file.
Note:
The
first
line
of
the
CSV
will
contain
the
header
row.
The
actual
values
will
start
with
the
second
line.
6.
The
CSV
file
can
then
be
imported
into
DB2.
To
do
this,
create
a
batch
or
command
file
with
the
following
line
and
name
it
IMPORT.BAT:
db2
-f
import.ddl
7.
Next,
create
the
IMPORT.DDL
file
using
a
plain
text
editor
such
as
Notepad.
This
file
should
contain
lines
similar
to
the
following
example:
--
Edit
the
following
line
to
include
the
correct
userid/password
for
your
database.
CONNECT
TO
MYUSERS
USER
db2admin
USING
password
--
Clear
the
table
DELETE
FROM
MY.USERS
WHERE
USERID
<>
’’
--
Import
the
latest
data
IMPORT
FROM.\custom_report_name.csv
OF
DEL
INSERT
INTO
MY.USERS
--
Clear
the
headers
from
the
.csv
file
DELETE
FROM
my.users
WHERE
userid=’USERID’
This
file
will
execute
as
a
DB2
script.
The
script
first
connects
the
DB2
administrator
account
to
the
MYUSERS
database.
Next,
the
script
clears
the
old
contents
of
the
MY
.USERS
table
(where
MY
is
the
schema
under
which
the
USERS
table
was
created).
Next,
the
script
imports
the
contents
of
the
CSV
into
the
MY.USERS
table.
Finally,
the
script
removes
the
row
containing
the
headers
by
selecting
based
on
a
value
in
that
row.
In
this
example,
the
first
column
contains
the
userid.
In
the
row
that
contains
the
headers,
the
value
in
the
userid
column
equals
USERID.
Based
on
this,
that
row
is
deleted.
8.
To
initiate
the
import
of
the
CSV
file
into
your
database,
run
the
DB2CMD
IMPORT.BAT
command.
This
will
open
a
DB2
Command
Environment
and
execute
the
IMPORT.BAT
file,
which,
in
turn,
executes
the
DB2
importing
script
-
IMPORT.DDL.
Since
the
task
within
the
System
Information
Center
program
can
be
scheduled,
this
whole
process
can
be
set
up
to
run
automatically
so
that
data
in
an
external
database
can
be
synchronized
with
the
data
in
the
System
Information
Center
database.
Note:
Each
time
the
task
generates
a
new
CSV
file,
the
previous
file
will
be
overwritten.
Performing
other
advanced
functions
There
are
a
number
of
other
advanced
functions
that
can
be
performed
using
the
System
Information
Center
interface.
The
following
list
highlights
other
advanced
functions
available
through
the
System
Information
Center.
For
details
about
performing
other
advanced
functions,
see
the
IBM
System
Information
Center
online
help
system.
v
Checking
asset
security
:
You
can
check
security
conditions
of
all
client
computers.
v
Viewing
logs
and
server
status
:
You
can
view
application
logs
and
server
status
to
help
diagnose
a
problem.
v
Interrupting
the
Task
Scheduler
:
In
addition
to
modifying
the
task
scheduler,
you
can
interrupt,
or
stop,
the
scheduler
to
allow
for
other
processing
to
take
place,
thereby
increasing
performance.
42