Tim's Hercules Page

Installing GCCMVS

Thanks to the efforts of Phil (halfmeg), Paul Edwards, David Wade and other contributors and bug hunters, there is now a free, open source C compiler for use on MVS. It was initially a fair amount of work to install GCCMVS and involved cross-compiling GCCMVS on a PC, copying over source code, building the C library, and so on. With the tape release, GCCMVS can be installed with relative ease.

GCCMVS is actually made up of two components. GCCMVS by itself is a port of the GNU C Compiler to run on MVS. It also comes with PDPCLIB, a public domain C library by Paul Edwards. In theory, the two can be interchanged - you can use GCCMVS with another C library or use PDPCLIB with another compiler. In reality, the two seem to work well together and at the moment there's not a compelling reason to try to port another compiler or use another C library.

Before starting, I recommend having an up to date version of RPF installed and installing IND$FILE. Neither is required, but will make the process considerably easier.

The first step is to download the tape and JCL. Both files are available at Phil's GCCMVS web site. Specifically, the tape can be downloaded here and the JCL can be downloaded here.

When everything is downloading and unzipped, you should have three files - gccmv2.aws is the AWS-format tape with GCCMVS and PDPCLIB, stage0a.jcl is a job that will create the datasets for GCCMVS and PDPCLIB, and gccload.jcl is a job that will unload the tape into datasets created by stage0a.jcl.

GCCMVS uses two high level qualifiers (GCC and PDPCLIB) that do not exist on the MVS Turnkey system. If you ran stage0a.jcl at this point, MVS would catalog the datasets in the master catalog, which is not a good thing.

The job below will create aliases for GCC and PDPCLIB that point to the SYS1.UCAT.TSO user catalog which is also used by RPF. Change NOTIFY=HERC01 to your user ID to be notified of the job status.

//DEFALIAS JOB CLASS=A,MSGCLASS=X,NOTIFY=HERC01
//IDCAMS   EXEC PGM=IDCAMS,REGION=4096K
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  *
  DEFINE ALIAS (NAME(GCC) RELATE(SYS1.UCAT.TSO))
  DEFINE ALIAS (NAME(PDPCLIB) RELATE(SYS1.UCAT.TSO))
/*
//

Download JCL (defalias.jcl)

This job was based on a job from Jay Moseley's VSAM Tutorial.

After you submit the DEFALIAS job it may appear to freeze or appear stuck. When adding an alias, MVS will need to access the master catalog which is password protected by default. The default password is SECRET. The dialogue on the master console may look like this:

00  JOB    3  $HASP100 DEFALIAS ON INTRDR
  - JOB    3  $HASP373 DEFALIAS STARTED - INIT  1 - CLASS A - SYS BSP1
  - JOB    3  IEF403I DEFALIAS - STARTED - TIME=21.14.27
   *JOB    3 *00 IEC301A S JOB DEFALIAS DSNAME SYS1.VMASTCAT

At this point you would type R 00,SECRET (R is short for REPLY). Note the (added) emphasis on the 00 in the master console output. When you reply to a console message, make sure that your reply number corresponds to the message number. For example, if it had said *JOB 3 *05 IEC301A S JOB DEFALIAS DSNAME SYS1.VMASTCAT, your reply would be R 05,SECRET.

The master console will look like this after you reply.

| JOB    3 *00 IEC301A S JOB DEFALIAS DSNAME SYS1.VMASTCAT
00-         R 00 SUPPRESSED
            IEE600I REPLY TO 00 IS;SUPPRESSED

It will ask again since you are defining two aliases, so reply again, except the reply number will be different (usually one higher), for example R 01,SECRET. Make sure you pay attention to the request and respond with the correct number.

After defining the aliases, you are ready to create the datasets for GCCMVS. You can either use the card reader or copy the job stage0a.jcl to MVS with IND$FILE and submit it.

After the datasets are created with stage0a.jcl, the tape can be unloaded. Make sure the tape drive has been varied online before running the job. You can do this by entering V 480,ONLINE on the master operator console (the first 3270 console you connected to Hercules).

00-           V 480,ONLINE
              IEE302I 480      ONLINE

You can either use the card reader or copy the job gccload.jcl to MVS with IND$FILE and submit it.

The last step is optional, but recommended. GCCMVS comes with a JCL procedure that can be installed in a procedure library. I recommend putting it in SYS2.PROCLIB since other compilers also use that for their procedures.

If you're using RPF, select option 3.3 (RPF Move/Copy Allocation Menu). Set the option to C (copy), From dataset is GCC.PROCLIB, To dataset is SYS2.PROCLIB. You do not need to specify volume because both datasets are cataloged. Press enter, type an S next to GCCMVS, and press enter.

You are now ready to start using GCCMVS. A brief overview of GCCMVS usage is covered in Using GCCMVS.


Back