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!

19 thoughts on “IBM MTM 2019: Part Three – Challenge #08

  1. Hi Kevin
    Your site is very good. I’m a cobol dev trainee and MTM is a way to practice and learn more about the mainframe. I work with CANDE, the Unisys mainframe, but I still learning…so if you have something about cande to post I’ll be glad 🙂

  2. yo, the homie kevin durant. thanks for your help in part 2 BRO. thanks to you, i learned how to do mainframe, and finished part 3 in approximately 2 weeks. i really appreciate it BRO. thanks again

  3. I’m doing the challenge for fun! I’m a long time IBM i (as/400) developer but did 370 assembler and OS as a student (on an emulator on a Burroughs system, of all things!) I play with VM/370 R6 and MVS3.8J TK4- for fun. MVS3.8J certainly helped for the challenge and vice-versa!

    1. Hi TRS80

      Thanks for sharing that! You have made me jealous, I would love to have some real work experience like you!

      Also, thanks for checking out my blog!

      Kind regards,
      – Kevin

  4. My output on challenge 15, gives me Julian Day and wondering if there’s suppose to be more text on the output.
    I’ll try to redo challenge.
    It just sometimes I don’t like IBM explanation.
    Sometimes they don’t give adequate information.
    Or put unnecessary text so finding the command to run might be trivial.

  5. Hi Kevin,
    You can say as well how to verify the working result with DB2 Interactive functions and SPUFI as learned in part#2 ch#14.
    Last year challenge was not so javaish like this one. Therefore I found some interesting lessons like how to call java procedures with JCL, but maybe some explanations could be given:
    To compile and execute the java program with JCL:
    000001 //DB2JAVA JOB 1,REGION=0M,NOTIFY=&SYSUID
    ==> to run the compilation process ==>
    000002 //JAVAC EXEC PGM=BPXBATCH,
    000003 // PARM=’sh javac db2java.java’
    000004 //STDOUT DD SYSOUT=*
    000005 //STDERR DD SYSOUT=*
    000006 //CEEDUMP DD DUMMY
    000007 // IF RC = 0 THEN to run the program ==>
    000008 //JAVA EXEC PGM=BPXBATCH,
    000009 // PARM=’sh java db2java’
    000010 //STDOUT DD DSN=&SYSUID..P3.OUTPUT(#08),DISP=SHR
    000011 //STDERR DD SYSOUT=*
    000012 //CEEDUMP DD DUMMY
    000013 // ENDIF
    Thinks like that would give you more ideas!!!
    Kind regards
    Georges

  6. I am not gettin what is the issue in the connection to DB2 server.
    please guide me with this with a hint or the solution.

  7. It all was started forcefully with zero interest but now i’m really enjoying it. But I request you man please don’t post every line of code. Many of my friends just blindly copying you without getting actual knowledge, and are getting everything easily. I even know some of my classmates who were asking me “Dude! How to install vista TN3270” and when they get part 2 finisher badge, people like me who are actually involves in this type of work feels upset.

    1. Hi Guarav

      I understand your concerns. Thanks for sharing, this is really the reason why I asked it in my blog.

      Someone on my blog expressed similar concerns at challenge 13 of part 2, please read those comments. IBM allowed me (last year) to post the solutions of part 2. But they wanted me to censor the solutions of part 3.

      If you think something more could be censored in a blog, feel free to comment (maybe anonymously) or fill out my contact form. Some users did that last year too, I seriously don’t mind.

      What you have described is indeed typical student behaviour. They are going to struggle in the creative challenges where I won’t be of much help. To be exact, part 3 challenge #13 and part 3 challenge #15.

      I know that this blog might help some students easily get an achievement that others have worked hard for. But know what you did and what others did.

      I hope this makes sense.

      Kind regards,
      – Kevin

Leave a Reply

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