DB2 comes with a lot of in-built functions. One of them is called LAST_DAY which returns the Last Day of a month, but there is no FIRST_DAY of the month function. Some of my colleagues asked about it. Here is an UDF (User Defined Function) that'll return FIRST DAY of the month:
CREATE FUNCTION schema.FIRST_DAY (IN_DATE DATE)
RETURNS DATE
LANGUAGE SQL
CONTAINS SQL
NO EXTERNAL ACTION
DETERMINISTIC
RETURN DATE(LAST_DAY(IN_DATE - 1 MONTH) + 1 DAY);
Technical Tips including DB2 z/OS, DB2 LUW, COBOL, JCL, VSAM, CICS, 3rd party vendor tools (BMC, CA, IBM, Macro4, etc.)
Saturday, February 28, 2009
Saturday, February 21, 2009
SQL ERROR "00D31034"
You have a web application connecting to DB2 for z/OS and it times out with the message:
There could be many reasons for this error. One that I found recently is here.
Look in your z/OS DB2 MSTR log for a message like this:
As per the DB2 manual, "00D31034" means
Now, as the message says, there may be too many remote database connections and the number of remote connections exceeded the ZPARM CONDBAT(MAX REMOTE CONNECTED) limit.
But, before jumping to the conclusion that all the connections are genuine and asking your DBA to bump this number, look at your connection threads closely.
The web application might be using an old version of the arch.jar (arch-2_2_3.jar). This version of arch.jar does not close the database connection successfully on a few occasions.
The resolution is a simple upgrade to the latest arch.jar (arch-3_0_1.jar) which has the fix to close the connection.
SQL30081N A communication error has been detected.
Communication protocol being used: "TCP/IP". Communication
API being used: "SOCKETS". Location where the error was
detected: ip-address", Communication function detecting
the error: "recv". Protocol specific error code(s):
"*", "10054", "*". SQLSTATE=08001
There could be many reasons for this error. One that I found recently is here.
Look in your z/OS DB2 MSTR log for a message like this:
DSNL030I +DB2x DSNLILNR DDF PROCESSING FAILURE FOR
LUWID=xxxxxxxx.GE21.000000000000
AUTHID=-N/A-, REASON=00D31034
As per the DB2 manual, "00D31034" means
The MAX REMOTE CONNECTED limit was reached and the
conversation was abnormally deallocated. The thread
was not allowed to connect to DB2.
Now, as the message says, there may be too many remote database connections and the number of remote connections exceeded the ZPARM CONDBAT(MAX REMOTE CONNECTED) limit.
But, before jumping to the conclusion that all the connections are genuine and asking your DBA to bump this number, look at your connection threads closely.
The web application might be using an old version of the arch.jar (arch-2_2_3.jar). This version of arch.jar does not close the database connection successfully on a few occasions.
The resolution is a simple upgrade to the latest arch.jar (arch-3_0_1.jar) which has the fix to close the connection.
Sunday, February 15, 2009
DB2 SQLCODE -741
I was installing a DB2 vendor tool yesterday. Part of the install was to create a new temporary database. When I ran the following DDL,
I got this message:
The problem here is, I was trying to define a temporary database whereas a temporary database already exists for that subsystem. ONLY ONE TEMPORARY DATABASE is allowed per subsystem or data sharing member.
I learnt a lesson !!
CREATE DATABASE database
STOGROUP ASTERISK
BUFFERPOOL BP2
INDEXBP BP2
AS TEMP
I got this message:
DSNT408I SQLCODE = -741, ERROR: A TEMP DATABASE IS ALREADY DEFINED FOR
MEMBER ssid
The problem here is, I was trying to define a temporary database whereas a temporary database already exists for that subsystem. ONLY ONE TEMPORARY DATABASE is allowed per subsystem or data sharing member.
I learnt a lesson !!
Wednesday, February 11, 2009
BMC Unload PLUS - BMC50033E
We're moving away from CA/Platinum, yes, our shop is converting from CA/Platinum tools to BMC tools for DB2.
I ran my first UNLOAD PLUS job today and it went down with this message:
BMC50033E CPU NOT AUTHORIZED TO RUN UNLOAD PLUS FOR DB2 RETURN CODE = 0004 REASON CODE = P1
Found out that, in the JCL, I need to include the Password dataset - either in STEPLIB or JOBLIB:
// DD DISP=SHR,DSN=hlq.BMCPSWD
Tuesday, February 3, 2009
DB2 Subsystem Size
How do you find the size of your entire DB2 subsystem on z/OS?
Try this ...
List the base datasets in ISPF option 3.4, e.g., DB2CAT*.DSNDBD.**, and then do a SAVE LIST. It'll save all the Tracks Used info. Add them up to come up with the total tracks used. Remember, for compressed tablespaces, this information shows size for the compressed data. Uncompressed data might occupy more space.
If you want to know the relation between tracks and Kilo Bytes, use this formula (this example is for a 3390 DASD - your model may be different, check with your systems programmer):
1 Track = 48 KB
1 Cylinder = 720 KB
1 Cylinder = 15 Tracks
Try this ...
List the base datasets in ISPF option 3.4, e.g., DB2CAT*.DSNDBD.**, and then do a SAVE LIST. It'll save all the Tracks Used info. Add them up to come up with the total tracks used. Remember, for compressed tablespaces, this information shows size for the compressed data. Uncompressed data might occupy more space.
If you want to know the relation between tracks and Kilo Bytes, use this formula (this example is for a 3390 DASD - your model may be different, check with your systems programmer):
1 Track = 48 KB
1 Cylinder = 720 KB
1 Cylinder = 15 Tracks
Subscribe to:
Posts (Atom)