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.

29 thoughts on “IBM MTM 2019: Part Three – Challenge #09

  1. hey Kevin you really help me a lot 🙂 Thanks for that you cleared my doubts

    I have doubt, In the part 3 challenge 9. I follow all the steps but i got the desired o/p of Ch-9 in Ch- 8 and vice-versa . Is I executed the wrong command?

      1. Hi Vidit

        Don’t forget there’s also a Slack channel that is out there to help you 🙂

        You’re telling me your output of challenge 09 got into challenge 08’s output? Do challenge 08 again, then do 09 again. Be sure when doing 09 that you change the member in JCL(DB2JAVA) at line 000010 from #08 to #09.

        Kind regards,
        – Kevin

      1. Hi Anonymous

        I’m not able to help you if you don’t post the error you’re experiencing. Please read the error carefully and re-do the entire challenge.

        Kind regards,
        – Kevin

  2. Sir i have made the necessary change from user id to statement change phonenumber to employeenumber but still my output is stuck on phone number even though i compiled still output is not chnging to employeenumber.

  3. Sir …can you please give me a proper description about each line that how to modifiy that java code … I have changed what i understood but it shows error after submitting the code… Please tell me…which line i should change and what to write in the code.

  4. I finally figure out how to do challenge 9.
    I just need to look back at challenge 8 for a command.
    The command to run on db2java.
    I was overthinking on this challenge.

  5. I only able to get one employee number.
    Do I have to edit the SQL file?
    Do I have to switch text from line 41 and 42?
    I put a plus sign of the number.
    Do I put different symbol?

    1. Hi Mig

      No you don’t have to edit the SQL file, all the changes are made in the Java file. There’s no need to switch text at said lines. You just need to change the SQL query.

      I’m not sure if you’re familiar with string concatenation in Java. But the plus sign is used to concatenate strings. “select employeenumber from ibmuser.vphone ” + “where x = ‘y'”;

      Please take note of the extra space I have put after vphone. Also I close the quotes like they did.

      Kind regards,
      -Kevin

  6. Hello,

    thank you again for this tutorial! Just a little thing, output format should be like this: “the employeenumber string preceeded by Employee Number:” and you wrote “ubmuser.vphone”.

    Akos

    1. Hi Akos,
      I have a problem in Part 02 Challenge 12, I followed the the instructions as said but I didn’t get the needed result please help me how to fix this problem, because I stuck in it.

  7. Shoot, I’m getting put on time out.
    I could sometimes have loose lips.
    I will try my best to have tight lips.
    Thanks for all your help on the MTM!

  8. Hi Kevin,
    I see my name here, is me 😉 ?
    Yes SQL could be very interesting, because all the info in this world is in a database!
    I think in your own mainframe (Hercules) according to MOSHIX you don’t have access to DB2? That is sad! 🙁
    Anyway good answer again! You are GOOD!
    Kind regards
    Georges

        1. Hi Rishika

          The changes needed are not visible on my screenshot if that causes the confusion. You need to change the SQL statement and the print statement at said lines.

          Kind regards,
          Rishika

          1. pls i am always still getting the same output with the phone: **** after editing the lines needed pls were else can the problem be

      1. Hello Kevin,

        Quick question, on line 52 and 56 when I changed the string variable “ephone” to something else and run the JCL and I received an error and when I leave it alone the program run successful. Do you know why I keep receiving an error when I change the string variable ? I already complete the challenge, I am just curious on why.

        Thanks,
        Nick

Leave a Reply

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