COBOL! This is probably going to be one of my most favorite challenges in this years’ master the mainframe. I actually have explained COBOL a bit in one of my other blogsposts MOM Pt. 003: Getting to know COBOL – Compiling. It explains how COBOL works and what the code looks like. The fourth part also shows me coding a FIZZBUZZ in COBOL on MVS 3.8 TK4-.
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.
Application Development – Procedural Programming Languages
IBM Master the Mainframe Part Three – Challenge #04
Practice Preparation
So from the ISPF Primary Option Menu I enter =3.4 and navigate to my Z#####.SOURCE. For this part we need to make new empty members and copy some data into them.
I create a new member using the primary command s. Then I will edit that member using the line command e and copy ‘zos.mtm2019.public.p3.source(cblhello)’ and copy ‘zos.mtm2019.public.p3.source(chello)’ into them.
This is what it looks like after copying a member. Next do this in your Z#####.JCL and make a new member hello. copy ‘zos.mtm2019.public.p3.jcl(hello)’ into it. Execute the JCL using sub ; =sd ; st primary command.
After execution, execute the following primary commands: tso call load(cblhello) and tso call load(chello). These commands just execute the scripts we have just copied.
Get and review COBOL program source code.
We’ll create a new member called zcobol in Z#####.SOURCE and copy ‘zos.mtm2019.public.p3.source(zcobol)’ into it. Find the RECIN and RECOUT file names in the source code and take note. We can easily search a file using the f primary command.
Get and review C program source code
Same as last time. We create a new member called zc in Z#####.SOURCE and copy ‘zos.mtm2019.public.p3.source(zc)’ into it. Find the recin and recout.
Get and review program compile and execution JCL
Same as last time but other data set. In Z#####.JCL we create a new member rwrecord and copy ‘zos.mtm2019.public.p3.jcl(rwrecord)’ into it. Find the recin and recout.
It’s possible to have mutliple RECIN and RECOUT.
Execute C and COBOL programs
Don’t worry, I did not skip a paragraph. It’s just nothing I can write about. Let’s compile and execute the recently created jcl using primary command tso submit jcl(rwrecord). Now in P3.OUTPUT(#04) we should see the following text.
The message needs a correction to complete the challenge
We get to code? We get to code! Let’s quickly visit ZCOBOL in Z#####.SOURCE and see what can be done.
Somewhere in the code it replaces characters with other characters. I wonder what it can be! Let’s edit and run primary command tso submit jcl(rwrecord) again.
I did it! Woot! Now we need to copy source(zcobol) after a at line 000003.
And we should have the source code under it.
That’s it for challenge #04!
Further challenges
I’m a bit behind on schedule sorry for that. I have had very little free time the last few weeks but I plan on doing a blogging day next saturday the 9th of november. That should get me to at least challenge 10 of part 3.
Goodluck everybody!
I didn’t get it the first time and found that I needed to delete p3.output(#04) in order to have the correct output file – it wasn’t overwritten when I reran.
Hello,
is it possible to check my P3 status?
Hello Akos
Unfortunately it’s not possible to view your progress. They have a point system for the third part and I believe you need a certain amount of points to pass. You’ll only know your results in January.
By the way, I have noticed you helped out some users on my blog. Thank you a lot for that!
Kind regards,
– Kevin