473,396 Members | 1,784 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,396 software developers and data experts.

How to find the next sequence of the db2 generated field in the syscat catalog table on db2 mainframe and db2 udb

Hi,
We have some tables with db2 generated field.
How can I find the next generated sequence fot those fields.
Thanks,

Jan 23 '07 #1
5 11477
I need to find those information on db2 mainframe and also db2 udb.
zgh1970 wrote:
Hi,
We have some tables with db2 generated field.
How can I find the next generated sequence fot those fields.
Thanks,
Jan 23 '07 #2
zgh1970 wrote:
Hi,
We have some tables with db2 generated field.
How can I find the next generated sequence fot those fields.
Thanks,
You won't be able to peek the next value.
There are semantic reasons as well as practical.
First of all there is no locking for sequence values.
That is if you check the next value the information you would obtain
would be outdated right away. Anyone could steal that value.
Secondly depending on the implementation there may be more than one
cache. That is depending on where the sequence generating code executes
you could see different values. (Think sysplex or DB2 for LUW with DPF).

Having that said DB2 for LUW stored the high watermark in the catalog is
SYSIBM.SYSSEQUENCES. Chances are DB2 zOS does the same. The high
watermark is used by DB2 to issue the next set of cache values.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jan 23 '07 #3
Hi, Serge,
thank you for the information.
But peeking the next valus is also useful in the data ware house.
I am sure no any change to those tables with db2 generated fields.
Sometimes dba need to dump data from production to UAT.
We want to check if we missed any adjustment to the start key after
loading.
If I can find the start key or next key for those tables synchronized
from production instance to test instance.
I know Db2 UDB we can alter table to change the start key.
For the db2 mianframe we need ot create table with the stark key equal
the maximum +1 of the data loaded.
I would to get start key or next sequence for those fields.
Thansk,

On Jan 23, 6:14 pm, Serge Rielau <srie...@ca.ibm.comwrote:
zgh1970 wrote:
Hi,
We have some tables with db2 generated field.
How can I find the next generated sequence fot those fields.
Thanks,You won't be able to peek the next value.
There are semantic reasons as well as practical.
First of all there is no locking for sequence values.
That is if you check the next value the information you would obtain
would be outdated right away. Anyone could steal that value.
Secondly depending on the implementation there may be more than one
cache. That is depending on where the sequence generating code executes
you could see different values. (Think sysplex or DB2 for LUW with DPF).

Having that said DB2 for LUW stored the high watermark in the catalog is
SYSIBM.SYSSEQUENCES. Chances are DB2 zOS does the same. The high
watermark is used by DB2 to issue the next set of cache values.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jan 24 '07 #4
zgh1970 wrote:
Hi, Serge,
thank you for the information.
But peeking the next valus is also useful in the data ware house.
I am sure no any change to those tables with db2 generated fields.
Sometimes dba need to dump data from production to UAT.
We want to check if we missed any adjustment to the start key after
loading.
If I can find the start key or next key for those tables synchronized
from production instance to test instance.
I know Db2 UDB we can alter table to change the start key.
For the db2 mianframe we need ot create table with the stark key equal
the maximum +1 of the data loaded.
I would to get start key or next sequence for those fields.
All right. Then why not simply do NEXT VALUE FOR <sequence>?
Followed by:
ALTER SEQUENCE <sequenceRESTART WITH <thevalueyoujustgot>

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jan 24 '07 #5
Hi, Serge,
With your help, I had the query to find the stert key.
IT is very convenient to check the db2 generated fileds work after bulk
load.
thanks again,

On Jan 23, 9:48 pm, Serge Rielau <srie...@ca.ibm.comwrote:
zgh1970 wrote:
Hi, Serge,
thank you for the information.
But peeking the next valus is also useful in the data ware house.
I am sure no any change to those tables with db2 generated fields.
Sometimes dba need to dump data from production to UAT.
We want to check if we missed any adjustment to the start key after
loading.
If I can find the start key or next key for those tables synchronized
from production instance to test instance.
I know Db2 UDB we can alter table to change the start key.
For the db2 mianframe we need ot create table with the stark key equal
the maximum +1 of the data loaded.
I would to get start key or next sequence for those fields.All right. Then why not simply do NEXT VALUE FOR <sequence>?
Followed by:
ALTER SEQUENCE <sequenceRESTART WITH <thevalueyoujustgot>

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jan 24 '07 #6

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

Similar topics

4
by: nekiv90 | last post by:
Greetings, I was able to create the structured type: CREATE TYPE address_t AS ( street char(30), city char(15), state char(10), postcode smallint ) MODE...
3
by: Bob Stearns | last post by:
I changed a varchar(255) to varchar(3000) an started receiving: Warning: odbc_exec(): SQL error: SQL1585N A system temporary table space with sufficient page size does not exist. SQLSTATE=54048...
4
by: John Bailo | last post by:
I have created several aliases to members using the CREATE ALIAS command, but I lost track of them. Now I want to see a catalog of all the aliases mapped to all members in a FILE. Is there a...
2
by: Daniel | last post by:
I use an Access database to basically take data exports, import them, manipulate the data, and then turn them into exportable reports. I do this using numerous macros, and queries to get the data...
2
by: gaffar | last post by:
Hello Sir, How to assign more than one primary key to table by this below following code. i am able assign to a single field only. how to assign primary key to more than one field. the primary key...
9
by: Hemant Shah | last post by:
How do I find out when the table was modified? When I look at syscat.tables it only lists creation time. -- Hemant Shah /"\ ASCII ribbon campaign E-mail:...
7
by: Laurence | last post by:
Hi folks, Who knows how to retrieve the owner of SQL objects, such as SCHEMA, TABLE etc.? Is GRANTOR within catalog view owner? Thanks, Laurence
10
by: Lennart | last post by:
I see a bunch of packages where valid <'Y'. What I cant figure out is how to relate the package to a procedure, function or whatever. Does anyone have a reference to share on the relationship...
15
by: uwcssa | last post by:
I try to drop a table as: I got: During SQL processing it returned: SQL0478N The object type "TABLE" cannot be dropped because there is an object "sch.SQL070515104729271", of type "FUNCTION",...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.