IBM Support

Select command output without column headings

Technote (troubleshooting)


This document describes how to run a select command on the Tivoli Storage Manager server instance database and return the output without the column identifiers.

Resolving the problem

The DB2 select command can be run with the -x option to suppress printing of column headings. Output without column headings can be useful in macros and scripts.
In this example, the Tivoli Storage Manager server instance is server1 and runs on Windows. The select command uses the -x option to suppress column headings and also uses the concat operator to build commands. Redirecting the output to a file enables you to use the output to run a Tivoli Storage Manager command-line MACRO command.

Logon with the Windows account that runs the Tivoli Storage Manager server instance. Open a Windows command prompt and enter "db2cmd". A new Windows command prompt opens. From the new command prompt, run the following DB2 commands :

set db2instance=server1
db2 connect to tsmdb1
db2 set schema tsmdb1
db2 -x "select 'query content ' concat volume_name from volumes where volume_name like 'F:\TSMDATA\SERVER1\FILECLASS%'" > c:\temp\query.mac

With the preceding commands, the db2 select command is used to query volumes with names that start with "F:\TSMDATA\SERVER1\FILECLASS". The output is prefixed with the 'query content ' text string and redirected to a file. The output file looks similar to the following example :

query content H:\TSM_SERVER1\FILEPOOL\00000193.BFS
query content H:\TSM_SERVER1\FILEPOOL\00000194.BFS

The output file can then be used as a macro file with the Tivoli Storage Manager administrative command line. For example :

dsmadmc -id=xx -pa=yy -itemcommit -noconfirm macro c:\temp\query.mac > c:\temp\query.out

In the preceding command, replace xx with a valid Tivoli Storage Manager administrator ID and replace yy with the password for that ID.

Related information

Dataonly option with the admin command line

Document information

More support for: Tivoli Storage Manager

Software version: All Supported Versions

Operating system(s): Platform Independent

Reference #: 1643493

Modified date: 03 May 2017

Translate this page: