IBM MTM 2019: Part Three – Challenge #09

Hi people!

I’ve been away for a while and haven’t been able to check my blog for some time. I’ve noticed a ton of comment and e-mails but it takes me a lot of time to answer all. I’ll get back to all my users soon! I hope you have been doing fine! Please, if you want faster help visit https://mtmcompetition.slack.com/.

Java SQL

IBM Master the Mainframe Part Three – Challenge #09

Get JCL necessary to complete challenge

Like most of the challenges we need to copy some data to one of our data sets. We should be familiar with this process by now.
First I’ll create a new member db2java inside my JCL data set. Then in the edit session I’ll COPY ‘zos.public.jcl(db2java)’ into it.
Somewhere in this code we need to change the output member to P3.OUTPUT(#09). I’ll enter the primary command save to save my changes and then I’ll sub ; =sd ; st to run the JCL. sub is actually shorter syntax for submit. This is a TIP for the lazy 😉
This is my output. It is identical to last challenge’s output.

Modify, compile, and execute Java program

We need to go back and edit the Java it executes to select only employeenumber from ibmuser.vphone where phonenumber is 2167. We also need to output Employee Number: instead of Phone:.
I seriously already forgot where the java files are located, I’m horrible. Let me visit my old blogs and see how it did that haha.
AHA! TSO OEDIT primary command to get to the file explorer.
Then I’ll edit db2java.java. My hex view is still on, I’ll issue the hex off primary command to disable it.
Somewhere on this screen there is a SQL statement and an output statement. Find where and make the necessary changes. As a non native English-speaker, I was surprised I wrote necessary correctly from the first go. Small victory!

Incase you’re wondering, yes some text is longer than the text that was already there. You’ll need to move some thing around. Don’t forget about spaces and closing statements like “;” “)” etc.

I can’t give the solution as IBM has told me not to, please refrain from posting solutions directly. Looking at you Mig 😉

By the way, hi Georges!

Enter the primary command save to save your changes. Then go back to the JCL to check if everything executed correctly.
I have some results! I’m not sure if that’s correct though. I could check using some SQL… buuuuuuuut I don’t have enough time.

IBM MTM 2019: Part Three – Challenge #08

Stop! Java time! Get it? The reference to Java and U can’t touch this by MC Hammer? No? Schnitzel. Let’s get on with challenge #08 and fix a Java connection problem!

Java and Db2 API, Application Program Interface

IBM Master the Mainframe Part Three – Challenge #08

Copy Java source coded to your Unix directory

Like most of the challenges we need to acquire some data first! Let’s get started by entering the primary command =6 from the ISPF Primary Option Menu, this boots us to the command shell. In that command shell we enter oput ‘zos.mtm2019.public.p3.source(db2java)’ ‘db2java.java’ to get the data. Don’t leave this screen yet!

Submit JCL to compile and execute the Java program

The next command we need to run is sub ‘zos.public.jcl(db2java)’ ; =sd ; st and then we need to investigate an issue. I’ll do that by using the ? line command in the NP column.

Specifically we need to view STDERR. I’ll use the v line command in the NP column.

Let me investigate…

I’ll use the primary command right 40 to shift the display up 40 characters to the right. There seems to be a problem with the authorization, as Java throws a SqlInvalidAuthorizationSpecException. I can’t say more.

Modify, compile, and execute the DB2JAVA program

Let’s enter TSO OEDIT as primary command, it can be executed directly from this screen. Then we need to select the db2java.java to edit it.

Ok, we now need to go through the code and see where it establishes a connection to DB2 server. When we find it, we need to fix it.

I have found the issue, I’m not saying it on this screenshot though (smiley with a holy halo thingy). After fixing, enter the primary command save and then tso sub ‘zos.public.jcl(db2java)’ ; =sd ; st to run the script. You may view the output and compilation stuff, but I’m going directly to P3.OUTPUT. Is this where we part ways, reader?

View member #08 in P3.OUTPUT for valid SQL result set

Voila! Done! Yes, yes, I have censored it. I need to put some effort in censoring the solutions to part 3. I’m doing my part.

How’s it going?

How are you guys/girls doing? Do you like master the mainframe? Are you doing it because of school/work/own interest? Are you blackmailed into doing it?

Tell me!

IBM MTM 2019: Part Three – Challenge #07

Bonjour, another another Java challenge!

I’m reading the intro and they say: Remember what you learned about hexadecimal values. You will need it. *Gulp* I hope I remembered at least something.

More Java using JZOS Toolkit

IBM Master the Mainframe Part Three – Challenge #07

Use Java program to replace old string of text with a new string of text

Okay, let’s go back the the zjava.java file the same way we did in the last challenge. tso oedit from the ISPF menu and line command e next to the file name. Issue the primary command hex on so we can identify the issue with “Who said this “.

Now we need to go back to the ISPF menu. Enter =6 and issue the primary command  obrowse ‘/z/public’.

Let me view it.

Hmm, there’s a difference alright! I see them, do you?

Fix it!

Are there any differences? Fix the JAVA code. How do you fix it? Go back to the java file, put hex on and overtype the hex with the correct values as seen in SOURCE.

Get new copy of JCL to compile and execute modified Java source code

We won’t execute the Java code again. Instead we’ll grab JCL to execute it. Let’s go to our jcl data set by using the primary command dslist jcl and we’ll make a new member called zjava using the primary command s zjava.

Inthere we’ll copy ‘zos.public.jcl(zjava)’.

We need to change the last //STDOUT to have it write to P3.OUTPUT(#07).

If you’re finished, execute using submit ; =sd ; st and go check P3.OUTPUT to see if you have the correct output. Let me see for myself…

There he is! Dear mister Einstein! Great man!

Last task to get full credit

We need to edit our P3.OUTPUT(#07) and copy our Java code into it. Let’s do that.

Don’t forget the a label as line command. Otherwise you’ll have copy pending!

This is my eventual output, minus the censoring ofcourse!