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
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!
Hello Kevin, I’ve been enjoying MTM2019 a lot, and while some parts were quite challenging for someone who’s new to programming (packed decimals was quite the head-scratcher when I first encountered it in Pt 2), I kept at it and it turned out a lot easier than I thought it was (sometimes I tend to panic and make things a lot more difficult than they actually are).
I first learned about MTM when it was suggested to me back in July, because I was interested in learning COBOL; I saw an article on How-to Geek about COBOL a while back, where I learned just how important COBOL is for the worlds economy (it’s especially vital for banks who need it for transactions and balance inquiries) how there’s a shortage of COBOL programmers, and me realizing that I’m going to need to learn a programming language or two in order find work in IT, I decided to give it a shot as a way to keep busy, learn something new, and better myself.
Long story short, I’m doing MTM to expand my skills and possibly help in landing a job, and once I’m done with part 3, I’m going try and find more courses so I can continue to improve; I’ve already joined the MTM community on IBM, so maybe someone will have some suggestions there.
Hi Shirley
Thanks for sharing your story! And thanks for all the kind comments you’ve been leaving on my blog, I’m not really active the last few weeks but I do read all my comments.
I hope the best for you and I really do hope you land a job! Someone from my blog that I’ve helped just recently landed a Mainframe job, so it’s definitely possible!
Kind regards,
– Kevin
Hey,
when I submit a job I dont get any job output anymore, and I don’t know why
for example if i enter tso sub ‘zos.public.jcl(db2java)’ ; =sd ; st
I get the following screen: https://ibb.co/4JTf1KX
and if I enter ? to the left of this I get the following: https://ibb.co/M1tV7Sm
Any idea how to fix this?
Hi @Jupiops,
next time, you may want to use the following:
=sd; prefix; owner z#####; st
it should work.
Hi Kevin,
I am getting just 4 digits of the phone number at the output. Is this ok?
Hi Harsh Pandloskar
That is ok!
Kind regards,
– Kevin
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 🙂
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
stop stealing my name BRO
My Output is 4 digits. Did it complete correctly?
Hi Anonymous
Yes 4 digits is the correct output.
Kind regards,
– Kevin
I can’t wait for until you do challenge 14.
Because at first I got p3.output(#14), but after doing some commands the output is blank.
I am doing it to get a job
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!
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
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.
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
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.
Hi Bikash
Somewhere in the code it needs login credentials. Fill in yours.
Kind regards,
-Kevin
Should i give my password too…!!!
Hi Bikash
Yes you should.
Kind regards,
– Kevin
I am unable to fix the errors in db2java file
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.
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
Kevin,
I agree totally with you!
Kind regards
Georges