IBM MTM 2018: Part Three – Challenge #08

Where is it? Hmm… I’m looking for some free time. Can’t seem to find any. It’s been a while. Rough week. I’ve changed the website a little bit. It’s also weird writing a blog on a monday, why didn’t I do it in the weekend? Don’t be confused, it’s not monday, I just publish late.

There’s a cookie notice now, and also some share buttons. The first happened because I want to be legal. The second happened because I didn’t really provide any convenient way of sharing a blogpost. Well, there’s that. Oh.. and I removed the ‘pat on the back button’. I didn’t really like it that much and it only worked half of the time.

And yes! I know! The cover photo of Java is really big. Am I even allowed to use their logo just like that? Hmm… I’ll see, if not… send me a mail at [email protected]

Java and DB2 API, Application Program Interface

IBM Master the Mainframe – Part Three – Challenge #08

In this challenge we’re not supposed to know a thing about Java but the challenge includes a working example of a JAVA API to connect to a DB2 relation database table to read, write and update data.

Oh… you’re asking me if I know Java? Well… sort of! I’ve made some projects at college for Android class in Java.

Copy Java code from partitioned data set to unix file…

We jump to the ISPF Command Shell panel using =6 and enter the primary command “oput ‘zos.mtm2018.public.source(db2jdbc4)’ ‘'”.

I pressed enter but nothing really happened. I think it just copied db2jdbc4 to Now let’s continue and jump to the Unix Services command shell prompt by entering =u. Then just execute javac, javac actually is the compiler. Hence the ‘c’.

It seems there is not enough storage to load the DLL module we need. -Xms specifies how much memory we allocate to the pool. Maybe we should get that adjusted? Now exit and continue to TSO/ISPF and modify the SIZE value on the TSO/E LOGON display. The display where you, well, login.

Change value from 32768 to 262144 they say. Let’s just do that and login. Don’t forget to enter your password! Now let’s go back to the Unix Services Command Shell and compile again using javac Then execute the file using java db2jdbc4. Did you notice something? To compile it’s javac, to run it’s java 😉 

When you run the file you’ll see status ‘running’ in the bottom right corner of your screen. Let’s take a look at the output.

The output is beautiful but wrong. Connection authorization failure occurred. Reason: User ID revoked. That’s not good! We must fix it!

Let’s edit the file using oedit, find and change z##### to your username and change wrongpwd to your real password. I’m not too comfortable hardcoding a password into a file but I’m not in a position to refuse.

I see two lines that I need to edit. However I’ll only do the first for the sake of this blog. I’ve noticed we’ve to run into another error because IBM wants us to. I’ve compiled successfully but ran into another error.

It looks like there’s a SQLERRMC. In normal human speech, that means it can’t find the correct table to select from. It also looks familiar doesn’t it? Let’s fix that.

It worked! However, there’s a string attached. Please look very close to the database name. It’s not as simple as just changing the hashtags.

Let’s exit the OMVS and tso submit ‘zos.public.jcl(db2jdbc4)’ to write the output to Z#####.P3.OUTPUT(#08). To be safe, just verify.

Looks good! All done!

Hmm… I want my own mainframe

Just like Sebastian did in Germany! When I was browsing I stumbled upon Sebastian’s mainframe video blog and I was baffled. Be sure to check him out!

When will you get your own mainframe?

2 thoughts on “IBM MTM 2018: Part Three – Challenge #08

  1. I am about to lose more of my marbles than I already have. And they are in short supply. I made it through to the table bit. Can you point me in the right direction to which exercise I created the table in. For the life of me I have tried clients, bbri, and I think select for what ever reason I thought that was a good idea. I have been just plugging away for hours to no avail.

Leave a Reply

Your email address will not be published. Name, email and website not required.