COBOL Compiler from MVT


The COBOL compiler and installation files are contained in the archive:  cobol.tgz [MD5: 0ffef09764d061de8d28903d2c89a04f].  Click on the archive name to download the archive to your computer.  The archive contains:

Uncompress the archive (use the tar xvzf cobol.tgz command on Linux or use WinZip or ZipNAll on Windows).  The tape image should go into your tape image subdirectory, the jobstreams should go into your JCL subdirectory, and the map file may be viewed with a text editor or printed if you are curious about the contents of the tape image.  Note:  The jobstreams were created under Windows, so each line is terminated with x'0d0a'.

The COBOL compiler consists of a set of load modules, which are invoked during the compilation of a user written program, and a set of object modules, which are used during the link-editing of a compiled program.  The compiler load modules are contained in the first dataset on the tape image (COBOL.LOAD).  The object modules are contained in the second dataset on the tape image (COBOL.LIB).  These two datasets were created by an IEBCOPY unload and the two libraries were unloaded from 3350 DASD (RECFM=U,BLKSIZE=19069).  The third dataset on the tape image (COBOL.PROCS) is a set of Catalogued Procedures, in IEBUPDTE format, that can be used to invoke the compiler. 


Target Libraries

The load modules for the compiler must be restored to a load library and the object modules must be restored to a Partitioned Dataset that will be available to the Linkage Editor.  The Catalogued Procedures should be restored to a procedure library known to JES2 on your system.  The default targets in the installation jobstream are SYS2.LINKLIB (for the load library), SYS1.COBLIB (for the COBOL object library), and SYS2.PROCLIB (for the Procedure Library).  If these libraries are not correct for your system, you must edit the installation jobstream before submitting it and substitute destination libraries suitable for your configuration.  Search for the comment - <==TARGET - which is contained on each line where a target library is named.  Additionally note that SYS1.COBLIB is created in step LINK003 and changes to the UNIT and VOL=SER parameters may be required to conform to your configuration.

The installation jobstream reloads the unloaded libraries to temporary datasets and the re-links the contents to the target libraries.  This allows you to place the restored modules on the type of DASD that fits your configuration, rather than restrict the destination to 3350 DASD.  However, you must have 3350 work space available in your configuration to restore the datasets to during the installation.

When you have verified that the installation jobstream - mvtcobol.jcl - conforms to your configuration, mount the tape image on a tape device and submit the jobstream to MVS for execution.  The job should take no more than a minute to execute and the return codes expected for the steps are:



Installation Verification Jobstream

The cobtest.jcl jobstream performs a compile, link, and execute of a simple COBOL program to print the phrase "HELLO WORLD" on the MVS console.  The complete JES2 output for this job may be viewed at cobtest.

After the compiler has been successfully installed and verified, you do not need to retain the installation jobstreams or the tape image on your host computer.

November 2004 Update - I have written a macro, jobstream, and instructions for changing the installed default options for the COBOL compiler (without regenerating the compiler via MVT System Generation).  See: MVT COBOL Compiler Default Options.


Patch for XREF Abend  September 2019

In September 2019 there was a discussion on H390-MVS about the long known about abend of MVT COBOL when attempting to specify XREF in the options to obtain a Cross Reference listing of the source program being compiled.  Although the MVT COBOL compiler performs as expected under MVT, it always abends if XREF is requested when executing under MVS. Dave Kreiss researched and found that the compiler was attempting to organize acquired storage to be contiguous, which is simple under MVT, but more complex, if not impossible, under MVS. He submitted a patch to the compiler load module that seems to eliminate the problem and allow compiles to complete when XREF is requested. I applied the patch on my system. In the several test compiles I submitted to the patched compiler, I found that XREF now provides the expected Cross Reference listing. Others posted that they had positive results when they applied the patch on their system. Although this does not mean that the problem is completely resolved, as very large compile jobs requesting XREF may still abend, it seems that we can be hopeful that this has resolved the problem for the majority of cases in the Hercules' user community. 

I am providing a copy of the jobstream here as ZAPCOBOL. You may download the jobstream and run on your system to patch the load module of MVT COBOL on your system. As written, the jobstream is targeting the load module residing in SYSC.LINKLIB, which is the library contained on my Compiler Language/Tools volume (SYSCPK).  If the MVT COBOL compiler is stored in a different load library on your system, you will need to modify the jobstream to point to that library.


COBOL Programs with ISAM and VSAM Datasets

December 2021  I have added a page with example COBOL programs that demonstrate how to use the MVT COBOL compiler to write programs to load, update, and access indexed datasets that are:  1) native ISAM, 2) VSAM accessed with ISAM logic/code via the ISAM/VSAM Interface Program, and 3) VSAM accessed via my VSAMIO subroutine.  That page is available at COBOL Programs with ISAM and VSAM Datasets.


Patch for Year 2000 (and beyond) December 2021

Recently I have been doing more compilations with the MVT COBOL compiler, and it finally began to bug me seeing the 19?? date in the COBOL listing header, not to mention the missing space between the day of the month and the year.  I am certain that at one time there was a patch floating around to fix the century in the header, but if I recall correctly, it simply replaced the '19' with '20', and, regardless, I could not find the patch after a reasonable time searching.  Anyway, I was interested in not just a brute plugging of the incorrect century, since I also wanted to correct the incorrectly spaced punctuation.  And I often read a criticism from Brian Tiffin on the GnuCOBOL lists about breaking things with updates, so I thought it would be nice if my patch would allow compiles if the system date falls in 2000 or beyond, but would also handle pre-2000 dates, just as it had been doing.  So, I have written an AMAZPZAP jobstream to patch the CSECTs IKFCBL01 and IKF011 in load module IKFCBL01 to achieve these two goals.  I mostly utilized the date building code that was originally there, but computed the century by adding 1900 to the century byte that is provided by MVS with a TIME SVC request.  I have applied the patch to the load module in SYSC.LINKLIB, so if you are a user of my SYSCPK volume, simply grab a new copy for your system and you are good to go.  The jobstream that will allow you to apply the patch to the MVT COBOL compiler if it is located in another library on your system is available here:  mvtcobol.y2k.patch.jcl.  If you want to see the output from the patched compiler, look at any of the output PDFs from the COBOL compile jobs in the link immediately above.

March 2021  Marco Verpelli found a buglet in the patch above.  The only major deviation from IBM's code that I made in the date formatting was to use the EDit instruction to move the day to the output field, so of course I made an error in the edit mask.  Marco discovered after using the patched COBOL compiler that a x'20' was left in the date.  The patch has been corrected and the COBOL compiler contained on SYSCPK has had the correct patch applied. 

I hope that you have found my instructions useful.  If you have questions that I can answer to help expand upon the information I have included here, please don't hesitate to send them to me:

Return to Site Home Page 

This page was last updated on March 07, 2022.