By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,924 Members | 1,793 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,924 IT Pros & Developers. It's quick & easy.

Get the DB2 version number through SQL (onMVS)

P: n/a
Hi,
who could tell me if there is a SYSIBM table that would give me the
current db2 version accessed (on MVS) - i.e. Oracle offers a v$version
system table that gives that information.
Thanks
Jean-Louis

Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
sb****@gmail.com wrote:
Hi,
who could tell me if there is a SYSIBM table that would give me the
current db2 version accessed (on MVS) - i.e. Oracle offers a v$version
system table that gives that information.


My very first idea would be to implement a user-defined function (in Java or
C) to access the DBINFO structure and return the version information
available there.

--
Knut Stolze
Information Integration Development
IBM Germany / University of Jena
Nov 12 '05 #2

P: n/a
sb****@gmail.com wrote:
Hi,
who could tell me if there is a SYSIBM table that would give me the
current db2 version accessed (on MVS) - i.e. Oracle offers a v$version
system table that gives that information.
Thanks
Jean-Louis

Take a look in the sqludf include file.
The dbinfo structure has a ver_rel attribute.
It should be available on all platforms
You can write an external UDF which grabs the result.

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #3

P: n/a
Serge Rielau wrote:
sb****@gmail.com wrote:
Hi,
who could tell me if there is a SYSIBM table that would give me the
current db2 version accessed (on MVS) - i.e. Oracle offers a v$version
system table that gives that information.
Thanks
Jean-Louis

Take a look in the sqludf include file.
The dbinfo structure has a ver_rel attribute.
It should be available on all platforms
You can write an external UDF which grabs the result.


The following (untested code) should work, at least on LUW. But I'd be a
bit surprised if it would not work on zOS or MVS.

--------------- Java code -------------------
public class extends DB2Version extends COM.ibm.db2.app.UDF
{
public void getVersion(String version)
{
set(1, getDBver_rel());
}
}

--------------- SQL CREATE FUNCTION -------------------
CREATE FUNCTION getDB2Version()
RETURNS VARCHAR(8)
LANGUAGE JAVA
PARAMETER STYLE DB2GENERAL
EXTERNAL NAME 'DB2Version!getVersion'
DETERMINISTIC
NO EXTERNAL ACTION
DBINFO
@

--
Knut Stolze
Information Integration Development
IBM Germany / University of Jena
Nov 12 '05 #4

P: n/a
Knut Stolze wrote:
Serge Rielau wrote:

sb****@gmail.com wrote:
Hi,
who could tell me if there is a SYSIBM table that would give me the
current db2 version accessed (on MVS) - i.e. Oracle offers a v$version
system table that gives that information.
Thanks
Jean-Louis


Take a look in the sqludf include file.
The dbinfo structure has a ver_rel attribute.
It should be available on all platforms
You can write an external UDF which grabs the result.

The following (untested code) should work, at least on LUW. But I'd be a
bit surprised if it would not work on zOS or MVS.

--------------- Java code -------------------
public class extends DB2Version extends COM.ibm.db2.app.UDF
{
public void getVersion(String version)
{
set(1, getDBver_rel());
}
}

--------------- SQL CREATE FUNCTION -------------------
CREATE FUNCTION getDB2Version()
RETURNS VARCHAR(8)
LANGUAGE JAVA
PARAMETER STYLE DB2GENERAL
EXTERNAL NAME 'DB2Version!getVersion'
DETERMINISTIC
NO EXTERNAL ACTION
DBINFO
@

The closest you can get as far as I know is:
select distinct relbound from sysibm.sysplan
or from sysibm.syspackage

It wil show a 'K' for plans/packages that are bound on DB2 Version 7 and
a blank for plans/packages that are bound prior to V7.
(not sure what it will show for V8, 'L' perhaps?)

The DB2 version is also shown if you connect from Windows via the
command line processor via DB2 Connect to the MVS subsystem:

Database Connection Information

Database server = DB2 OS/390 7.1.1

--
Anton Versteeg
IBM Netherlands
Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.