Previous Topic

Next Topic

Book Contents

Book Index

Solution - Details

The rule consists of the following three ON blocks:

  1. From the Rule List screen, select rule ARWARN03 for browsing.

    If you are not familiar with how to select a rule for browsing, review the instructions at the beginning of the discussion of rule ARWARN02 in Problem 2.

    Figure 70 Rule Definition Screen for Rule ARWARN03

            LIBRARY : CTB.PROD.RULES                               RULE : ARWARN03

    COMMAND ===>                                                    SCROLL===> CRSR

    +---------------------------------- BROWSE -----------------------------------+

    | OWNER   M66                      GROUP INTRAC                               |

    | UPDATED 03/04/99  -  15:30:05    BY M66                                     |

    | DESC    SUMMARIZE AND CHECK SALES COMMISSIONS                               |

    | OPTIONS                                                                     |

    | =========================================================================== |

    | EXECUTE INIT     UPON                                                   C   |

    | ON DATA                                                                     |

    | ALWAYS                                                                      |

    |   DO SET      = ERRORCOUNT=0                                            C   |

    |   DO SET      = BLANK=' '                                               C   |

    | =========================================================================== |

    | EXECUTE INPUT    UPON                                                   C   |

    | ON SYSOUT     PROCST          PGMST STEP01   DDNAME SYSUT2   JOBNM          |

    |    MODE PG    LINECT 0000    DATASTAMP                                      |

    | WHEN LINE 001     - 060     COL 050     - 060              STOP    AND/OR   |

    |      STRING = /                                                             |

    |   DO EXTRACT  = SUM1                                                        |

    |                 LEVEL 0 LINE +000 COL 0068 - 0078 PROCESS          TYP SU   |

    | WHEN LINE 001     - 060     COL 001     - 020              STOP    AND/OR   |

    |      STRING = TOTAL SALES                                                   |

    PLEASE FILL IN RULE DEFINITION.                                        15.14.40

  2. Place the cursor on the line beginning with the string "EXECUTE INPUT," and press PF08/PF20, or execute the DOWN command. The first line of the ON block INPUT is now displayed at the top of the screen.

    Figure 71 ON Block INPUT

            LIBRARY : CTB.PROD.RULES                                RULE : ARWARN03

    COMMAND ===>                                                    SCROLL===> CRSR

    +---------------------------------- BROWSE -----------------------------------+

    | EXECUTE INPUT    UPON                                                   C   |

    | ON SYSOUT     PROCST          PGMST STEP01   DDNAME SYSUT2   JOBNM          |

    |    MODE PG    LINECT 0000    DATASTAMP                                      |

    | WHEN LINE 001     - 060     COL 050     - 060              STOP    AND/OR   |

    |      STRING = /                                                             |

    |   DO EXTRACT  = SUM1                                                        |

    |                 LEVEL 0 LINE +000 COL 0068 - 0078 PROCESS          TYP SU   |

    | WHEN LINE 001     - 060     COL 001     - 020              STOP    AND/OR   |

    |      STRING = TOTAL SALES                                                   |

    |   DO EXTRACT  = SUM2                                                        |

    |                 LEVEL 0 LINE +000 COL 0068 - 0078 PROCESS          TYP SU   |

    | =========================================================================== |

    | EXECUTE FINISH   UPON                                                   C   |

    | ON DATA                                                                     |

    | ALWAYS                                                                      |

    |   DO PRINT    = ****** COMMISSION CONTROL TOTALS *******            F   C   |

    |   DO PRINT    = REPORTED SALES                 %%SUM2               F   C   |

    |   DO PRINT    = CALCULATED SALES               %%SUM1               F   C   |

    |   DO PRINT    = -----------------------------------------           F   C   |

    |   DO SET      = DIFFERENCE1=SUM2-SUM1                                   C   |

    PLEASE FILL IN RULE DEFINITION.                                        15.17.24

    The ON block INPUT performs the following actions:

    Parameter TYP for this WHEN definition is set to SU. This indicates that the rule should accumulate a sum or average of the information being extracted. In the rule, the sum of each of the report line amounts is to be placed in their respective variables, SUM1 and SUM2. This means that after the entire report is processed, SUM1 will contain the grand total of invoice amounts from all report lines with a "/" in columns 50 through 60. SUM2 will contain the grand total of all report line amounts from the TOTAL SALES lines.

    After the report file is processed, the next sequential ON block, called FINISH, is executed.

  3. Place the cursor on the line beginning with the string, EXECUTE FINISH, and press PF08/PF20, or enter the DOWN command.

    Figure 72 ON Block EXECUTE FINISH

            LIBRARY : CTB.PROD.RULES                                RULE : ARWARN03

    COMMAND ===>                                                    SCROLL===> CRSR

    +---------------------------------- BROWSE -----------------------------------+

    | EXECUTE FINISH   UPON                                                   C   |

    | ON DATA                                                                     |

    | ALWAYS                                                                      |

    |   DO PRINT    = ****** COMMISSION CONTROL TOTALS *******            F   C   |

    |   DO PRINT    = REPORTED SALES                 %%SUM2               F   C   |

    |   DO PRINT    = CALCULATED SALES               %%SUM1               F   C   |

    |   DO PRINT    = -----------------------------------------           F   C   |

    |   DO SET      = DIFFERENCE1=SUM2-SUM1                                   C   |

    |   DO PRINT    = DIFFERENCE                         %%DIFFERENCE1    F   C   |

    |   DO PRINT    = %%BLANK                                             F   C   |

    |   DO PRINT    = %%BLANK                                             F   C   |

    | IF       DIFFERENCE1>1000                                               C   |

    |   DO PRINT    = ***** SERIOUS COMMISSION ERROR - SEE ABOVE *****    F   C   |

    |   DO TERMINAT = NOTOK    COD 0999                                           |

    | ELSE                                                                        |

    |   DO PRINT    = COMMISSIONS OK                                      F   C   |

    |   DO TERMINAT = OK       COD 0000                                           |

    | =========================================================================== |

    | EXECUTE          UPON                                                   C   |

    | ON                                                                          |

    PLEASE FILL IN RULE DEFINITION.                                        15.18.49

    The ON block FINISH performs the following actions:

    This concludes the definition for Rule ARAWARN03.

Look at the SYSUSER report that this rule produced. You may use the job RUNRULE3 provided in the CTB JCL library to run this rule. You may then review the results online, using SDSF, ROSCOE, or a similar facility.

Figure 73 SYSUSER Report from RUNRULE3

The rule has examined the entire report, line by line, accumulated totals, and found that the details match 100% with the reported totals.

Parent Topic

Problem 3: Check Sales Commissions