IBM MTM: Part Three – Challenge #04

This is the moment! This is THE challenge! My first encounter with COBOL! YAY! I’ll leave out the intro this time boys ‘n girls. I want to start, now!

Application Development Using COBOL

IBM Master the Mainframe Part Three – Challenge #04

Common Business-Oriented Language, that’s what COBOL stands for. COBOL manages some of the most critical data and business logic in the world’s economy. Many reasons exist for why COBOL is a computer language with incredible longevity. COBOL that runs in the z/OS Environment is called Enterprise COBOL.

In this challenge I will read COBOL source code and compile it into an executable module. This particular COBOL program reads the BBRI client data set name used in the previous challenge and prints several of the fields from each record.

I need to solve the compilation error to complete the challenge. A good COBOL tutorial can be found at tutorialspoint.

I need to edit Z30163.source, create a new member cbl0001 and copy ‘zos.mtm2018.public.source(cbl0001)’ into it. Done! Let’s see…

The code is split in 4 divisions.

  • Identification
  • Environment
  • Data
  • Procedure

Lines with asterisks are treated as comment lines. Now jump back to Z30163.JCL and select member cbl0001j.

  • IGYWCL is a system JCL procedure used to Compile COBOL source code
  • //COBOL.SYSIN references the COBOL source code input that was reviewed
  • //LKED.SYSLMOD references the executable program created from the compile
  • //STEP2 EXEC PGM=CBL0001 is program execution step

Now let’s submit the JCL job! JOB CBL0001J(JOB03331) SUBMITTED!

IGYPS2072-S is a severe COBOL syntax error. The text explains what needs to be fixed. Let’s edit Z30163.source(cbl0001). It was a very simple fix. Let’s run! tso submit jcl(cbl0001j) ; =sd ; st

JOB CBL0001J(JOB03380) SUBMITTED
JOB03380 $HASP165 CBL0001J ENDED AT SVSCJES2 - ABENDED S000 U4038 CN(INTERNAL)

If the compile was successful then the output should show that the program execution failed.

IGZ0035S There was an unsuccessful OPEN or CLOSE of file ACCTREC in program CBL0001 at relative location X'1A2'.
Neither FILE STATUS nor an ERROR declarative were specified. The status code was 35.
From compile unit CBL0001 at entry point CBL0001 at compile unit offset +000001A2 at entry offset +000001A2
at address 1AC001A2.

It failed! Ya… y? Now I need to identify and fix JCL that caused the COBOL program execution to fail. Neither FILE STATUS nor an ERROR declarative were specified. Interesting! But where in the JCL do I need to declare it? I’m not really sure where I should look. Oh wait… HINT: look for ACCTREC inside the JCL 😉

JOB CBL0001J(JOB03539) SUBMITTED
JOB03539 $HASP165 CBL0001J ENDED AT SVSCJES2  MAXCC=0000 CN(INTERNAL)

Looks okay! Now I just need to XDC the output to P3.OUTPUT(#04) and I’m done!

Almost there!

I almost completed 5 Part Three challenges! That’s a small milestone! Next challenge isn’t about COBOL, but about ICETOOL. But hey! COBOL will happen later!

Are you looking forward to something?

Share this:

9 thoughts on “IBM MTM: Part Three – Challenge #04

  1. I have corrected the error in jcl but after that i am getting an abbended error how is it possible bcz it is said that their is only one error in the challenge either i change it in the jcl or in the cobol code

    1. Hi Anonymous, have you fixed something inside the COBOL source code AND the JCL code? You need to fix two things in order for this code to execute correctly.
      – Merry Christmas, Kevin

  2. I am not sure if you still check this, but hoping to get a little help. I have fixed the COBOL source, and submitting the JCL I get the unsuccessful OPEN or CLOSE. I know I’m supposed to fix the JCL error to get it to run, and your hint says to look at the ACCTREC in the JCL. Do I need to know COBOL more to figure this out? Am I looking in Z######.JCL data set for the error or is it in the JESSMSG, or the other outputs in the: sd ; st ?

    I am in a programming boot camp with zero programming experience, and we’re doing the MTM 2018 as learning tool.

    Thank you

    1. Hi Chris!

      Yes I still do check this blog 🙂 It’s been a while since I’ve done this challenge and I don’t have the means available to connect to the mainframe right now.

      In the COBOL source code you had to fix a spelling error. In the JCL you need to do the same. Look at line 12. It should be something else 🙂

      Kind regards,
      Kevin Durant

Leave a Reply

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