Mainframe Utility: CMP

Return to Mainframe Utilities Page

Module


PROC 0 HELP
/****************************************************                   00010000
/* FUNCTION: CMP                                    *                   00020000
/*                                                  *                   00030000
/* DESCRIPTION: COMPARE TWO CHANGED AGAINST BASE    *                   00040000
/*                                                  *                   00050000
/* INPUTS:   NONE                                   *                   00060001
/*                                                  *                   00070001
/* OUTPUTS:  NONE                                   *                   00080001
/*                                                  *                   00090001
/* NOTES:    NONE                                   *                   00100001
/******************* Modifications ******************                   00110001
/* 08/31/92 By: David Leigh                         *                   00090001
/*          I added a call to UTILLOG at the        *                   00090001
/*          beginning and I added code to allow     *                   00090001
/*          people with no TSO PROFILE PREFIX to    *                   00090001
/*          use CMP.  I looked into changing each   *                   00090001
/*          dataset reference to use an explicit    *                   00090001
/*          SYSUID prefix, but that looked more     *                   00090001
/*          complex at first glance than I wanted to*                   00090001
/*          get.  The problem with this method is   *                   00090001
/*          that if CMP bombs and the prefix had    *                   00090001
/*          been changed just for CMP, it would     *                   00090001
/*          remain changed and the person would be  *                   00090001
/*          screwed up!                             *                   00090001
/* 06/19/95 By: David Leigh                         *                   00090001
/*          In the event of an IEBUPDTE bad return  *                   00090001
/*          code CMP will now edit the SYSPRINT     *                   00090001
/*          dataset and then exit the CLIST.  This  *                   00090001
/*          was added to both IEBUPDTE calls.       *                   00090001
/****************************************************                   00110001
ISPEXEC CONTROL ERRORS RETURN
ISPEXEC VGET (DBGSWTCH) PROFILE
IF &DBGSWTCH = &STR(ON) THEN CONTROL MSG LIST CONLIST SYMLIST NOFLUSH
ELSE CONTROL NOMSG NOLIST NOFLUSH NOPROMPT

/**********************************************************************
/* DISPLAY HELP IF REQUESTED                                          *
/**********************************************************************
IF &HELP = HELP THEN GOTO HELPSEC

/**********************************************************************
/* Adjust for users who have PROFILE NOPREFIX in their logon          *
/**********************************************************************
SET CMPPREF = &SYSPREF
IF &STR(&CMPPREF) =    THEN PROFILE PREFIX(&SYSUID)

SET &CRSR = MEMBER
SET &INIT = NO
SET &RC   = OK

TOP: +
   ISPEXEC DISPLAY PANEL(cmp) CURSOR(&CRSR)                             00130001
   IF &LASTCC>7 THEN +
      GOTO EXIT

   SET &USER1DS=&STR('&USER1(&MEMBER)')
   SET &USER2DS=&STR('&USER2(&MEMBER)')
   SET &BASEDS=&STR('&BASE(&MEMBER)')

   IF &INIT = NO THEN GOTO INITIAL

/*******************************************************
/* COMPARE  USERDS1 WITH BASE                          *
/*******************************************************
POSTINI: +
   ISPEXEC CONTROL DISPLAY LOCK
   SET CMPLMSG=&STR( *** Comparing &user1ds to &baseds ***)
   ISPEXEC DISPLAY MSG(CMPC000M)
   FREE DD(SYSUT1 SYSUT2 SYSUT3 SYSIN SYSPRINT SYSOUT)
   SET &cRSR=BASE

   SYSCALL OPEN &SYSODS &sysout_dd &DISPMOD RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER
   OPENFILE &SYSOUT_DD OUTPUT
   SET &SYSOUT = &STR( ***)
   PUTFILE SYSOUT
   SET &SYSOUT = &STR( *** &CMPLMSG)
   PUTFILE SYSOUT
   SET &SYSOUT = &STR( ***)
   PUTFILE SYSOUT
   CLOSFILE SYSOUT

   SYSCALL OPEN &SYSPRT &sysprint_dd &DISPMOD RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER
   OPENFILE &SYSPRINT_DD OUTPUT
   SET &SYSPRINT = &STR( ***)
   PUTFILE SYSPRINT
   SET &SYSPRINT = &STR( *** &CMPLMSG)
   PUTFILE SYSPRINT
   SET &SYSPRINT = &STR( ***)
   PUTFILE SYSPRINT
   CLOSFILE SYSPRINT

   ALLOC DSN(&DELTA1) DD(&SYSUT3) SHR
   IF &LASTCC > 7 THEN +
      DO
         SET &RC = &STR(*** Unable to allocate &DELTA1 ***)
         GOTO ALLOCER
      END

   SYSCALL OPEN &BASEDS &SYSUT1 &DISPSHR RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER

   SYSCALL OPEN &CARDFILE &SYSIN &DISPSHR RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER

   SET &CRSR=USER1
   SYSCALL OPEN &USER1DS &SYSUT2 &DISPSHR RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER

   CALL 'SYS3.COMPAREX.PROD.LOADLIB(COMPAREX)' /******** COMPARE **/

   FREE DD(SYSUT1 SYSUT2 SYSUT3 SYSIN SYSPRINT SYSOUT)

/*******************************************************
/* COMPARE  USERDS2 WITH BASE                          *
/*******************************************************

   ISPEXEC CONTROL DISPLAY LOCK
   SET CMPLMSG=&STR( *** Comparing &user2ds to &baseds ***)
   ISPEXEC DISPLAY MSG(CMPC000M)
   FREE DD(SYSUT1 SYSUT2 SYSUT3 SYSIN SYSPRINT SYSOUT)
   SET &cRSR=BASE

   SYSCALL OPEN &SYSODS &sysout_dd &DISPMOD RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER
   OPENFILE &SYSOUT_DD OUTPUT
   SET &SYSOUT = &STR( ***)
   PUTFILE SYSOUT
   SET &SYSOUT = &STR(&CMPLMSG)
   PUTFILE SYSOUT
   SET &SYSOUT = &STR( ***)
   PUTFILE SYSOUT
   CLOSFILE SYSOUT

   SYSCALL OPEN &SYSPRT &sysprint_dd &DISPMOD RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER
   OPENFILE &SYSPRINT_DD OUTPUT
   SET &SYSPRINT = &STR( ***)
   PUTFILE SYSPRINT
   SET &SYSPRINT = &STR(&CMPLMSG)
   PUTFILE SYSPRINT
   SET &SYSPRINT = &STR( ***)
   PUTFILE SYSPRINT
   CLOSFILE SYSPRINT

   ALLOC DSN(&DELTA2) DD(&SYSUT3) SHR
   IF &LASTCC > 7 THEN +
      DO
         SET &RC = &STR(*** Unable to allocate &DELTA2 ***)
         GOTO ALLOCER
      END

   SYSCALL OPEN &BASEDS &SYSUT1 &DISPSHR RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER

   SYSCALL OPEN &CARDFILE &SYSIN &DISPSHR RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER

   SET &CRSR=USER2
   SYSCALL OPEN &USER2DS &SYSUT2 &DISPSHR RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER

   CALL 'SYS3.COMPAREX.PROD.LOADLIB(COMPAREX)' /******** COMPARE **/

   FREE DD(SYSUT1 SYSUT2 SYSUT3 SYSIN SYSPRINT SYSOUT)

/*******************************************************
/* APPLY first  set of changes                         *
/*******************************************************

   ISPEXEC CONTROL DISPLAY LOCK
   SET CMPLMSG=&STR( *** Applying &user1ds updates to temp file ***)
   ISPEXEC DISPLAY MSG(CMPC000M)
   FREE DD(SYSUT1 SYSUT2 SYSUT3 SYSIN SYSPRINT SYSOUT)
   SET &CRSR=BASE

   SYSCALL OPEN &SYSODS &sysout_dd &DISPMOD RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER
   OPENFILE &SYSOUT_DD OUTPUT
   SET &SYSOUT = &STR( ***)
   PUTFILE SYSOUT
   SET &SYSOUT = &STR(&CMPLMSG)
   PUTFILE SYSOUT
   SET &SYSOUT = &STR( ***)
   PUTFILE SYSOUT
   CLOSFILE SYSOUT

   SYSCALL OPEN &SYSPRT_UP &SYSPRINT_DD &DISPMOD RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER

   SYSCALL OPEN &DELTA1 &SYSIN &DISPSHR RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER

   SYSCALL OPEN &BASEDS &SYSUT1 &DISPSHR RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER

   SYSCALL OPEN &UPDATEDS &SYSUT2 &DISPSHR RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER

   ISPEXEC SELECT PGM(IEBUPDTE) PARM(MOD)

   SET &LASTC = &LASTCC
   IF &LASTC  > 0 THEN +
      DO
         SET &CMPLMSG = &STR(Bad Return from IEBUPDTE (RC=&LASTC) #1)
         ISPEXEC SETMSG MSG(CMPC000M)
         ISPEXEC EDIT DATASET(&SYSPRT_UP)
         EXIT
      END

   FREE DD(SYSUT1 SYSUT2 SYSUT3 SYSIN SYSPRINT SYSOUT)

/*******************************************************
/* APPLY second set of changes                         *
/*******************************************************

   ISPEXEC CONTROL DISPLAY LOCK
   SET CMPLMSG=&STR( *** Applying &user2ds updates to temp file ***)
   ISPEXEC DISPLAY MSG(CMPC000M)
   FREE DD(SYSUT1 SYSUT2 SYSUT3 SYSIN SYSPRINT SYSOUT)
   SET &CRSR=BASE

   SYSCALL OPEN &SYSODS &sysout_dd &DISPMOD RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER
   OPENFILE &SYSOUT_DD OUTPUT
   SET &SYSOUT = &STR( ***)
   PUTFILE SYSOUT
   SET &SYSOUT = &STR(&CMPLMSG)
   PUTFILE SYSOUT
   SET &SYSOUT = &STR( ***)
   PUTFILE SYSOUT
   CLOSFILE SYSOUT

   SYSCALL OPEN &SYSPRT_UP &SYSPRINT_DD &DISPMOD RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER

   SYSCALL OPEN &DELTA2 &SYSIN &DISPSHR RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER

   SYSCALL OPEN &UPDATEDS &SYSUT1 &DISPSHR RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER

   SYSCALL OPEN &UPDATEDS &SYSUT2 &DISPSHR RC
   IF &STR(&RC) NE OK THEN GOTO ALLOCER

   ISPEXEC SELECT PGM(IEBUPDTE) PARM(MOD)

   SET &LASTC = &LASTCC
   IF &LASTC  > 0 THEN +
      DO
         SET &CMPLMSG = &STR(Bad Return from IEBUPDTE (RC=&LASTC) #2)
         ISPEXEC SETMSG MSG(CMPC000M)
         ISPEXEC EDIT DATASET(&SYSPRT_UP)
         EXIT
      END

   FREE DD(SYSUT1 SYSUT2 SYSUT3 SYSIN SYSPRINT SYSOUT)

   ISPEXEC EDIT DATASET(&UPDATEDS(&MEMBER)) MACRO(CMPUPDT)
   SET &LASTC=&LASTCC
   IF &LASTC > 0 THEN +
      SET &CMPLMSG = &STR(*** Unable to view &UPDATEDS ***)
   ELSE
      SET &CMPLMSG = &STR(*** Completed Processing ***)

   ISPEXEC SETMSG MSG(CMPC000M)
   SET &CRSR = MEMBER
   GOTO TOP

/*******************************
/* PROCESS AN ALLOCATION ERROR *
/*******************************
ALLOCER: +
   IF &STR(&RC)=OK THEN +
      ISPEXEC SETMSG MSG(CMPC000A)
   ELSE +
      DO
         SET &CMPLMSG=&STR(&RC)
         ISPEXEC SETMSG MSG(CMPC000B)
      END
   GOTO TOP

/*************************
/* SINGLE POINT OF EXIT  *
/*************************
EXIT: +
   IF &STR(&CMPPREF) =    THEN PROFILE NOPREFIX
   DELETE cmp1.*
   EXIT

/********************************************************
/* SUBROUTINES                                          *
/********************************************************

/*************************
/* OPEN A DATASET        *
/*************************
OPEN: PROC 3 DSN DD DISP RC
   SYSREF &RC

   SET RC=&SYSDSN(&DSN)
   IF &STR(&RC)=OK THEN +
      DO
         ALLOC DA(&DSN) FI(&DD) &DISP
         SET &LASTC=&LASTCC
         IF &LASTCC >7 THEN +
            SET RC=&STR(ERROR: Allocating &DSN DISP=&DISP (RC: &LASTC))
      END
   ELSE +
         SET &RC = &STR(&RC: &DSN DISP=&DISP)
   END

/*************************
/* create card file      *
/*************************
BLDCARD: PROC 1 DSN

   ALLOC DD(CARDS) DSN(&DSN) +
                    NEW CATALOG +
                    UNIT(SYSDA) VOLUME(WRK$$$) +
                    SPACE(5 1) CYLINDERS RELEASE +
                    RECFM(F B) LRECL(80) BLKSIZE(23440)
   IF &LASTCC>7 THEN +
      DO
        SET RC='Unable to open ' &DSN ' for output rc:' &lastcc
        GOTO ALLOCER
      END
   ELSE +
      DO
         OPENFILE CARDS OUTPUT
         SET &CARDS=&STR(TEXT=$COBOL)
         PUTFILE CARDS
         SET &CARDS=&STR(COPYDIFF=(IEBUPDTE,SEQFLD=016))
         PUTFILE CARDS
         SET &CARDS=&STR(MASK=(1,8))
         PUTFILE CARDS
         SET &CARDS=&STR(MAXDIFF=1000)
         PUTFILE CARDS
         SET &CARDS=CONTINUE
         PUTFILE CARDS
         CLOSFILE CARDS
         FREE DD(CARDS)
      END
   END

/*************************
/* OPEN NEW DATASET      *
/*************************
OPENNEW: PROC 4 DSN DD DISP DCB RC
   SYSREF &DISP &DCB &RC

   ALLOC DD(&DD) DSN(&DSN) +
                    &DISP +
                    UNIT(SYSDA) VOLUME(WRK$$$) +
                    SPACE(5 1) CYLINDERS RELEASE +
                    &DCB
   SET &LASTC = &LASTCC
   IF &LASTC>7 THEN +
        SET RC=&STR(ERROR: Allocating &dsn DISP=&DISP (RC: &LASTC))
   END

/*************************
/* INITIALIZE ENVIRONMENT*
/*************************
INITIAL: +
   ISPEXEC CONTROL DISPLAY LOCK
   SET CMPLMSG=&STR( *** Allocating Temporary Datasets ***)
   ISPEXEC DISPLAY MSG(CMPC000M)

   SET &SYSIN    = SYSIN
   SET &SYSUT1   = SYSUT1
   SET &SYSUT2   = SYSUT2
   SET &SYSUT3   = SYSUT3
   SET &SYSOUT   = SYSOUT
   SET &SYSPRINT = SYSPRINT
   SET &sysout_dd = SYSOUT
   SET &sysprint_dd = SYSPRINT
   SET &SYSODS   = cmp1.SYSOUT
   SET &SYSPRT   = cmp1.SYSPRT
   SET &SYSPRT_UP= cmp1.IEBUPPRT
   SET &CARDFILE = cmp1.SYSIN
   SET &DCBFBA   = RECFM(F B A) LRECL(121) BLKSIZE(12100)
   SET &DCBVB    = RECFM(V B ) LRECL(240) BLKSIZE(23440)
   SET &DCBF80   = RECFM(F B) LRECL(80) BLKSIZE(23440)
   SET &DISPMOD  = MOD
   SET &DISPNEW  = NEW CATALOG
   SET &DISPSHR  = SHR
   SET &UPDATEDS = cmp.UPDATED
   SET &DELTA1   = &UPDATEDS(DELTA1)
   SET &DELTA2   = &UPDATEDS(DELTA2)
   SET &INIT     = YES
                                                                           00120
   FREE DD(SYSUT1 SYSUT2 SYSUT3 SYSIN SYSPRINT SYSOUT)
   DELETE cmp1.*
   SYSCALL BLDCARD &CARDFILE
   SYSCALL OPENNEW &SYSODS &SYSOUT_DD DISPNEW DCBFBA RC
     OPENFILE SYSOUT OUTPUT
     SET &SYSOUT=&STR(cmp &ZTIME &ZDATE)
     PUTFILE SYSOUT
     CLOSFILE SYSOUT

   SYSCALL OPENNEW &SYSPRT &sysprint_dd DISPNEW DCBVB RC
     OPENFILE SYSPRINT OUTPUT
     SET &SYSPRINT=&STR(cmp &ZTIME &ZDATE)
     PUTFILE SYSPRINT
     CLOSFILE SYSPRINT

   FREE DD(&SYSPRINT_DD)
   SYSCALL OPENNEW &SYSPRT_UP &SYSPRINT_DD DISPNEW DCBFBA RC
     OPENFILE SYSPRINT OUTPUT
     SET &SYSPRINT=&STR(cmp &ZTIME &ZDATE)
     PUTFILE SYSPRINT
     CLOSFILE SYSPRINT

   IF &SYSDSN(&UPDATEDS) NE OK THEN +
      ALLOC DD(TMP) DSN(&UPDATEDS) +
                    NEW CATALOG +
                    DSORG(PO) +
                    UNIT(SYSDA) VOLUME(WRK$$$) +
                    SPACE(5 1) CYLINDERS RELEASE +
                    DIR(5) +
                    RECFM(F B) LRECL(80) BLKSIZE(23440)

   FREE DD(TMP)
   GOTO POSTINI                  /* return to top of code */

/**********************************************************************
/* DISPLAY ANY "HELP" WHICH IS AVAILABLE FOR THIS UTILITY             *
/**********************************************************************
HELPSEC: +
ISPEXEC SELECT PGM(ISPTUTOR) PARM(HELPSHEL)
SET ZEDLMSG = &STR(*** HELP DISPLAYED FOR CMP UTILITY +
                   *** NO PROCESSING PERFORMED ***)
ISPEXEC SETMSG MSG(UTLZ000)
EXIT
            


Documentation


 CMP COMPARES TWO VERSIONS OF A PROGRAM AND CREATES A MERGED VERSION OF THESE
 PROGRAMS.  IN ORDER TO ACCOMPLISH THIS, A COMMON BASE VERSION MUST EXIST.  AN
 EXAMPLE IS P@USER1 AND P@USER2 MADE CHANGES TO PROGRAM COBOL1.  THE COMMON BASE
 VERSION OF COBOL1 IS STORED IN SLSS.PRD.COBOL2(COBOL1).  EACH USER HAS THEIR
 VERSION STORED IN P@USER?.SLSS.COBOL(COBOL1).  CMP WILL COMPARE EACH P@USER1
 AND P@USER2 VERSIONS TO SLSS.PRD AND CREATE A MERGED VERSION IN A DATASET
 CALLED P [at] USER1 [dot] CMP [dot] UPDATED(COBOL1).  IF YOU HAVE ANY PROBLEMS WITH THIS FEEL
 FREE TO STOP BY AND ASK QUESTIONS. JIM X352
            


Leave a Reply

Your email address will not be published. Required fields are marked *