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!

IBM MTM 2019: Part Three – Challenge #06

Okay, another Java challenge! I like that, more coding problems! I have those daily at my j… No I don’t… heheh (awkward smile).

JZOS Toolkit API for Java

IBM Master the Mainframe Part Three – Challenge #06

Copy Java source to your Unix directory

Let’s get started by making sure we have the needed resources. From ISPF I enter the primary command =6 and enter oput ‘zos.mtm2019.public.p3.source(zjava)’ ‘zjava.java’ as primary again shortly after.
The text should then jump to the other line. That’s okay!

View the Java source in your Unix subdirectory

From the same screen we enter oedit.

We now see a file explorer that looks like it was built in one of the matrix movies. We need to edit zjava.java, we can do so by entering the line command next to the file name.

Press enter. You might have to press it twice as another screen pops up. Ignore that one.

I now get to see the file, IBM explains what the code does. We also see that scary warning. But I’m not scared, are you?

Submit JCL to compile and execute Java source program

Let’s run… not away, but the script. Let’s enter tso sub ‘zos.public.jcl(zjava)’ ; =sd ;st as primary command and try to identify the error.

If you can’t see your jobs, try entering prefix * ; owner z#####; as primary command. Thank you Georges! Enter line command v next to STDERR and let’s see..

It looks like there’s an undefined variable? Let’s fix that!

Identify and correct Java compile error

Let’s go back to the ISPF Primary Option Menu and enter the primary command tso oedit. Let’s edit zjava.java and correct the syntax error.

THINK WELL, IBM SAYS: “What was the name of integer value declared early in the Java program?”; You can use the primary command f int to highlight the text ‘int’. That should help!

If you think you’ve fixed it, enter the primary command tso sub ‘zos.public.jcl(zjava)’ ; =sd ; st and check the output to see if the error is gone. If it’s gone, congratulations!

Verify the completion of challenge #06

I have this output in my P3.OUTPUT data set. This means I got it right! On to challenge #07!