Use this tag for questions about DB2 for z/OS, the IBM mainframe operating system. Please also tag such questions with the more generic [db2] tag. There are enough differences between DB2 for z/OS and DB2 for other platforms to warrant a separate tag.
Questions tagged [db2-zos]
175 questions
0
votes
1 answer
How to solve sql error -904 in inserting data
I wanted to write some records say 10000 in database table but got sql error -904 after inserting some records say 2000. I deleted 25 records of old records and than run the program again and this time after inserting 2025 records I got the same…

Soraya
- 29
- 3
0
votes
0 answers
Cannot get the describe information for the calling stored procedure
I am trying to call a DB2 stored procedure from a java application and getting the error below:
Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][10453][12711][4.22.29] Cannot get the describe information for the calling stored procedure with name…

ssubas
- 1
- 1
0
votes
1 answer
Insert/update Hex value to DB2 Z/OS PreparedStatement
I need to insert in my database a Hex value with a PreparedStatement in Java.
I can do a select with Hex function for get my value:
String id = "02658947530232010038892587183C";
String request = "SELECT HEX(COLUMN) FROM TABLE WHERE…

Maelstrom
- 1
- 4
0
votes
1 answer
Running SQL PL on DB2 z/OS directly without stored procedures
I'm experimenting with a IBM DB2 on z/OS (using the IBM Cloud Wazi / Virtual server instances (s390x) and running some queries directly using DBeaver and IBM Data Studio.
I want to execute a simple SQL PL script directly from a SQL Script, like I do…

Bert
- 43
- 1
- 4
0
votes
1 answer
Can I index / insert keys to a DB2 large table to speed up selects?
I know this question has probably been asked many times, but bear with me; I couldn't find the answer on my specific situation on stackoverflow. I'm also not a wiz at SQL and specifically not DB2 SQL. We're using DB2 12 running on z/OS.
I need to…

Zimeon
- 9
- 3
0
votes
1 answer
How do I set "for fetch only" when querying ibm db2 using the jdbc driver from spark?
I have some code to query a db2 database that works if I don't include "for fetch only," but returns an error if I do. I was wondering if it's already being done, or how I could set it.
connection_url =…

jonathan-dufault-kr
- 403
- 3
- 9
0
votes
1 answer
db2 sql query on 4 tables not running? (taking too long?)
I have 4 tables with columns as illustrated below
Table1: PART with the following columns | PID | PCODE| PNAME| MID|
Table2: MAN with the following columns | MID | MCODE| MNAME |MVALID|
Table3: LVL with the following columns. |PID |…

Abel
- 113
- 4
0
votes
1 answer
Need suggestion with Procedure code error in DB12 Z/OS
can someone help with my Proc code here? I am trying to execute this proc in DB12 Z/OS. Below is the body of my proc
CREATE PROCEDURE DEL_TBL_TEST23(IN TBL_NM VARCHAR(100))
DYNAMIC RESULT SETS 1
LANGUAGE SQL MODIFIES SQL DATA
BEGIN
DECLARE…

P.C
- 24
- 6
0
votes
1 answer
Does setString() of SQL PreparedStatement will change null characters of string with space while inserting data to db2zos table?
Lets say I have one column with datatype of VARCHAR(500) in db2 zOS table and I wanted to insert data into that column using prepared statement. But that data/string has null character in between. e.g: "hello\0test\0example!".
My question is does…

Pooja Shelar
- 3
- 2
0
votes
0 answers
calling stored procedure with name parameters
I'm trying to call stored procedure with name parameters from java and having an issues
Class.forName("com.ibm.db2.jcc.DB2Driver");
String connectionFormat = "jdbc:db2://TEST.NET:5224/D1278";
Connection conn =…

hotcoder
- 41
- 2
- 10
0
votes
0 answers
Foreign key constraint on same table not allowing to delete on DB2
I have table named VARIANT_LINK_BUILD_CHANGE where primary key column name is VARIANT_LINK_BUILD_CHANGE_OID and foreign key is also in same table named SWAP_VL_BUILD_CHANGE_OID.
The data looks like this:
VARIANT_LINK_BUILD_CHANGE_OID MOD_TYPE …

Rooban
- 248
- 1
- 15
0
votes
1 answer
Illegal symbol 'EXEC' in DB2 z/os
I am trying to create cursor on db2 z/os database from dbVisualizer
The query I have tried is
--/
EXEC SQL
DECLARE E1 CURSOR FOR
SELECT NAME FROM EMP e
WHERE EXISTS (SELECT 1 FROM ADDRESS a
WHERE e.ID = t.a.id )
FOR…

Rooban
- 248
- 1
- 15
0
votes
1 answer
DB2 Error Code -495 while we try deleting records counts more than 400k
We have following query to get the records deleted on fk_data_table, and been found we weren’t able to, as because of 400k records.
Delete FROM BOM_LINK WHERE TEST_OBJECT_OID IN (SELECT DISTINCT
TESTOBJECT_OID FROM TESTOBJECT WHERE…

Dev Anand Sadasivam
- 699
- 7
- 21
- 49
0
votes
1 answer
DB2 - Arithmetic calculations and rounding
Considering the taxable amount (rateable), the number of days and the rate, I must calculate the interest applied (with the compound rate formula) but I have a problem with floating-point and rounding applied by DB2 V12 (Z/OS).
(Note: The same…

killer
- 11
- 6
0
votes
1 answer
How to implement a merge statement for DB2 ZOS using a JdbcItemWriter in Spring Batch?
I have a requirement to read 50K records from one database and then insert or update those records into another database. The read takes a couple seconds. But the inserts/updates for those 50K records is taking up to 23 minutes even with…

watafu.hibiki
- 3
- 2