OPS/MVS

Expand all | Collapse all

How to compare the RULESET of one system against another!

  • 1.  How to compare the RULESET of one system against another!

    Posted 07-09-2016 06:27 AM

    Using the "ADDRESS AOF LIST..." command I came up with a nice little compare utility to compare the contents of all the rulesets of one system against the rulesets of another (this is with CESAR MOLINA's help).  The result is a quick little report showing the differences in the active flag/autoenable flag/size of rules that match and reporting on those that don't match (non-matching rules).  It is not destructive and can be run any number of times without concern.

    Hopefully you will find this helpful...

    /*- ##AOFLIS ---------------------------------------------------------*/
    /*                                                                    */
    /* 2016-07-05: This REXX scans through the entire ruleset and compares*/
    /* it to the ruleset from another system (the baseline system that    */
    /* you are trying to promote from).                                   */
    /*                                                                    */
    /* Usage notes:                                                       */
    /*    -- CASE 1: On the baseline (aka 'promote from') system   ---    */
    /*    If this REXX is run on the baseline system, the intention       */
    /*    is to create the 'baselinedsn' dataset with the content         */
    /*    of the rules found here.  The 'baselinedsn' can then be         */
    /*    copied to the 'promote to' system.                              */
    /*    Example:  OI PROG(##AOFLIS) ARG("CREATEBASELINE")               */
    /*                                                                    */
    /*    -- CASE 2: Using ##AOFLIS to compare the baseline with -----    */
    /*    --         the rules of this system (aka 'promote to') -----    */
    /*    Once the baseline dataset (see CASE 1) is copied from the       */
    /*    'promote from' to this system ('promote to'), the baseline      */
    /*    is compared to the Ops/MVS rules found on this system.          */
    /*    The differences in the active/autoenable/size are noted         */
    /*    (as well as non-matching rules).                                */
    /*    Example:  OI ##AOFLIS                                           */
    /*                                                                    */
    /* Example of output:                                                 */
    /*   in.pcprod & in.pcdev: CMD       AXC0003I  E   Y   CMD 19         */
    /*   in.pcprod & in.pcdev: CMD       CUTOVER   D   N   *** 164        */
    /*   in.pcprod & in.pcdev: MSG       ABINS000  E   Y   MSG 37         */
    /*       Active flags differ: E/D                                     */
    /*       Autoenable flags differ: Y/N                                 */
    /*   in.pcprod & in.pcdev: MSG       ABINS105  D   N   *** 35         */
    /*   in.pcprod & in.pcdev: MSG       CTM282I   E   Y   MSG 33         */
    /*       Size differs: 33/50                                          */
    /*   in.pcprod Only:       MSG       IAT1016   E   Y   MSG 26         */
    /*   in.pcprod & in.pcdev: MSG       IAT1017   E   Y   MSG 27         */
    /*   in.pcprod & in.pcdev: MSG       IST020I   E   Y   MSG 33         */
    /*       Size differs: 33/34                                          */
    /*   in.pcdev Only:        MSG       IST093I   E   Y   MSG 44         */
    /*   in.pcdev Only:        MSG       IST105I   E   Y   MSG 42         */
    /*   in.pcprod & in.pcdev: MSG       ITA0700H  E   Y   MSG 3          */
    /*   ...                                                              */
    /*                                                                    */
    /*--------------------------------------------------------------------*/

    outputdsn   = "'CALL108.##OPSMVS.##AOFLIS.SYY'"
    baselinedsn = "'CALL108.##OPSMVS.##AOFLIS.SYZ'"

    parse upper arg inarg
    createbaselinedsn = 0
    do while(inarg \= "")
       parse var inarg nextarg inarg
       select
          when abbrev(nextarg, "CREATE") then do /* Check for CREATEBASEL*/
             createbaselinedsn = 1
          end
          otherwise nop
       end
    end
    if \createbaselinedsn then do
       "alloc file(a) da("baselinedsn") shr reuse"
       retncd = RC
       "free  file(a)"
       if retncd = 12 then do
          pull response
          Say "##AOFLIS: "response
          Say "##AOFLIS: The baseline dataset "baselinedsn
          Say "          does not exist.  If you want to create the "
          Say "          baseline dataset, rerun this REXX with:"
          Say "            OI PROG(##AOFLIS) ARG(""CREATEBASELINE"")"
          return 4
       end
       else if retncd = 0 then do
          Say "##AOFLIS: The baseline dataset "baselinedsn
          Say "          exists... The Ops/MVS rules on this system"
          Say "          will be compared against the baseline."
       end
       else do
          pull response
          Say "##AOFLIS: "response
          Say "##AOFLIS: An unexpected return code of "retncd" was returned"
          Say "          from the ALLOCATE... please investigate."
       end
    end
    else do
          Say "##AOFLIS: The baseline dataset "baselinedsn
          Say "          will be created on this system."
    end

    /* Get the ruleset names ---------------------------------------------*/

    address aof "list =nostats"
    _i=0
    do while(queued() \= 0)
       pull line
       say "line=<"line">"
       _i = _i + 1
       ruleset._i = word(line,2)
       ruleset.0  = _i
    end

    /* Get the rules for each ruleset ------------------------------------*/

    _j = 0
    do _i = 1 to ruleset.0
       address aof "list "ruleset._i".*"
       do while(queued() \= 0)
          pull line
          parse var line . rulename rulestatus ruleauto . ruletype ,
                . . . . rulesize .
          _j = _j + 1
          lineout._j = left(ruleset._i,10),
                     ||left(rulename,10),
                     ||left(rulestatus,4),
                     ||left(ruleauto,4),
                     ||left(ruletype,4),
                     ||left(rulesize,4)
          lineout.0  = _j
       end
    end

    /* Create the BASELINE dataset and terminate here! -------------------*/

    if createbaselinedsn then do
       "delete "baselinedsn
       "alloc file(out)da("baselinedsn") ",
          "space(3 3) tra new catalog unit(3390) ",
          "lrecl(255) blksize(0) recfm(v b) dsorg(ps) reuse"
       "execio "lineout.0" DISKW out (finis stem lineout."
       "free file(out)"
       Say "##AOFLIS: The baseline dataset "baselinedsn
       Say "          was successfully created. Port this dataset"
       Say "          from this system to the 'promote to...' system"
       return 0 /*=== If we are to create the baseline dataset -> exit ===*/
    end

    /* Write the pertinent rules out -------------------------------------*/

    "delete "outputdsn
    "alloc file(out)da("outputdsn") ",
       "space(3 3) tra new catalog unit(3390) ",
       "lrecl(255) blksize(0) recfm(v b) dsorg(ps) reuse"
    "execio "lineout.0" DISKW out (finis stem lineout."
    "free file(out)"

    /* Write the pertinent rules out -------------------------------------*/

    "alloc file(pcprod) da("outputdsn")   shr reuse"
    "alloc file(pcdev)  da("baselinedsn") shr reuse"
    "execio * DISKR pcprod (finis stem pcprod."
    "execio * DISKR pcdev  (finis stem pcdev. "
    "free file(pcprod, pcdev)"

    /* Compare the two rulesets -----------------------------------------*/

    pcprodidx = 0
    pcdevidx  = 0
    in.pcprod = 1
    in.pcdev  = 1
    highvalues = 'ffffffffffffffffff'x

    do while(1)
       select  /*  Check LAST STATUS of in. flags -----------------------*/
          when in.pcprod & in.pcdev then do
             pcprodidx = pcprodidx + 1
             pcdevidx  = pcdevidx  + 1
          end
          when in.pcprod            then
             pcprodidx = pcprodidx + 1
          when in.pcdev             then
             pcdevidx  = pcdevidx  + 1
       end
       if pcprodidx > pcprod.0 then
          pcprodkey = highvalues
       else
          pcprodkey = substr(pcprod.pcprodidx,1,20)
       if pcdevidx  > pcdev.0  then
          pcdevkey  = highvalues
       else
          pcdevkey  = substr(pcdev.pcdevidx,1,20)

       if pcprodkey = highvalues & pcdevkey = highvalues then leave

       in.pcprod = 0
       in.pcdev  = 0
       select
          when pcprodkey = pcdevkey then do
             in.pcprod = 1
             in.pcdev  = 1
          end
          when pcprodkey < pcdevkey then do
             in.pcprod = 1
          end
          when pcprodkey > pcdevkey then do
             in.pcdev  = 1
          end
          otherwise nop
       end
       select
          when in.pcprod & in.pcdev then do
             say left("in.pcprod & in.pcdev:",22)pcprod.pcprodidx
             parse var pcprod.pcprodidx . . ,
                   pcprodact pcprodae . pcprodsize .
             parse var pcdev.pcdevidx   . . ,
                   pcdevact  pcdevae  . pcdevsize  .
             if pcprodact  \= pcdevact  then do
                say "    Active flags differ: "pcprodact"/"pcdevact
             end
             if pcprodae   \= pcdevae   then do
                say "    Autoenable flags differ: "pcprodae"/"pcdevae
             end
             if pcprodsize \= pcdevsize then do
                say "    Size differs: "pcprodsize"/"pcdevsize
             end
          end
          when in.pcprod then
             say left("in.pcprod Only:",22)pcprod.pcprodidx
          when in.pcdev  then
             say left("in.pcdev Only:",22)pcdev.pcdevidx
       end
    end



  • 2.  Re: How to compare the RULESET of one system against another!

    Posted 07-11-2016 05:24 PM

    Many thanks for sharing your code Brian

    Regards, Cesar