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!

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

  1. I could not make the ssh work on my Laptop

    C:\Windows\System32>cmd.exe
    Microsoft Windows [Version 10.0.14393]
    (c) 2016 Microsoft Corporation. All rights reserved.

    C:\Windows\System32>ssh [email protected]
    ‘ssh’ is not recognized as an internal or external command,
    operable program or batch file.

    I could not even Install ssh from my Windows settings
    Please healp

  2. K here. Help!

    I am stuck in the Unix shell (after the first step in ‘Compile and execute Java program using Unix shell prompt’ and are trying to get in to ssh. I do not think I did it correctly, for now I cannot get out of it. this is a pasted view of my screen. What do I do? how do I get out of here?
    IBM
    Licensed Material – Property of IBM
    5650-ZOS Copyright IBM Corp. 1993, 2017
    (C) Copyright Mortice Kern Systems, Inc., 1985, 1996.
    (C) Copyright Software Development Group, University of Water

    U.S. Government Users Restricted Rights –
    Use,duplication or disclosure restricted by
    GSA ADP Schedule Contract with IBM Corp.

    IBM is a registered trademark of the IBM Corp.

    /z/z02688 > oedit pgmjava.java
    /z/z02688 > javac pgmjava.java
    JVMJ9GC020E -Xms too large for heap
    JVMJ9VM015W Initialization error for library j9gc29(2): Faile
    Error: Could not create the Java Virtual Machine.
    Error: A fatal exception has occurred. Program will exit.
    /z/z02688 > ssh [email protected]
    The authenticity of host ‘192.86.32.91 (192.86.32.91)’ can’t
    RSA key MD5 fingerprint is 18:6c:f2:06:f5:2c:89:6a:1e:1e:b5:9
    Are you sure you want to continue connecting (yes/no)? yes
    FOTS2274 Warning: Permanently added ‘192.86.32.91’ (RSA) to t
    sts.
    FOTS3322 Passwords may not be entered from 3270 terminals
    /z/z02688 >
    /z/z02688 >
    /z/z02688 > end
    end: FSUM7351 not found
    /z/z02688 >

    1. Ok I just got out of it. Logging on with another computer somehow did the trick. I will try getting into the ssh from the tso command.

    1. Hi Nilay Paul

      That’s odd! There are some broken characters in that string that need to be fixed in the next challenge. Maybe your SDSF editor is on a different viewmode.

      Kind regards,
      – Kevin

    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.