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
Mulesoft DB2 Connection
I am trying to connect to a DB2 database on a Mainframe. I am using the db2jcc.jar driver. My config looks like this:

user1379903
- 83
- 1
- 1
- 6
0
votes
1 answer
How to create user defined function in DB2 Z/OS 8.1 version?
This is my code: I trying to create UDF function for z/os from Data Studio . I don't need to use External function or others. I need to execute this SQL Function .
CREATE FUNCTION FUNCTION5()
RETURNS FLOAT
language sql
DETERMINISTIC
READS SQL…

Vivek Harry
- 419
- 3
- 11
- 25
0
votes
1 answer
Using integer in data as condition on number of rows in table
This is a representation of my table T1:
acc_id|acc_holders|bal_1|bal_2
00001|002|50|100
00001|002|50|100
00002|001|100|100
00003|003|50|100
00003|003|50|100
acc_holders indicates the number of account holders. The bal_1 figure represents the…

joshi123
- 835
- 2
- 13
- 33
0
votes
0 answers
Query to see the privileges for a DB2 table
I'm just looking for a simple query to see the privileges set for the table .(I have to query it through TOAD for DB2)
Note that this link is for the mainframe DB2/z.
select * from SYSIBM. ????

code_baby
- 103
- 1
- 1
- 4
0
votes
0 answers
DB2 '?' error in sum query
I am running a query on a DB2 mainframe via a batch job. The query is submitting but the result is a single row with a ? in it.
The query looks like:
SELECT SUM(table1.column1)
FROM table1
INNER JOIN table2
ON table1.t1common…

joshi123
- 835
- 2
- 13
- 33
0
votes
1 answer
db2 varchar key workarounds
I'm beginning to understand the benefits of not using varchar for keying, as explained here
I am working with a DB2 database which I didn't setup which has a large table (20M+ rows) with a varchar key field. The table structure is as so:
key_field |…

joshi123
- 835
- 2
- 13
- 33
0
votes
1 answer
OpenJPA Sequence generator with negative values
Environment: Websphere 8.5, OpenJPA 2.0, DB2 z/OS
There are two tables: one with verified data and another with draft data (staging table) + View that display information from both tables.
To avoid Primary Key clash I've decided that staging table…

user2706534
- 99
- 7
0
votes
1 answer
Update the YEAR on a DATE field
DB2 z/OS Version 10
For a DATE column in a table I would like to update the YEAR portion of the DATE to 1900. For example, update 1981-09-03 to 1900-09-03.
I have attempted using the following:
UPDATE SERDB.S16_WEB_USERS_T
SET…

scddsn
- 3
- 4
0
votes
1 answer
Cobol-db2 bind process
I have a question regarding the db2 bind process.. Is the sql query stored in any of the catalog tables after the bind process? Can we execute a cobol-db2 program after if the dbrm was deleted just before submitting the job?
user6619849
0
votes
1 answer
Select from a table as xml grouped by more than one level
I'm using DB2 for z/OS V10.
I need to select some data from a DB2 table direcly into XML with grouping the data on more then 1 level like the following example
A
…

C.Sommer
- 1
0
votes
1 answer
Integer or Smallint for numeric literal
The result of the following query irritates me:
select
char(coalesce(1, cast(5 as decimal(2,0)))) as a,
char(1 * cast(5 as decimal(2, 0))) as b
from sysibm.sysdummy1;
a = ' 00000000001.'
b = ' 0000005.'
The returned value of the first…

nico.ruti
- 605
- 6
- 17
0
votes
1 answer
about SQLCODE -104 (error) during select in DB2
I have been trying to adapt a working "INSERT" into a SELECT statement and keep finding a error -104
a)Can someone please help me understand the reason why the "." on "where" clause (below) works when I run with an "insert" but gives me…

Wanda Larangeira
- 69
- 1
- 2
- 10
-1
votes
2 answers
Replacing the 113th position in a string with 'X' in DB2 SQL
I am looking for a solution for replaceing the 113th position within a string.
As of now the only solution that I found was this one, however, it is not a solution because it replaces all spaces with X.
I cannot use the STUFF function or something…

Bernd
- 593
- 2
- 8
- 31
-1
votes
1 answer
Query a Specific Partition of a Mainframe DB2 Z/OS Table
I am working with a Mainframe DB2 Table Customer_Details.
Owner : GMMOM
Columns : Name,EmployeeNo,Salary,Age
Now, I have a few questions related to partitioned Tables.
How do I identify if a table is partitioned?
How do I find out the number of…

vazn
- 1
- 1
-1
votes
1 answer
z/OS DB2 : I'd need a SQL to list all indexes used by a program
How could I list the DB2 indexes used by a program ?
I of course already have a query to list the tables used by a program using SYSTABAUTH...
But I'd need something similar allowing me to see what indexes are used by a program and what program use…