Search code examples
compilationversioningcobolzos

COBOL Copybook Versioning


I have a COBOL compile job which I didn't write and I am trying to understand how that works. It looks something like this:

//COB      EXEC PGM=IGYCRCTL,COND=(0,NE,TRN),
//             PARM=('DTR,NUMPROC(PFD),NOADV,LIST,LIB,TRUNC(BIN)',     *
//             'NOSEQ,DYN,RMODE(ANY),OUT(SYSPRINT),MAP')
//STEPLIB  DD DISP=SHR,DSN=SYS1.IGY.SIGYCOMP
//SYSPRINT DD DSN=xxx..xxx..xxx.LST(&NAME),DISP=SHR
//SYSUT1   DD UNIT=SYSDA,SPACE=(460,(1700,1000))
...
//SYSLIB   DD DISP=SHR,DSN=xxx..xxx..xxx.CPY
//         DD DISP=SHR,DSN=SYSQ.MQS710A.SCSQCOBC         MQ-SERIES

It is not the real Job, I changed some parts to "xxx" because I can't give out the real code. I understand that the datasets after SYSLIB are the dependencies of the program I am compiling. What I don't understand is how versioning works here for the Copybooks. It will pull anything in that is in the dataset under the qualifier "xxx..xxx..xxx.CPY". How do I know that there are all Copybooks needed (compile error?) and that they are the right version, that the original programmer intended to use. For the MQ-Series Copybook dataset there seems to be a version-number in the name "MQS710A". Is that the way it is supposed to be on z/OS? The other dataset "xxx..xxx..xxx.CPY" doesn't have anything like a version in the name, the "xxx" were just a bunch of letters.


Solution

  • When a COPYBOOK is referenced it is selected based on the first dataset where the COPYBOOK is found. The compiler does not look at the dataset name where you are seeing the version number. The version number is a convention to control when new changes are introduced into the environment.

    As an example, let's say a new version of MQ is installed the dataset can be changed to reference the newer version. This will depend on how the system programmers introduce change into the environment. Thats a more complicated answer beyond what your post is hitting on.

    If you are "versioning" you would order the sequence of datasets in the concatenation. For instance, you might see something like:

    //SYSLIB   DD DISP=SHR,DSN=xxx.DEV.xxx.CPY
    //         DD DISP=SHR,DSN=xxx.PROD.xxx.CPY
    //         DD DISP=SHR,DSN=SYSQ.MQS710A.SCSQCOBC         MQ-SERIES 
    

    This approach allows development to pick up copybooks that are being modified as part of a new feature and then retrieve the remaining ones from the current in production versions.

    All that said, if you are using a Source management system their process for compilation would be different than a simple concatenation.

    If a COPYBOOK isn't found you will get a compile error.