IBM MTM 2019: Part Three – Challenge #05

Java! 3 billion devices their best friend! Java is one of the biggest programming languages out there and now we have the chance to work with it on a mainframe.

Note: there might be some encoding issues if you copy and paste the copy commands from my blog into the mainframe. It’s best you copy the paths from the mybluemix website. My quotes are saved differently somehow (angry emoji).

Java – A popular programming language

IBM Master the Mainframe Part Three – Challenge #05

Copy Java program to MVS partitioned data set member and Unix file

Let’s navigate to our Z#####.SOURCE and create a new member using the primary command s pgmjava. Inthere we copy ‘ZOS.MTM2019.PUBLIC.P3.SOURCE(PGMJAVA)’.

Let’s return to the dslist by pressing F3. As primary command we enter TSO OMVS and enter oedit pgmjava.java

Once in edit mode we copy source(pgmjava) and return using F3.

Compile and execute Java program using Unix shell prompt

From the OMVS shell I enter javac pgmjava.java as command. There might be a message, but we can ignore that one.

So, we now have to connect to the workstation via SSH. Good lord, yeah, let me try.

Ok…

Oof, (sweaty palms emoji thingy). I got in. RIGHTCLICK to paste something in the command prompt, I used CTRL+V and felt stupid.

Now it compiled correctly! Does it suddenly have java because it’s accessed via CMD? WHAT.

YES I PRESSED CTRL+V AGAIN. OOPSIE. Let’s execute using java pgmjava. And I saw the hello world message! YESS! Enter the command exit to safely terminate the SSH connection.

Execute the Java program using JCL

Now in Z#####.JCL we create a new member pgmjava and copy ‘ZOS.MTM2019.PUBLIC.P3.JCL(PGMJAVA)’ into it. After that, let’s submit ; =sd ; st and check the output.

Last task to get full credit for the challenge

We need to change STDOUT in jcl member pgmjava and redirect output to member #05 in to our P3.OUTPUT partitioned data set.

I honestly don’t know what I need to do here, so I’ll just copy and paste the code after //SORTOUT in Z50087.JCL(SORTCITY) and change it to P3.OUTPUT(#05). I’ll take my chances! If you’re unsure if you have the correct thing, just compare our things’ length. If you’re as long as mine, you’ve got it.

Let’s execute! No errors so far. Let me check P3.OUTPUT(#05).

Done! All good! Let’s continue to challenge #06!

12 thoughts on “IBM MTM 2019: Part Three – Challenge #05

    1. Hi Suraj Burman

      Are you talking about challenge #04? Where you need to replace ??? ? with IBM Z? That’s on line 003000, where a specific character needs to be replaced with question marks.

      If you’re talking about this challenge and the STDOUT then I mean I copied the DD DSN=&SYS… from Z50087.JCL(SORTCITY) and put it at the STDOUT message. I have replaced P2.OUTPUT(#??) with P3.OUTPUT(#05).

      Kind regards,
      – Kevin

      1. i have replaced with this code
        DD DSN=&SYSUID..P3.OUTPUT(#05),DISP=SHR
        but on execution it shows
        contained in clist has invalid syntax.

            1. Hi Anonymous

              Sorry for the late reply! Well, while it’s out there, I have:

              1
              2
              3
              4
              5
              000001 //JAVAC    EXEC PGM=BPXBATCH,REGION=0M,          
              000002 //  PARM='sh java pgmjava'                        
              000003 //STDOUT   DD DSN=&SYSUID..P3.OUTPUT(#05),DISP=SHR
              000004 //STDERR   DD SYSOUT=*                            
              000005 //CEEDUMP  DD DUMMY

              And that did the trick, are your sure nothing is different?

              Kind regards,
              – Kevin

              1. Here’s my PGMJAVA output
                000001 //JAVAC EXEC PGM=BPXBATCH,REGION=0M,
                000002 // PARM=’sh java pgmjava’
                000003 //STDOUT DD DSN=&SYSUID..P3.OUTPUT(#05),DISP=SHR
                000004 //STDERR DD SYSOUT=*
                000005 //CEEDUMP DD DUMMY

                1. Hello Mig

                  I assume you mean that is your JCL(PGMJAVA)? It looks like an exact copy of mine, it’s very strange that it doesn’t work.

                  First, DELETE P3.OUTPUT(#05) and execute the script again, see if that helps. After execution, check if there is any error in the output log. I’m not sure if the line command to delete the output is ‘d‘ or ‘p‘.

                  If it’s not resolved then I would suggest consulting the Slack channel at https://masterthemainframe18.slack.com/ and see if anyone else can help you out. I’m out of ideas.

                  Kind regards,
                  – Kevin

                  1. is there a difference using ex command or submit ; =sd ; st to execute?
                    i think this is the problem with the message clist has invalid syntax.

                    1. Hi Anonymous

                      By saying execute I meant “submit ; =sd ; st”, I might have confused you with the execute command that REXX needs. Sorry for that.

                      Kind regards,
                      – Kevin

Leave a Reply

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