Example Problems and Solutions
This chapter includes the following topics:
Overview
This chapter presents a set of control and balancing problems and their solutions using the example company INTRAC, which you were introduced to in the tutorial in Chapter 1. The problems are divided into Basic and Advanced. A summary of the Control-M/Analyzer capabilities described in these example problems and solutions appears at the end of the chapter.
While each problem and solution may be examined individually, the INTRAC case study builds on the knowledge that you gain in working through each problem in the sequence provided. This is particularly true if you are a new Control-M/Analyzer user.
The Example Company, INTRAC
INTRAC is a public company in the transportation industry. INTRAC has three major product divisions. Division 1 provides short term courier services for small and medium sized packages, with delivery worldwide. Division 2 handles containers and other large commercial shipments, which are usually delivered within a one to three month time frame. Division 3 provides a variety of transportation-related services, such as freight forwarding, insurance, and so on.
Until a few years ago, all production applications were run on the company's mainframe computer at Headquarters (HQ). Five years ago, the Central Information Systems Division (ISD) began distributing selected applications to various PC networks at the divisions.
Major applications and financial databases continue to run on the mainframe computer, for several reasons:
- Complexity of the corporate applications
- Implications of tight financial control required of a public company
- Tighter security on the mainframe than on networks
- Client desire for discounts and accounting statements based on their total business with INTRAC
Clients view INTRAC as a single organization, through an integrated sales force that sells INTRAC's total services.
This simple concept has made information management at INTRAC more complex. Accordingly, INTRAC HQ must:
- Get transactions that are entered on divisional computers and are handled by many different people, and consolidate the information at HQ
- Thoroughly check the transactions
- Convince executive, management, and sales personnel that each has all the necessary and correct information on which to base reports and sales commissions
Each day the divisions transmit details of their daily sales results to HQ. On a daily basis, HQ updates their accounting system files. At scheduled times during the month, HQ generates daily, weekly and monthly reports. These reports are sent to dozens of locations.
At month-end, after processing all adjustments, consolidated client statements are issued, and sales commissions are calculated. A file containing the commission amount to be paid to each salesperson is sent from the sales operations department to the HQ payroll department. Additional reports are generated and sent to executives and management personnel, and to every salesperson. Figure 41 illustrates INTRAC’s work flow.
Figure 41 INTRAC Work Flow
INTRAC's Problems—General
Several times each month, there are qualitative and timeliness problems with the data sent from the divisions. Problems may be caused by transmission errors, inexperienced staff at the divisions, application programming errors, tampering with the data, missed schedules, or a host of other reasons.
As a result, management receives misleading or late reports.
Also, sales commissions are often in error, because they are based on incorrect invoice or accounts receivable information.
This has resulted in management not trusting the reports and not taking the action that they should be taking as a result of the information received. Also, sales employee morale is suffering because sometimes there are serious sales commission errors. Occasionally, the executives have gone through internal reviews and meetings with their bank, using inaccurate information.
Each new application that is distributed to the PC Network has resulted in additional staff being added at HQ for monitoring and control of the application. HQ staff levels are now frozen and management wants tighter controls and procedures to be implemented immediately.
ISD programming staff have a two year backlog of work. As a result, the ISD management cannot free up programmers to write more control programs for at least six months. Because of recent turnover, operations staff are working longer shifts, with more junior operators. This has made the production environment more error-prone.
Using this historical basis, you will work with the INTRAC information to simplify and improve operations.
Sources of Data—Reports and Files
INTRAC’s sources of data includes the following two items:
- Daily Invoice file
- Sales Commission Detail report
Daily Invoice File
Each day, each division transmits the Daily Invoice file to an HQ PC. The file is sent with an accompanying control total record. At the end of each day, the three divisional files are consolidated into a single file on the PC and uploaded to the mainframe for processing. The file format is as follows:
Table 4 File Format for Daily Invoice File
Position |
Description |
Control/Balancing Criteria |
---|---|---|
1- 2 |
Division # |
Must be '01', '02', '03' |
3-30 |
Customer Name, or 'Total Invoices' for division total records |
|
31-38 |
Customer # |
|
39-45 |
Invoice # |
|
46-51 |
Invoice Date |
Must be Current Month & Year |
52-61 |
Amount Invoiced |
Division 1 > $400,000, NOT-OK > $200,000, Tolerance Warn <= $200,000 OK Division 2 or Division 3 > $200,000, NOT-OK > $100,000, Tolerance Warn <= $100,000 OK |
62-71 |
Cost of Goods Sold |
|
72-81 |
Special Charges |
|
In the list of control and balancing criteria, "Tolerance Warn" means that the invoice data is probably OK, but the amount is out of the ordinary. The user wants to see amounts such as these included as part of a report, and wants them marked "Warning," to alert them for further checking. Such items will not hold up production processing.
The division total records have the same format and are also found in the Daily Invoice file, following each division's detail invoice information. The division total records contain "Total Invoices" in the customer name field and the total amounts invoiced for each "Amount Invoiced," "Cost of Goods Sold," and "Special Charges" in columns 52-61, 62-71, and 71-81, respectively. These divisional totals must equal the sum of the detail records for that division.
Sales Commission Detail Report
Figure 42 shows a sample page from another source of data for the balancing rules—the Sales Commissions Detail report. This report is prepared monthly by the sales operations department. The report contains a list of all the invoices for which sales commissions are calculated for a given month.
At the end of each list of invoices for a given salesperson is a summary of calculated information, along with other information. The final line shows the amount of commissions that salesperson is owed, according to the sales operations department.
The several rules that analyze the lines on this report are illustrated in Basic Problems and Solutions and Advanced Problems and Solutions.
Figure 42 Sales Commission Detail Report
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9---
INTRAC INC. SALES OPERATIONS DEPARTMENT DATE 10/10/01 TIME 23:45 PAGE 4
S A L E S C O M M I S S I O N S D E T A I L FROM 10/10/01 TO 10/10/01
|SALESPERSON MARYJANE INKSTERR(177) | INVOICE | INVOICE DATE | AMOUNT | STATUS
| | B7003003| 02/02/00 | 11800.00 | |
| | B7003420| 03/03/00 | 2700.00 | |
| | B7004009| 04/04/00 | 1500.00 | |
| | B7018700| 05/05/00 | 500.00 | |
+--------------------------------------------------------------------------------------------
| TOTAL SALES - THIS MONTH 16500.00 (PAID IN FULL}
| ADJUSTMENTS 0.00
| YTD SALES (INCLUDING THIS MONTH) 999879.00
| YTD COMMISSIONS PAID 0.00
| YTD COMMISSIONS OWED 39995.16
| COMMISSION PAYROLL AMOUNT 39995.16
|--------------------------------------------------------------------------------------------
Basic Problems and Solutions
This section discusses the following two problems and their solutions:
- Problem 1: The Daily Invoice File — Warning
- Problem 2: Check Payroll Totals
- Problem 3: Check Sales Commissions
Problem 1: The Daily Invoice File — Warning
In this problem, the Daily Invoice file arrives too late to check or correct errors.
To provide management with accurate and timely reports, the ISD staff needs time to run the reports and check with divisional users to identify and correct any error conditions. Often, the operations staff attempts to run the invoice processing job during the early afternoon, only to find that the job fails to run because one of the files was not sent from a division, or was received in error.
The operations staff often gets involved in other situations and then forgets, or doesn't have time to follow up on, this problem until it is too late to make that day's schedule.
ISD management becomes aware that there is a problem when the executives and divisional managers phone to complain that they haven't received their reports, or that their reports are in error.
Solution 1 — Overview
The consolidated daily invoice file must be available for processing on the mainframe by noon of each day. If it is not available, management must be informed automatically.
ISD has decided that if this problem continues, notice thereof must be escalated throughout the afternoon to make higher levels of management aware of the situation.
Solution — Details
A Control-M/Analyzer rule is invoked hourly, starting at noon. Control-M or another automated job scheduler will invoke the rule hourly, as long as the data has not arrived. The rule called ARWARN01 is run to notify various levels of users and management by sending a message to their TSO user IDs.
If the computer system time is between 12-1 P.M., a message is shouted to the operations manager on his or her user ID.
If the computer system time is between 1-3 P.M. and the condition still exists, the manager of ISD is informed. If the system time is 3 P.M. or later, with the same problem, the ISD vice president is informed.
Creating the ARWARNO1 Rule
-
From the IOA Primary Option Menu, enter the Rule Definition facility by typing BR in the COMMAND field and pressing Enter. The Rule Definition entry panel is displayed:
Figure 43 Control-M/Analyzer Rule Definition Entry Panel
Copy--------------- CONTROL-M/Analyzer RULE DEFINITION - ENTRY PANEL ------------(BR)
COMMAND ===>
SPECIFY LIBRARY, RULE
LIBRARY ===> CTB.PROD.RULES
RULE ===> xxxxxxxx (Blank for rule selection list)
USE THE COMMAND "SHPF" TO SEE PFK ASSIGNMENT 13.41.48 - If the library name in the LIBRARY field in this example is different from your Control-M/Analyzer RULES library name, change it to the one shown in this example.
- Enter a rule name using up to eight characters to provide a unique name to the rule. For example, this might be your own last name, user ID, or a name provided to you by your system administrator.
- Press Enter. A window is displayed for defining the new rule parameters.
- Begin entering the definition for the new rule by filling in the descriptive information for the following fields:
- Before you enter the other rule definition parameters, first examine the basic rule structure. A rule generally performs four types of operations:
- performs one-time actions, such as printing report headings or setting values of variables to be used later in the rule
-
specifies data sources to search for and data items to be validated, either
- from outside Control-M/Analyzer (for example, file, report), or
- from inside Control-M/Analyzer (for example, Control-M/Analyzer database)
-
Analyzes or balances the data
-
Takes action for out-of-balance and in-balance situations
-
These operations are usually performed in separate groupings of specifications called ON blocks. Every rule is made up of a series of one or more ON blocks. A simple rule may have just one ON block. A complex rule may have many ON blocks, as shown in Figure45.
Figure 45 Typical Rule Structure
Figure 44 New Rule Definition Screen
CTB303E FILL IN THE REQUIRED FIELD RULE :
COMMAND ===> SCROLL===> CRSR
+-----------------------------------------------------------------------------+
| OWNER GROUP |
| UPDATED 13/12/00 - 13:43:34 BY M86 |
| DESC |
| OPTIONS |
| =========================================================================== |
| EXECUTE UPON C |
| ON |
======= >>>>>>>>>>>>>>> END OF RULE DEFINITION PARAMETERS <<<<<<<<<<<<<<< =====
PLEASE FILL IN RULE DEFINITION. 13.43.34
Table 5 Fields to Define a New Rule
In field |
Enter the following |
---|---|
OWNER |
Fill in your user ID |
GROUP |
INTRAC |
DESC |
SHOUT TO USERS IF DIVISIONAL AR DATA NOT IN |
This first rule is very simple. The only data item with which you need concern yourself is available to you within Control-M/Analyzer—the computer system time. All you need to do is check the time and issue various warnings to various users, based on how late in the day it is.
Usually, two types of ON blocks are required in a rule—Input blocks, to extract data from a file or report, and ON DATA blocks, to perform comparisons and balancing actions on the extracted data. In this rule, you will use only an ON DATA block, as illustrated in Figure 46.
You can enter and update rules using a standard system editor if you are familiar with Control-M/Analyzer rule syntax. Because you are a beginning user, continue using this "fill-in-the-blanks" approach to specify and verify the rule parameters.
Figure 46 ON DATA Block Structure
When you work with Control-M/Analyzer variables, instead of external data such as reports or files, the ON block is structured as shown in Figure 46. In that ON block structure
-
the balancing instructions begin with an EXECUTE statement
All ON DATA blocks begin with an EXECUTE statement.
-
the first LABEL is defined with an ALWAYS statement, indicating that the DO actions that follow it will always be performed on the data
-
the second LABEL is defined with an IF statement, indicating that the DO actions that follow it are performed if certain criteria are met, otherwise, the DO actions following the ELSE statement are performed
This gives you the capability of taking different balancing actions on the data, depending on your needs.
Creating an ON block
You will now define the first, and only, ON block for this rule.
-
Place the cursor in the EXECUTE field.
-
Type CHECK. This name is descriptive of the ON block’s function.
-
The name of an ON block may be any eight characters, and is unique within the rule.
-
-
Place the cursor in the ON field.
-
Type DATA and press Enter.
-
The value, DATA, indicates that this is an ONDATA block type. The ONDATA block indicates that the rule is operating on data, not on reports or other external sources of information.
-
Control-M/Analyzer now creates a blank field and prompts you to specify either ALWAYS or IF as the value.
Figure 47 Setting the ON Block Type
CopyCTB303E FILL IN THE REQUIRED FIELD RULE :
COMMAND ===> SCROLL===> CRSR
+-----------------------------------------------------------------------------+
| OWNER M86 GROUP INTRAC |
| UPDATED 13/12/00 - 13:43:34 BY M86 |
| DESC SHOUT TO USERS IF DIVISIONAL AR DATA NOT IN |
| OPTIONS |
| =========================================================================== |
| EXECUTE CHECK UPON C |
| ON DATA |
| IF (ENTER "ALWAYS", "IF") |
======= >>>>>>>>>>>>>>> END OF RULE DEFINITION PARAMETERS <<<<<<<<<<<<<<< =====
PLEASE FILL IN RULE DEFINITION. 13.50.56
-
-
Type IF and press Enter.
-
Defining the ON DATA Block
-
You will now define the ONDATA block to do the following:
Figure 48 Flow of the ON DATA Block to Create
As illustrated in Figure 48, in the first IF condition you’ve just entered you will define the ON block to check for a time range between 12 and 1 P.M., and then perform the action "Warn Operations Manager!!"
To check the time, you need to access the computer system time with a system variable called SYSTIME. It has the format hhmmss, meaning a 6-digit number containing hours (hh), minutes (mm), and seconds (ss). The system clock is a 24-hour clock. This means that 1 o'clock in the afternoon, for example, appears as 130000 when read by the SYSTIME variable.
For more information on Control-M/Analyzer system variables, refer to the Control-M/Analyzer for z/OS User Guide.
With this information, you can now write the first IF condition.
-
-
To the right of the word IF, type %%SYSTIME >= 120000 AND %%SYSTIME < 130000. This means, "Is the time between 12P.M. and 1P.M.?"
-
Press Enter.
Figure 49 Definition of the First IF Condition
CopyLIBRARY : CTB.PROD.RULES RULE :
COMMAND ===> SCROLL===> CRSR
+-----------------------------------------------------------------------------+
| OWNER M86 GROUP INTRAC |
| UPDATED 13/12/00 - 13:43:34 BY M86 |
| DESC SHOUT TO USERS IF DIVISIONAL AR DATA NOT IN |
| OPTIONS |
| =========================================================================== |
| EXECUTE CHECK UPON C |
| ON DATA |
| LABEL: |
| IF %%SYSTIME >= 120000 AND %%SYSTIME < 13000 C |
| DO |
| (ENTER "ALWAYS" OR "IF") |
| =========================================================================== |
| EXECUTE UPON C |
| ON |
======= >>>>>>>>>>>>>>> END OF RULE DEFINITION PARAMETERS <<<<<<<<<<<<<<< =====
PLEASE FILL IN RULE DEFINITION. 13.53.51Notice the character "C" at the end of the line you just typed—this is the C (Continue) field. If you want to continue this same IF expression onto another line, you would enter a Y (for YES) in this field. An IF expression sometimes may be long and complex, requiring several lines.
-
Because you do not need another line for this very simple IF parameter, place the cursor in the DO field on the next line.
Defining the Actions to Perform
You will now instruct Control-M/Analyzer to do the following:
-
print the message
-
send a message to the operations manager
-
resolve a problem if it occurs
Printing the message will provide a hard copy record that the rule was executed, and also illustrates the output that Control-M/Analyzer produces to help you understand what happened during execution of the rule.
-
With the cursor in the DO field, type PRINT and press Enter. Control-M/Analyzer creates a field in which to enter your print information.
-
In the new field, type DIV. INVOICES NOT IN, PLEASE CHECK IMMEDIATELY and press Enter. Control-M/Analyzer creates an empty DO line below the line you’ve just completed.
Figure 50 Defining the DO Statements in an IF Condition
CopyLIBRARY : CTB.PROD.RULES RULE :
COMMAND ===> SCROLL===> CRSR
+-----------------------------------------------------------------------------+
| OWNER M86 GROUP INTRAC |
| UPDATED 13/12/00 - 13:43:34 BY M86 |
| DESC SHOUT TO USERS IF DIVISIONAL AR DATA NOT IN |
| OPTIONS |
| =========================================================================== |
| EXECUTE CHECK UPON C |
| ON DATA |
| LABEL: |
| IF %%SYSTIME >= 120000 AND %%SYSTIME < 13000 C |
| DO PRINT = DIV. INVOICES NOT IN, PLEASE CHECK IMMEDIATELY F C |
| DO PRINT = ******** ACTION REQUIRED WITHIN 30 MINUTES ******* F C |
| DO |
| (ENTER "ALWAYS", "IF" OR "ELSE") |
| =========================================================================== |
| EXECUTE UPON C |
| ON |
======= >>>>>>>>>>>>>>> END OF RULE DEFINITION PARAMETERS <<<<<<<<<<<<<<< =====
PLEASE FILL IN RULE DEFINITION. 13.55.47 -
In this new DO line, type PRINT and press Enter.
-
In the new field to the right of the equal sign (=), type:
Copy********* ACTION REQUIRED WITHIN 30 MINUTES *******
-
Press Enter.
-
You will now define the command to send ("shout") the same message to the operations manager. For the purposes of this demonstration, you will actually send the message to yourself instead of the operations manager.
-
-
Place the cursor in the new DO field, type SHOUT, and press Enter.
Figure 51 DO SHOUT Definition
CopyLIBRARY : CTB.PROD.RULES RULE :
COMMAND ===> SCROLL===> CRSR
+-----------------------------------------------------------------------------+
| OWNER M86 GROUP INTRAC |
| UPDATED 13/12/00 - 13:43:34 BY M86 |
| DESC SHOUT TO USERS IF DIVISIONAL AR DATA NOT IN |
| OPTIONS |
| =========================================================================== |
| EXECUTE CHECK UPON C |
| ON DATA |
| LABEL: |
| IF %%SYSTIME >= 120000 AND %%SYSTIME < 13000 C |
| DO PRINT = DIV. INVOICES NOT IN, PLEASE CHECK IMMEDIATELY F C |
| DO PRINT = ******** ACTION REQUIRED WITHIN 30 MINUTES ******* F C |
| DO SHOUT TO TSO-M86 URGENCY U |
| = DIV. INVOICES NOT IN, PLEASE CHECK IMMEDIATELY ************* |
| DO |
| (ENTER "ALWAYS", "IF" OR "ELSE") |
| =========================================================================== |
| EXECUTE UPON C |
| ON |
======= >>>>>>>>>>>>>>> END OF RULE DEFINITION PARAMETERS <<<<<<<<<<<<<<< =====
PLEASE FILL IN RULE DEFINITION. 14.16.07 -
In the field that is now displayed, type your user ID, as follows:
-
TSO-xxxxxxxx
-
where xxxxxxxx is your TSO user ID.
-
-
Tab to the field labeled URGENCY and enter the urgency Code U (URGENT).
-
In the field to the right of the equal sign (=) on the next line, enter the following message:
-
DIV. INVOICES NOT IN, PLEASE CHECK IMMEDIATELY **********
-
To demonstrate what happens when a problem occurs, you will end the execution of this part of the rule as if there was a problem. When the operations staff reviews the log, they will see that this rule ended NOTOK.
-
-
Position the cursor in the next DO field and type TERM.
-
Press Enter. A DO TERMINAT action is now created.
-
The DO TERMINAT definition contains two fields for you to specify: =, for aresult value, and COD, for a result code. In the following steps you will enter NOTOK as the result, and a sample code that informs the operations manager that this is the first warning. For the purposes of this demonstration, use the code 0009.
Figure 52 DO TERMINATE Definition
CopyLIBRARY : CTB.PROD.RULES RULE :
COMMAND ===> SCROLL===> CRSR
+-----------------------------------------------------------------------------+
| OWNER M86 GROUP INTRAC |
| UPDATED 13/12/00 - 13:43:34 BY M86 |
| DESC SHOUT TO USERS IF DIVISIONAL AR DATA NOT IN |
| OPTIONS |
| =========================================================================== |
| EXECUTE CHECK UPON C |
| ON DATA |
| LABEL: |
| IF %%SYSTIME >= 120000 AND %%SYSTIME < 13000 C |
| DO PRINT = DIV. INVOICES NOT IN, PLEASE CHECK IMMEDIATELY F C |
| DO PRINT = ******** ACTION REQUIRED WITHIN 30 MINUTES ******* F C |
| DO SHOUT TO TSO-M86 URGENCY U |
| = DIV. INVOICES NOT IN, PLEASE CHECK IMMEDIATELY ************* |
| DO TERMINAT = NOTOK COD 0009 |
| DO |
| (ENTER "ALWAYS", "IF" OR "ELSE") |
| =========================================================================== |
| EXECUTE UPON C |
| ON |
======= >>>>>>>>>>>>>>> END OF RULE DEFINITION PARAMETERS <<<<<<<<<<<<<<< =====
PLEASE FILL IN RULE DEFINITION. 14.20.27
-
-
Place the cursor to the right of the equal sign (=), and type NOTOK.
-
Place the cursor in the COD field and type 9.
-
Press Enter.
The value 9 you just entered in the COD field is displayed with leading zeros.
Completing the Rule
You will now finish defining this rule and then test it.
Because you are simulating real conditions, you will define the following two actions which you would change when you implement the rule in production mode:
-
Send all messages to yourself rather than to another user
-
Send yourself a message even when the system time is not critical, just to prove to yourself that the rule is working
-
Continue entering the rule, as defined in Figure53. Use the same procedure for entering IF statements that you used earlier by typing IF and then pressing Enter.
-
The word LABEL: is displayed after you enter the IF command
Press PF08/PF20 to scroll to the next screen when entering characters.
Figure 53 The Entire ARWARN01 Rule
CopyLIBRARY : CTB.PROD.RULES RULE :
COMMAND ===> SCROLL===> CRSR
+-----------------------------------------------------------------------------+
| OWNER M86 GROUP INTRAC |
| UPDATED 13/12/00 - 13:43:34 BY M86 |
| DESC SHOUT TO USERS IF DIVISIONAL AR DATA NOT IN |
| OPTIONS |
| =========================================================================== |
| EXECUTE CHECK UPON C |
| ON DATA |
| LABEL: |
| IF %%SYSTIME >= 120000 AND %%SYSTIME < 13000 C |
| DO PRINT = DIV. INVOICES NOT IN, PLEASE CHECK IMMEDIATELY F C |
| DO PRINT = ******** ACTION REQUIRED WITHIN 30 MINUTES ******* F C |
| DO SHOUT TO TSO-M86 URGENCY U |
| = DIV. INVOICES NOT IN, PLEASE CHECK IMMEDIATELY ************* |
| DO TERMINAT = NOTOK COD 0009 |
| DO |
| LABEL: |
| IF %%SYSTIME >=13000 AND %%SYSTIME <150000 C |
| DO PRINT = DIV. INVOICES STILL NOT IN, URGENTS!!! F C |
| DO PRINT = ****************** HELP NEEDED NOW **************** F C |
| DO SHOUT TO TSO-M86 URGENCY U |
| = DIV. INVOICES STILL NOT IN, URGENT ACTION REQUIRED ********* |
| DO TERMINAT = NOTOK COD 0099 |
| DO |
| LABEL: |
| IF %%SYSTIME >= 150000 AND %%SYSTIME <180000 C |
| DO PRINT = DIV. INVOICES NEVER ARRIVED, EXECUTIVES WILL SUFFER F C |
| DO PRINT = ***** WHAT WILL YOU DO ABOUT IT? ****************** F C |
| DO SHOUT TO TSO-M86 URGENCY V |
| = DIV. INVOICES NEVER ARRIVED, EXECUTIVES WILL SUFFER ******** |
| DO TERMINAT = NOTOK COD 0999 |
| DO |
| ELSE |
| DO PRINT = TIME IS NOT BETWEEN 12 P.M. AND 6 P.M. F C |
| DO PRINT = YOU'RE OK FOR NOW, BUT DO NOT RELAX F C |
| DO SHOUT TO TSO-M86 URGENCY R |
| = TIME IS NOT BETWEEN 12 P.M. AND 6 P.M. |
| DO TERMINAT = OK COD 0000 |
| DO |
| (ENTER "ALWAYS", "IF") |
| =========================================================================== |
| EXECUTE UPON C |
| ON |
PLEASE FILL IN RULE DEFINITION. 14.28.31
-
-
Since this is a new rule, press PF03/PF15 or enter the END command to exit rule definition and create the rule. A confirmation window is displayed.
-
Place the cursor in the CREATE field, typeY, and press Enter.
Testing the Rule
The rule you just defined would probably be invoked by an automated operations product. For example, a job scheduler, such as the INCONTROL product, Control-M, would check for the existence of the divisional file at predetermined times. If the file is not found, the rule is invoked to warn the user.
You will now simulate this situation by executing this rule and seeing if it does what you expect it to do.
In the IOA SAMPLE library there is a member named CTBRULE1. To execute the rule you just created, you need to edit CTBRULE1 and then submit a job. In order to do this, you need to know how to:
-
submit a job for execution
-
monitor the status of a job (using SDSF, ROSCOE, or a similar facility)
-
review the results on the screen
If you are not familiar with how to perform these functions, ask your system administrator for assistance.
-
Edit the CTBRULE1 member using ISPF, ROSCOE, and so on.
Figure 54 Editing the CTBRULE1 Member
CopyEDIT ---- IOA*.*.SAMPLE(CTBRULE1) - 01.05 ------------------- COLUMNS 001 072
COMMAND ===> SUBMIT SCROLL ===> HALF
***** **************************** TOP OF DATA *********************************
000001 //ARWARN01 JOB ,GERR,CLASS=A,MSGCLASS=X,NOTIFY=M66A,REGION=4096K
000002 //STEP01 EXEC CTBTROLB,RULE=ARWARN01,GROUP-INTRAC
000003 //
***** ************************** BOTTOM OF DATA ********************************STEP01 has been set to invoke Control-M/Analyzer, then execute rule ARWARN01 from within group INTRAC. At this time you may
-
copy this JCL, then change the rule name and submit the job to run your own rule, or
-
submit the above job and run the supplied rule
-
-
Submit the job.
-
As you continue working on your system and the Control-M/Analyzer rule executes, you may notice a message similar to the following displayed on your screen:
-
The exact text of the message depends on the time of day. If you do not receive a similar message on your screen, you may want to discuss this with your system administrator. However, you may continue this process even without receiving the message.
CopyCONTROL-B ********** CN (00)
CONTROL-B DIV. INVOICES NOT IN, PLEASE CHECK IMMEDIATELY *** 10.08 12:53 CN (00) -
-
Analyze the output for the report
-
The execution of the rule also creates several output files. There are three Control-M/Analyzer outputs that help you understand rule execution:
-
SYSUSER – a listing containing only what you programmed, using DO PRINT commands in the rule
-
SYSPRINT – a listing of the Control-M/Analyzer Invocation Report which summarizes the execution of the rule
-
SYSRULE – a listing of the rule
-
-
Why do you need a listing of the rule when it is executed? Anyone who is authorized to update the rule library may be able to change a rule definition at any time.
By having a listing of the rule at its execution, you know exactly how the rule was defined at that given time. You can save a great deal of guesswork when diagnosing a problem, by always having the correct documentation of a rule definition to work from.
If the rule executed correctly, the three outputs appear as follows
You may review the job results using a tool such as SDSF.
Figure 55 SYSUSER REPORT (Executed Outside Check Hours)
The report for rule ARWARN01 will vary, depending upon what time you execute the rule.
Figure 56 SYSPRINT — Invocation Report
CopyCONTROL-M/Anlayzer V6.1.00 - RUN TIME ENVIRONMENT
(C) BMC Software INC. 2001
Mission:
Rule : ARWARN01
Group : INTRAC
CTB10II - Compilation started
CTB110I - Compilation completed successfully
CTB111I - Highest Error Code was 0
CTB001I - CONTROL-M/ANALYZER RUNTIME ENVIRONMENT STARTED - MODE IS STAND-ALONE - SCOPE IS
UNSCHEDULED
CTB009I - GROUP-MODE IS "ACTIVE"
CTB00AI - INVOKED RULE-ARWARN01
*** CONTROL-M/ANALYZER SUMMARY OF INVOCATION REPORT ***
***----------------------------------------------------------------***
*** GROUP : INTRAC JOBNAME : M66CTB /JOB 1280 ***
*** MISSION : (NOMISS) RULE : ARWARN01 ***
*** CATEGORY: (NO-CATEGORY) OWNER : M66CTB ***
*** RUN ON : 10/10/01 - 12:13 ***
***----------------------------------------------------------------***
*
** ENTERING BLOCK: CHECK OF TYPE DATA
*
DIV. NVOICES STILL NOT IN, URGENT!!!
******************* HELP NEEDED NOW ***********************
=SHOUT : ‘DIV. INVOICES STILL NOT IN, URGENT ACTION REQUIRED********’ To: TSO-
CTB013I - ENDED "NOTOK" COMMITTED 0 VARIABLE(S) USERRC=0099
CTB002I - CONTROL-M/ANALYZER RUNTIME ENVIRONMENT ENDED
*** CONTROL-M/ANALYZER INVOICATION ENDED NOTOK USERCODE-OO99 ***
-
This Invocation Report was produced from rule ARWARN01, run between 1 and 3 pm. The report shows
-
the ENDED status, which is OK or NOTOK, as above, depending upon what time you executed the rule
-
the user code, which is 0000, or 0009, or 0099, or 0999, also depending upon the time of execution
-
that the SHOUT was performed
Figure 57 SYSRULE Report
*
*** RULE:ARWARN01 from DD : DABRULE ***
*
000001
000002 HEADER GROUP ‘INTRAC’ OWNER ‘M66’ DATE ‘101001’ TIME ‘155339’ CREATOR ‘M
000003 66’ DESC ‘SHOUT TO USERS IF DIVISIONAL AR DATA NOT IN’
000004
000005 EXECUTE ‘CHECK’
000006 ON_DATA
000007 IF ‘%%SYSTIME >= 100000 AND %%SYSTIE < 130000’
000008 DO PRINT DATA ‘DIV. INVOICES NOT IN, PLEASE CHECK IMMEDIATELY’
000009 DO PRINT DATA ‘********** ACTION REQUIRED WITHIN 30 MINUTES *******
.
.
.
000029 ELSE
000030 DO PRINT DATA ‘TIME IS NOT BETWEEN 12 P.M. AND 6 P.M.’
000031 DO PRINT DATA ‘YOU’’RE OK FOR NOW, BUT DO NOT RELAX’
000032 DO SHOUT MSG ‘TIME IS NOT BETWEEN 12 P.M. AND 6 P.M. --- RELAX ****
000033 ********’ URGENCY ‘R’ DEST ‘TSO-M66’
000034 DO TERMINATE RESULT OK USER_CODE 0
-
The SYSRULE report is a formatted printout of the rule as it existed in the library member at the time it was executed. For example, it shows:
-
the DO PRINT command as "DO PRINT DATA"
-
the DO TERMINATE command as "DO TERMINATE RESULT"
-
These extra words, such as DATA and RESULT, help make the documentation easier to read.
Conclusion
You have now completed Problem 1 by defining and running your first rule. INTRAC is now better prepared, with its management being automatically warned when the divisional data arrives late.
But your work has just begun. What you need to do next is check the commission report being sent to the payroll department and make sure it is OK.
Problem 2: Check Payroll Totals
The sales operations department makes up the annual sales plan, which contains the rules for calculating salesperson commissions. The calculations are complex.
Every month, the sales operations department runs their own computer program which calculates the commissions due to each salesperson in the company. This program produces a Sales Commission Detail report for the use of sales management. However, the sales operations department only provides the payroll department with the final amount of commissions earned by each sales employee, based on the report that they have prepared.
Figure 58 Payroll and Sales Calculation Flow
Problems
Every month, the payroll department has noticed that there are many adjustments to the commissions for the previous month. The payroll department has also heard, through the personnel department, of many complaints from the salespeople. The salespeople and management no longer trust the amounts they receive because of a history of mistakes. The payroll department is concerned that the file they receive, which contains commission amounts to be paid, has not been properly audited.
Solution — Overview
As a first step, the payroll department has decided to audit the Sales Commission Detail report for accuracy on the calculated totals. While the balancing activity of the payroll department, in the future, will be much more extensive, they need to implement their first balancing rule within three hours. This is when the payroll information is finalized for payment to employees. Because of the limited time available to implement this rule, they have decided to perform a simple check. But they will soon discover, when they implement the rule, that a major quality control surprise is waiting for them.
Figure 59 Sample Page from the Sales Commission Detail Report
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9---
INTRAC INC. SALES OPERATIONS DEPARTMENT DATE 10/10/01 TIME 23:45 PAGE 4
S A L E S C O M M I S S I O N S D E T A I L FROM 10/10/01 TO 10/10 01
|SALESPERSON HARVEY J. JONES (197) | INVOICE # | INVOICE DATE | AMOUNT | STATUS
| | CJ39394 | 02/02/00 | 2040.00 | COLLECTION |
| | CJ98443 | 03/03/00 | 245.00 | |
| | MJ24545 | 04/04/00 | 10344.40 | |
| | RJ10030 | 01/02/00 | 5329.39 | |
| | RJ12233 | 02/02/00 | 5000.00 | |
| | RJ30021 | 03/02/00 | 16670.10 | |
| | RJ32991 | 02/03/00 | 30300.44 | |
| | RJ33939 | 03/03/00 | 900.25 | |
| | RJ38001 | 04/04/00 | 1000.23 | |
| | RJ93043 | 04/04/00 | 415.89 | |
+--------------------------------------------------------------------------------------------
|TOTAL SALES - THIS MONTH 72245.70 (PAID IN FULL)
|ADJUSTMENTS -5800.70
|YTD SALES (INCLUDING THIS MONTH) -127879.00
|YTD COMMISSIONS PAID 0.00
|YTD COMMISSIONS OWED -5115.00
|COMMISSION PAYROLL AMOUNT 5115.00
---------------------------------------------------------------------------------------------
Shown above is a sample page from the Sales Commission Detail report. The audit of this report takes YTD Commissions paid, adds this to the current month commissions and compares the total to YTD Commissions owed. If the amounts are not equal, there is a serious payroll error.
To convince the INTRAC sales management of the integrity of the data, you would like to have a balancing report that shows the above calculations performed for every salesperson in the company.
You have obtained a small part of the production report, which is available in the IOA SAMPREPS library under the name CTBREP3. The part of the report on which you will work includes three sales employees and their actual figures from the last commission report.
Solution – Details
The rule consists of the following four ON blocks:
-
INIT – initializes values of variables which you will use in the rule
-
INPUT – extracts the sales data from the report
-
CHECK – checks the data and prints a balancing report
-
ENDJOB – prints a final comment and terminates the job
Opening the Rule
-
From the IOA Primary Option Menu, enter the Rule Definition facility by typing BR in the COMMAND field and pressing Enter. The Rule Definition entry panel is displayed:
Figure 60 Control-M/Analyzer Rule Definition Entry Panel
Copy-------------- CONTROL-M/ANLAYZER RULE DEFINITION - ENTRY PANEL ------------(BR)
COMMAND ===>
SPECIFY LIBRARY, RULE
LIBRARY ===> CTB.PROD.RULES
RULE ===> (Blank for rule selection list)
USE THE COMMAND "SHPF" TO SEE PFK ASSIGNMENT 13.41.48 -
If the library name in the LIBRARY field in this example is different from your Control-M/Analyzer RULES library name, change it to appear as shown in this example.
-
Leave the RULE field blank. Press Enter. The Rule List screen is displayed.
-
From the list of rules defined, select ARWARN02 for browsing as follows:
-
Place the cursor in the OPT field, to the left of the rule named ARWARN02.
-
Type B and press Enter. The Rule Definition screen for ARWARN02 is displayed.
Figure 61 Rule Definition Screen for Rule ARWARN02
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN02
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| OWNER M66 GROUP INTRAC |
| UPDATED 03/04/99 - 15:30:05 BY M66 |
| DESC SUMMARIZE AND CHECK PAYROLL TOTALS |
| OPTIONS |
| =========================================================================== |
| EXECUTE INIT UPON C |
| ON DATA |
| ALWAYS |
| DO SET = ERRORCOUNT=0 C |
| DO SET = SLSNO=0 C |
| DO SET = BLANK=' ' C |
| DO PRINT = ******** PAYROLL CONTROL TOTALS ********* F C |
| =========================================================================== |
| EXECUTE INPUT UPON C |
| ON SYSOUT PROCST PGMST STEP01 DDNAME SYSUT2 JOBNM |
| MODE PG LINECT 0000 DATASTAMP |
| WHEN LINE 001 - 060 COL 001 - 025 STOP AND/OR |
| STRING = 'YTD COMMISSIONS PAID' |
| DO EXTRACT = YTDPAID |
| LEVEL 0 LINE +000 COL 0068 - 0078 PROCESS TYP |
PLEASE FILL IN RULE DEFINITION. 14.46.10 -
Defining ON Blocks for this Rule
-
The first ON block in this rule is called INIT, as defined in the line that begins "EXECUTE INIT." This block is defined as an ON DATA block, set to ALWAYS perform the DO actions that follow it in the ON DATA block definition.
-
The purpose of this ON block is to initialize the values of variables that are used later in the rule. These variables are
-
ERRORCOUNT, which is a variable to keep track of all of the errors encountered as the rule performs its balancing actions
-
This count will be used, after examining the entire report, to determine if the rule should terminate OK or NOTOK.
-
SLSNO, which is a sequential salesperson number
-
Because the report you are producing is distributed to various employees, and because the individual salesperson earnings printed on the report are confidential, the rule uses a salesperson number rather than a name. This number will be a sequential number assigned by you.
-
BLANK, which is a variable that allows the rule to print blank lines, to create a better-looking report.
-
Alternatively, you may use an AutoEdit variable named %%BLANK in your print line.
-
Many rules have ON blocks such as this one to initialize variables and perform other setup functions.
-
You can now look at the next ON block, called INPUT. To get a better look at this entire ON block, do the following to move its first line to the top of the screen:
-
-
Examine the SCROLL field in the upper right area of the screen. If this field does not contain the value CRSR, place the cursor in the SCROLL field and type CRSR.
-
To bring the first line of the INPUT block to the top of the screen, place the cursor on the line beginning with the words EXECUTE INPUT and press PF08/PF20, or enter the DOWN command. The first line of the block is now displayed at the top of the screen, and its entire contents are now visible.
Figure 62 INPUT Block
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN02
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 001 - 025 STOP AND/OR |
| STRING = 'YTD COMMISSIONS PAID' |
| DO EXTRACT = YTDPAID |
| LEVEL 0 LINE +000 COL 0068 - 0078 PROCESS TYP |
| DO EXTRACT = YTDOWED |
| LEVEL 0 LINE +001 COL 0068 - 0078 PROCESS TYP |
| DO EXTRACT = CURRENT |
| LEVEL 0 LINE +002 COL 0068 - 0078 PROCESS TYP |
| DO BLOCK = CHECK ARG C |
| =========================================================================== |
| EXECUTE ENDJOB UPON C |
| ON DATA |
| IF ERRORCOUNT>0 C |
| DO PRINT = %%BLANK F C |
| DO PRINT = ****** ERRORS IN COMMISSIONS ABOVE ****** F C |
| DO TERMINAT = NOTOK COD 0999 |
| ELSE |
PLEASE FILL IN RULE DEFINITION. 15.00.48Before examining this screen in detail, you need to first understand how a "data source" related ON block is structured.
Figure 63 ON Block Structure
-
EXECUTE – The EXECUTE parameter identifies the beginning of a new ON block. After the word EXECUTE, give the ON block a name. In these examples, you are not using the UPON parameter. This parameter can be used to specify criteria which determine if the current ON block is executed.
-
ON <data source> – The ON parameter identifies the report or file that you want to process. What you specify here enables Control-M/Analyzer to receive the output from the system.
-
WHEN <criteria> – The WHEN parameter searches for the specific data that you need from your report.
-
DO <actions> – DO parameters indicate the balancing actions to take for each line that met your search criteria.
When you need to extract data from a report or file, you use an ON block structure as shown in Figure63. An ON block consists of the following parameters:
-
-
Now see how this ON block structure is implemented in the INPUT ON block.
-
EXECUTE INPUT marks the beginning of the block named INPUT.
-
ON SYSOUT indicates that this block is working with a report file.
-
MODE PG indicates that the block is examining the report by page. This means that when data is extracted from the report, the line and column numbers are specified relative to the beginning of the current page.
-
LINECT indicates the number of lines per page. When not specified, as above, it defaults to 60.
-
WHEN describes the search criteria.
-
DO EXTRACT takes data out of the report and puts it into a variable. Control-M/Analyzer can then reference and work with this variable. This extraction of data from the report occurs for each line in which the string "YTD COMMISSIONS PAID" is found.
Copy----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9---
INTRAC INC. SALES OPERATIONS DEPARTMENT DATE 10/10/01 TIME 23:45 PAGE 4
S A L E S C O M M I S S I O N S D E T A I L FROM 10/10/01 TO 10/10 01
|SALESPERSON HARVEY J. JONES (197) | INVOICE # | INVOICE DATE | AMOUNT | STATUS
| | CJ39394 | 02/02/00 | 2040.00| COLLECTION|
| | CJ98443 | 03/03/00 | 245.00| |
| | MJ24545 | 04/04/00 | 10344.40| |
| | RJ10030 | 01/02/00 | 5329.39| |
| | RJ12233 | 02/02/00 | 5000.00 | |
| | RJ30021 | 03/02/00 | 16670.10 | |
| | RJ32991 | 02/03/00 | 30300.44 | |
| | RJ33939 | 03/03/00 | 900.25 | |
| | RJ38001 | 04/04/00 | 1000.23 | |
| | RJ93043 | 04/04/00 | 415.89 | |
+--------------------------------------------------------------------------------------------
|TOTAL SALES - THIS MONTH 72245.70 (PAID IN FULL
|ADJUSTMENTS -5800.70
|YTD SALES (INCLUDING THIS MONTH) -127879.00
|YTD COMMISSIONS PAID 0.00
|YTD COMMISSIONS OWED -5115.00
|COMMISSION PAYROLL AMOUNT 5115.00
---------------------------------------------------------------------------------------------Figure 64 Extract from the Sales Commission Detail Report
-
DO EXTRACT YTDPAID—The rule extracts report data from columns 68-78 into a variable called YTDPAID. The report data comes from the above WHEN search, specifically line +0, meaning the line in which "YTD COMMISSIONS PAID" is found, plus 0 lines.
-
DO EXTRACT YTDOWED—This information is also extracted from columns 68-78 into the variable called YTDOWED. The report data comes from line +1, meaning the line in which "YTD COMMISSIONS PAID" is found, + 1 line.
-
DO EXTRACT CURRENT—This information also comes from the report data columns 68-78 and is put into the variable called YTDOWED. The report data comes from line +2, meaning the line in which "YTD COMMISSIONS PAID" is found, + 2 lines.
-
DO BLOCK CHECK — After extracting the above information, perform ON block CHECK before continuing to search further down the report for the next occurrence of "YTD COMMISSIONS PAID."
Now that the information has been extracted, the rule performs balancing actions on the data. Therefore, a separate ON DATA block is defined in to perform the balancing actions.
If you are not familiar with Job Control Language (JCL), the details for this part of the Control-M/Analyzer rule can be provided by your system administrator. The ON SYSOUT parameter instructs Control-M/Analyzer to look in the JCL in the first job step (STEP01). There, Control-M/Analyzer will find a data definition (DD) JCL statement labeled SYSUT2. This is the statement that gives Control-M/Analyzer the information it needs, in order to describe the characteristics of the report file.
As defined in this block, when the rule finds the data string "YTDCOMMISSIONSPAID" anywhere between columns 1 through 25, in lines 1through60, meaning, on any line of the report, Control-M/Analyzer is instructed to DO the balancing actions. The following DO EXTRACT and DO BLOCK instructions are performed repetitively, every time the WHEN search criteria are satisfied:
-
-
Using PF08/PF20, or entering the DOWN command, scroll forward until you see the ON block called EXECUTE CHECK.
-
Place the cursor on the line beginning with EXECUTE CHECK and press PF08/PF20 or enter the DOWN command.
Figure 65 The EXECUTE CHECK ON Block
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN02
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| =========================================================================== |
| EXECUTE CHECK UPON C |
| ON DATA |
| ALWAYS |
| DO SET = CALCAMT=YTDPAID+CURRENT C |
| DO SET = DIFFERENCE=ABS(CALCAMT-YTDOWED) C |
| DO SET = SLSNO=INT(SLSNO+1) C |
| DO PRINT = SALESPERSON #%%SLSNO F C |
| DO PRINT = YTD COMM. PAID %%YTDPAID F C |
| DO PRINT = CURRENT AMOUNT %%CURRENT F C |
| DO PRINT = ----------------------------------------- F C |
| DO PRINT = CALCULATED TOTAL %%CALCAMT F C |
| DO PRINT = REPORTED TOTAL %%YTDOWED F C |
| DO PRINT = ----------------------------------------- F C |
| DO PRINT = DIFFERENCE ***** %%DIFFERENCE ***** F C |
| DO PRINT = %%BLANK F C |
| IF DIFFERENCE>0 C |
| DO PRINT = ***** SERIOUS PAYROLL ERROR - SEE ABOVE ***** F C |
| DO PRINT = %%BLANK F C |
| DO SET = ERRORCOUNT=ERRORCOUNT+1 C |
PLEASE FILL IN RULE DEFINITION. 15.06.39The ON block called CHECK performs calculations and prints information to the balancing report. Generally, calculations are performed using DO SET parameters. DO SET assigns a value to a variable. Output to the report is performed with DO PRINT parameters.
The ON block CHECK performs the following actions:
-
The new variable CALCAMT is set to the sum of YTDPAID and CURRENT. These two variables were extracted from the report.
-
The variable DIFFERENCE is calculated as the difference between the amount just calculated (CALCAMT) and the amount from the report (YTDOWED). As you will see later in the rule, if there is a difference, it means that there is a serious error. Function ABS is used to set the difference to the "absolute value" of CALCAMT minus YTDOWED.
The ABS function is one of the many functions available in Control-M/Analyzer to assist the balancing effort. The ABS function is used because the difference should always print as a positive number. When there is a difference, you do not know which amount is the correct amount (CALCAMT or YTDOWED). All you are concerned with in this instance is that there is a difference.
-
The last DO SET parameter increments the salesperson number (SLSNO) by 1. If you want to examine the commission totals for more than one salesperson, you can continue sequentially through the current list of salespeople, based on their salesperson numbers.
-
The report is printed with the group of DO PRINT parameters. As you may recall from the first rule as defined in Problem 1, these print lines are output to two places: the Invocation Report on SYSPRINT, and the user report on SYSUSER.
-
Whenever you want to include a variable in the print line, precede the variable name with two percent signs (%%). As you see in Figure65, this ON block prints several lines and several variables: YDTPAID, CURRENT, CALCAMT, YTDOWED, DIFFERENCE.
You can compare these instructions to the actual SYSUSER report, as shown in Figure68.
The last part of this ON block contains an IF and ELSE combination of parameters.
-
-
Position the cursor on the line beginning with the string "IFDIFFERENCE>0" and press PF08/PF20, or enter the DOWN command.
Figure 66 IF and ELSE Parameters
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN02
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| IF DIFFERENCE>0 C |
| DO PRINT = ***** SERIOUS PAYROLL ERROR - SEE ABOVE ***** F C |
| DO PRINT = %%BLANK F C |
| DO SET = ERRORCOUNT=ERRORCOUNT+1 C |
| ELSE |
| DO PRINT = COMMISSIONS OK F C |
| DO PRINT = %%BLANK F C |
| =========================================================================== |
| EXECUTE UPON C |
| ON |
======= >>>>>>>>>>>>>>> END OF RULE DEFINITION PARAMETERS <<<<<<<<<<<<<<< =====
PLEASE FILL IN RULE DEFINITION. 15.07.59This IF and ELSE definition determines for each salesperson if there is a problem in the balancing report, as follows:
-
If the DIFFERENCE that was calculated previously was greater than 0, then
-
print an error message, followed by a blank line
-
add 1 to the error count
-
otherwise (ELSE),
-
-
Print a message indicating that the commissions are OK, followed by a blank line
-
Terminating the Rule
-
All that is left is for the rule definition to terminate it after the entire report has been examined. This is done with the ON block called ENDJOB.
-
Press PF07/PF19 or enter the UP command, to scroll backward until you see the ON block ENDJOB.
-
Place the cursor on the line beginning with the string "EXECUTE ENDJOB" and press PF08/PF20 or enter the DOWN command.
Figure 67 ON Block ENDJOB
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN02
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| EXECUTE ENDJOB UPON C |
| ON DATA |
| IF ERRORCOUNT>0 C |
| DO PRINT = %%BLANK F C |
| DO PRINT = ****** ERRORS IN COMMISSIONS ABOVE ****** F C |
| DO TERMINAT = NOTOK COD 0999 |
| ELSE |
| DO PRINT = %%BLANK F C |
| DO PRINT = --------- COMMISSIONS ARE PERFECT --------- F C |
| DO TERMINAT = OK COD 0000 |
| =========================================================================== |
| EXECUTE CHECK UPON C |
| ON DATA |
| ALWAYS |
| DO SET = CALCAMT=YTDPAID+CURRENT C |
| DO SET = DIFFERENCE=ABS(CALCAMT-YTDOWED) C |
| DO SET = SLSNO=INT(SLSNO+1) C |
| DO PRINT = SALESPERSON #%%SLSNO F C |
| DO PRINT = YTD COMM. PAID %%YTDPAID F C |
| DO PRINT = CURRENT AMOUNT %%CURRENT F C |
PLEASE FILL IN RULE DEFINITION. 15.08.50
Because ON block ENDJOB is the block that sequentially follows ON block INPUT, it is executed right after Control-M/Analyzer has finished executing ON block INPUT—that is, after the rule has scanned the entire report and found and processed all of the lines it was searching for.
ON block ENDJOB performs one of the following two actions, depending on whether there were any errors found when the data was checked:
-
If there any errors were found, the rule prints a final line to indicate errors, and then terminates the rule with a NOTOK result and with the user code of 999. This code is a numeric code that indicates an out-of-balance situation.
You can create your own rules, and you can choose your own codes to signify various errors.
-
If no errors are found, this indicates that the commissions are perfect in the printout. The rule terminates with an OK result, and with the user code of 0.
-
Conclusion
You have now completed Problem 2 by examining the definition of the second rule. In the IOA SAMPLE library there is a member named RUNRULE2 that runs the rule you just examined. You may submit this job and review the output.
Figure 68 Output from Job RUNRULE2
******** PAYROLL CONTROL TOTALS ********SALESPERSON #1
YTD COMM. PAID 0.00
CURRENT AMOUNT 5115.00
----------------------------------------
CALCULATED TOTAL 5115.000
REPORTED TOTAL -5115.00
----------------------------------------
DIFFERENCE ***** 10230.00 *****
***** SERIOUS PAYROLL ERROR - SEE ABOVE *****
SALESPERSON #2
YTD COMM. PAID 1883.13
CURRENT AMOUNT 11632.03
----------------------------------------
CALCULATED TOTAL 13515.160
REPORTED TOTAL 13515.16
----------------------------------------
DIFFERENCE ***** 0.0000 *****
COMMISSIONS OK
SALESPERSON #3
YTD COMM. PAID 0.00
CURRENT AMOUNT 39995.16
----------------------------------------
CALCULATED TOTAL 39995.160
REPORTED TOTAL 39995.16
----------------------------------------
DIFFERENCE ***** 0.0000 *****
COMMISSIONS OK
Looking at the results for Salesperson #1, you can see that the balancing rule has caught a significant error. This individual earned negative commissions. Perhaps this is a new salesperson who has had no sales, but only returns. For whatever reason, this salesperson's commissions were -$5,115. The amount specified to the payroll department should probably have been 0. Instead, the amount specified was $5,115! Fortunately, you caught this mistake in time.
Problem 3: Check Sales Commissions
The payroll user has been thinking about the congratulations that he received from the managing director of INTRAC. Because of the quick implementation of rule ARWARN02 from Problem 2, he has saved the company time and money. With this quick success, the payroll user moves ahead to work on to Problem 3.
There is one more simple check that the payroll department will perform on the Sales Commissions Detail report. In this rule, a new feature of Control-M/Analyzer is introduced — the ability to summarize extracted information.
Look again at a sample page of the report.
Figure 69 Sales Commissions Detail Report
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9---
INTRAC INC. SALES OPERATIONS DEPARTMENT DATE 10/10/01 TIME 23:45 PAGE 4
S A L E S C O M M I S S I O N S D E T A I L FROM 10/10/01 TO 10/10 01
| SALESPERSON HARVEY J. JONES (197) | INVOICE # | INVOICE DATE | AMOUNT | STATUS
| | CJ39394 | 02/02/00 | 2040.00 | COLLECTION|
| | CJ98443 | 03/03/00 | 245.00 | |
| | MJ24545 | 04/04/00 | 10344.40 | |
| | RJ10030 | 01/02/00 | 5329.39 | |
| | RJ12233 | 02/02/00 | 5000.00 | |
| | RJ30021 | 03/02/00 | 16670.10 | |
| | RJ32991 | 02/03/00 | 30300.44 | |
| | RJ33939 | 03/03/00 | 900.25 | |
| | RJ38001 | 04/04/00 | 1000.23 | |
| | RJ93043 | 04/04/00 | 415.89 | |
+--------------------------------------------------------------------------------------------
|TOTAL SALES - THIS MONTH 72245.70 (PAID IN FULL)
|ADJUSTMENTS -5800.70
|YTD SALES (INCLUDING THIS MONTH) -127879.00
|YTD COMMISSIONS PAID 0.00
|YTD COMMISSIONS OWED -5115.00
|COMMISSION PAYROLL AMOUNT 5115.00
---------------------------------------------------------------------------------------------
Problem
Based on the error that the payroll department found from using balancing Rule 2 (ARWARN02), the payroll department users are concerned about the basic integrity of the Sales Commission Detail report. They need to develop some control totals on the report and compare these totals to each other and to published accounting department figures.
Solution - Overview
The users will check that the grand total of all of the invoice details for all salespeople adds up to the grand total of Total Sales for all salespeople. They can compare these figures to figures that the accounting department has officially published.
Solution - Details
The rule consists of the following three ON blocks:
-
INIT – initializes values of variables in the rule
-
INPUT – extracts and summarizes the above data from the report
-
FINISH – checks the final totals and prints a balancing report
-
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
CopyLIBRARY : 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
-
-
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
CopyLIBRARY : 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:
-
The ON SYSOUT definition is identical to the one in rule ARWARN02. It provides the connection to the report file stored on the system.
-
The first WHEN definition selects all report lines that have a "/" between columns 50 and 60. The "/" is part of a date field. This is how detail lines are identified from the report (Figure 69 Sales Commissions Detail Report). From these detail lines, the rule extracts the information in columns 68 through 78 and puts it into a variable called SUM1.
-
The second WHEN definition selects the report lines that contain the string TOTALSALES in columns 1 through 20. This is the line containing the total sales amount of each sales employee. From these report lines, the rule extracts the information in columns 68 through 78 and puts it into a variable called SUM2.
-
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 through60. 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.
-
-
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
CopyLIBRARY : 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:
-
Prints a report heading and the two sums, SUM1 and SUM2, that were calculated with the TYP SU parameter.
-
Calculates the difference between the two variables and then prints the difference, followed by two blank lines.
-
To end the rule, determine, with the IF parameter, if the difference is tolerable or not. If the difference is greater than $1000, call this a serious commission error and terminate the rule NOTOK, with a 999 user code. Otherwise, indicate that these totals are OK and terminate the rule accordingly, terminating with OK, and with a user code of 0.
-
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.
Conclusion
You have now examined and implemented three basic rules. The parameters and ON blocks that you have just learned about form the basis for continuing with the more advanced Control-M/Analyzer features. These advanced features are discussed in the next section.
If your purpose in reviewing this guide was to gain an overview of Control-M/Analyzer capabilities, you might want to finish here.
If you would like to explore more advanced examples of Control-M/Analyzer rules, including
-
processing of sequential files
-
use of database generations
-
use of more sophisticated input data screening
-
use of other functions
then, proceed to the next topic.
Advanced Problems and Solutions
Problem 4: Balance Divisional Accounting Files
Problem
Without an automated data balancing product, your accounting user is spending hours every day looking through large reports for errors. It is a nearly impossible task. INTRAC generates hundreds of invoices daily. The user had to scan through the lists of invoices, often under the pressures of other tasks, and limited time. Most of the errors are not obvious, but each error that creeps into the system is costly to correct.
Solution — Overview
Based on an analysis of the types of errors encountered over the past year, the user has set criteria for accepting the daily invoice files from the divisions. The criteria are shown in the file description. See Sources of Data—Reports and Files.
-
The daily invoice file must be verified, before being passed on to the accounting department for processing. The verification will include all the items specified in the file description. These include items such as invoice date OK, division # OK, amounts OK, and totals are in balance with the details.
-
When the file is verified, the two totals (Invoice Amount and Cost) must be saved, for each of the three divisions—meaning that six variables are calculated. These amounts will be used for weekly reasonableness checks, which are defined in rule ARWARN05.
-
Any data not meeting the balancing criteria must be reported.
Solution - Details
In this Control-M/Analyzer solution, the rule
-
analyzes the divisional invoice file, checking each row or record of data
-
reports errors
-
accumulates divisional totals for invoice amounts and cost
-
updates the Control-M/Analyzer database if all of the errors are "tolerable," or if there are no errors
In this rule, you will learn several new features, including
-
using a sequential file as a data source
-
committing database variables
-
using the SUBSTR and INT functions
-
using the %% prefix in defining variable names
Opening Rule ARWARN04
-
Select rule ARWARN04 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 74 Rule ARWARN04
-
-
Copy
LIBRARY : CTB.PROD.RULES RULE : ARWARN04
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| OWNER M66 GROUP INTRAC |
| UPDATED 20/12/99 - 15:02:19 BY M66 |
| DESC ANALYZE AND REPORT ON DIV ARDATA FILES |
| OPTIONS |
| =========================================================================== |
| EXECUTE INIT UPON C |
| ON DATA |
| ALWAYS |
| DO PRINT = INTRAC DAILY DIVISIONAL INVOICE ANALYSIS F C |
| DO PRINT = FOR %%SYSDATE F C |
| DO PRINT = -- ------- -------- ------- ------- --------- ----- F C Y |
| ---- |
| DO PRINT = DV CUST CUST # INV # DATE AMOUNT PROBL F C Y |
| EM |
| DO PRINT = -- ------- -------- ------- ------- --------- ----- F C Y |
| ---- |
| DO SET = ERRORS=0 C |
| DO SET = TOLERABLES=0 C |
| DO SET = BLANK=' ' C |
| =========================================================================== |
PLEASE FILL IN RULE DEFINITION. 15.22.36-
The rule consists of the following five ON blocks:
-
INIT – Prints initial report headings and initializes values of variables in the rule
-
INPUT – Extracts data from the sequential divisional invoice file, recognizing two types of records in the file—detail records and total records
-
CHKDETL – Analyzes detail records for errors
-
PRINT – Prints the detail balancing report
-
ENDJOB – Analyzes the divisional totals, commits the Database variables, if there are no intolerable errors, and prints the rest of the balancing report
-
-
Place the cursor on the line beginning with the string "EXECUTE INIT," and press PF08/PF20, or enter the DOWN command.
Figure 75 EXECUTE INIT Block
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN04
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| EXECUTE INIT UPON C |
| ON DATA |
| ALWAYS |
| DO PRINT = INTRAC DAILY DIVISIONAL INVOICE ANALYSIS F C |
| DO PRINT = FOR %%SYSDATE F C |
| DO PRINT = -- ------- -------- ------- ------- --------- ----- F C Y |
| ---- |
| DO PRINT = DV CUST CUST # INV # DATE AMOUNT PROBL F C Y |
| EM |
| DO PRINT = -- ------- -------- ------- ------- --------- ----- F C Y |
| ---- |
| DO SET = ERRORS=0 C |
| DO SET = TOLERABLES=0 C |
| DO SET = BLANK=' ' C |
| =========================================================================== |
| EXECUTE INPUT UPON C |
| ON FILE FILENAME IOAP.V610.SAMPREPS(CTBREP1) |
| MODE DS LINECT 0000 DATASTAMP |
| WHEN LINE 001 - 999 COL 003 - 015 STOP AND/OR |
| STRING = .NE.TOTALINVOICES |
PLEASE FILL IN RULE DEFINITION. 15.24.47-
The DO PRINT instructions print the report heading lines.
-
As in previous rules you examined, this rule defines a variable that accumulates the error count, in this case, ERRORS. Another variable, TOLERABLES, that stores the accumulated number of tolerable errors, is defined. Tolerable errors will result in warning messages appearing on the report, but will still result in an OK condition and with the database being updated.
-
-
Place the cursor on the line beginning with the string "EXECUTE INPUT," and press PF08/PF20, or enter the DOWN command.
Figure 76 EXECUTE INPUT Block
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN04
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| EXECUTE INPUT UPON C |
| ON FILE FILENAME IOAP.V610.SAMPREPS(CTBREP1) |
| MODE DS LINECT 0000 DATASTAMP |
| WHEN LINE 001 - 999 COL 003 - 015 STOP AND/OR |
| STRING = .NE.TOTALINVOICES |
| DO EXTRACT = DIV |
| LEVEL 0 LINE +000 COL 0001 - 0002 PROCESS TYP |
| DO EXTRACT = CUST |
| LEVEL 0 LINE +000 COL 0003 - 0030 PROCESS TYP |
| DO EXTRACT = CUSTNO |
| LEVEL 0 LINE +000 COL 0031 - 0038 PROCESS TYP |
| DO EXTRACT = INVNO |
| LEVEL 0 LINE +000 COL 0039 - 0045 PROCESS TYP |
| DO EXTRACT = DATE |
| LEVEL 0 LINE +000 COL 0046 - 0051 PROCESS TYP |
| DO EXTRACT = AMT |
| LEVEL 0 LINE +000 COL 0052 - 0061 PROCESS TYP |
| DO EXTRACT = AMT%%DIV |
| LEVEL 0 LINE +000 COL 0052 - 0061 PROCESS TYP SU |
| DO EXTRACT = COST |
PLEASE FILL IN RULE DEFINITION. 15.25.36-
The value in the INPUT ON block for a file has the identical structure to the INPUT ON block for a report. As a reminder, the structure is:
-
ON – to specify the data source
-
WHEN – to specify the search criteria
-
DO – to specify balancing actions
-
ON Parameter
-
The ON parameter specifies the data source as a file and provides the file name. The rule can process a file in one of the following two MODEs:
-
PG (page) – A rule can process a file as if it were a series of pages of a report. In such a case, the rule may optionally define a line count.
-
DS (dataset) – If the file does not have the appearance of a report, meaning that it is not organized into pages, the rule can process a file as a series of records or rows of a dataset.
-
This rule processes the invoice file in DS mode.
-
-
WHEN Criteria
-
In this file, two WHEN criteria describe the two types of rows on which the rule needs to take action:
-
Detail Rows, which do not contain the string, TOTALINVOICES, in columns 3through15.
-
Total Rows, which contain the string, TOTALINVOICES, in columns 3through15.
-
-
DO Parameters
-
The DO EXTRACT parameters extract information from each Detail Row of the file when the search criteria specified in the WHEN parameter are satisfied. Shown below is a sample of the data in an extracted row (Figure77), corresponding to each of the DO EXTRACT parameters that are specified in the rule:
Figure 77 Sample Data for DO EXTRACT Definition
CopyDiv Customer---------------- Invoice -----------------
# Customer Name # # -Date- Amount Cost Misc.
01ABC COMPANY 1ABC0001CJ39394020892 2040.00 1800.00 157.95
01SHANGHAI MOTORS 1SHA0002CJ39395030892 245.00 30.00 10.00
01TELEPATHIC ENTERPRISES 1TEL0001CJ39396040892 10987.55 10005.00 300.00
01CBG COMPANY 1CBG0001CJ39397020892 12044.00 12000.00 0.00
01TERRIBLE TRUCKERS 1TER0001CJ39398030892 345245.00 308000.00 4750.00
01BIG DEAL COMPUTING LTD 1BIG0001CJ39399040892 987.25 600.00 0.00
01UNDERGROUND TELEPHONES INC 1UND0001CJ39400020892 40.00 20.00 0.00
01MITSUISUN ELECTRONICS 1MIT0001CJ39401030892 6776.45 6000.00 115.00
01TOTALINVOICES 378365.25 338455.00 6789.00
02SWAHILI ARMED FORCES 2SWA0001MJ24545040892 10987.55 10005.00 275.00
02GOVERNMENT OF BOSSNIA 2GBO0001MJ24546020892 27500.00 26800.00 200.50
02METZUYAN MANUFACTURING 2MET0001MJ24547030892 13465.00 12830.00 347.00
02TELEPATHIC ENTERPRISES 2TEL0002MJ24548040892 5590.00 5600.00 0.00
02BANGUP AIRCRAFT 2BAN0001MJ24549020892 2150.00 1800.00 7.00
02ZAPIT HYDRO & ELECTRIC 2ZAP0001MJ24550030892 45222.00 40900.00 815.00
02POST OF THE AMERICAS 2POS0001MJ24551040892 10000.50 8005.00 500.00
02GROSS AIRLINES 2GRO0001MJ24552020892 197.75 100.00 0.00
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -
The variable being extracted (AMT%%DIV) contains the %% AutoEdit operator symbol, resulting in the following:
-
When the rule extracts data from the current line in the file and performs this DO EXTRACT procedure, the rule substitutes the current value of variable DIV (division) in place of the entire string %%DIV.
For example, if the rule were looking at the first row in the report, the current value of the DIV variable would be set to "01" (see the first line in Figure 77 Sample Data for DO EXTRACT Definition). -
The name of the variable extracted would then be set to AMT01, substituting 01 for %%DIV in the variable name AMT%%DIV.
-
For more details about AutoEdit variables, see the Control-M/Analyzer for z/OS User Guide.
-
The AMT%%DIV variable is set to TYP SU. This means that the rule will accumulate a sum for each division. Specifically, after the entire file is processed, the resulting variables will be: AMT01, AMT02, and AMT03 (see Figure 77 Sample Data for DO EXTRACT Definition). Each variable will contain the sum of that division's invoice amounts. By scrolling forward through the report using PF08/PF20 (DOWN), you will see that COST divisional totals are accumulated also.
Look at the following details in the second to last DO parameter in Figure76 (DOEXTRACT = AMT%%DIV):
-
-
Now examine the remainder of this INPUT block. Use PF08/PF20, or enter the DOWN command, and scroll forward to the DO SET parameter set to NAME=SUBSTR(1,7CUST), immediately following the DO EXTRACT parameters.
-
Place the cursor on the line beginning with DO SET = NAME, and press Enter.
Figure 78 DO SET Parameters
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN04
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| DO SET = NAME=SUBSTR(1,7,CUST) C |
| DO SET = MONTHYR=SUBSTR(3,4,DATE) C |
| DO BLOCK = CHKDETL ARG C |
| WHEN LINE 001 - 999 COL 003 - 015 STOP AND/OR |
| STRING = TOTALINVOICES |
| DO EXTRACT = DIV |
| LEVEL 0 LINE +000 COL 0001 - 0002 PROCESS TYP |
| DO EXTRACT = TAMT%%DIV |
| LEVEL 0 LINE +000 COL 0052 - 0061 PROCESS TYP |
| DO EXTRACT = TCOST%%DIV |
| LEVEL 0 LINE +000 COL 0062 - 0071 PROCESS TYP |
| =========================================================================== |
| EXECUTE ENDJOB UPON C |
| ON DATA |
| ALWAYS |
| DO SET = I=1 C |
| LABEL: TOTALS |
| IF I GT 3 C |
| DO GOTO LABEL FINISH |
| ELSE |
PLEASE FILL IN RULE DEFINITION. 15.28.55-
These last parameters of the rule are defined as follows:
-
The first DO SET instruction takes the first 7 characters of the customer name, CUST, using the SUBSTR function, and assigns them to a variable called NAME. This illustrates the use of the substring function in order to save space in the report line. The SUBSTR function syntax requires the starting position in a field, in this case "1," the number of characters to extract, in this case "7," and the field name, in this case "CUST."
-
The next DO SET instruction creates a variable called MONTHYR, comprised of positions 3 through 6 of the variable DATE, which the rule had extracted from the file. These positions represent the invoice month and year, which must be checked for validity.
-
Having extracted all the information needed, the rule executes an ON block within the rule called CHKDETL. This ON block is explained in "Examining the CHKDETL Block" below.
-
The second and last WHEN parameter of this rule searches for the database row containing TOTALINVOICES in columns 3through15.
-
When the rule finds the desired rows, it extracts three variables using DOEXTRACT actions: DIV, TAMT%%DIV, and TCOST%%DIV.
-
When Control-M/Analyzer reads the string %%DIV, it substitutes the value of the variable DIV in place of the string %%DIV. For example, if the rule were looking at the TOTALINVOICES row for division 01, see Figure 77 Sample Data for DO EXTRACT Definition, the variable DIV would be set to 01. The names of the next two variables extracted would be set to TAMT01 and TCOST01, substituting 01 for %%DIV in the variable names TAMT%%DIV and TCOST%%DIV.
-
Similarly, if the rule were looking at the TOTALINVOICES row for division 02, it would extract variables whose names would be DIV, equal to a value of 02, TAMT02, and TCOST02.
-
While the variable has been specified only once, no matter how many divisions there are in the file, the result will be unique variable names for the invoice amount and cost for each division.
-
This capability to have the system dynamically generate variable names is a powerful feature of Control-M/Analyzer rule definition parameters, which is used several times within this sample rule.
-
Examining the CHKDETL Block
-
You will now examine the CHKDETL block to see what balancing actions are performed on each detail row of the file.
-
Using PF08/PF20, or execute the DOWN command, scroll forward until you see the ON block EXECUTE CHKDETL.
-
Place the cursor on the line beginning with the string "EXECUTE CHKDETL," and press PF08/PF20, or execute the DOWN command.
Figure 79 ON Block EXECUTE CHKDETL
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN04
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| EXECUTE CHKDETL UPON C |
| ON DATA |
| IF DIV NE 01 AND DIV NE 02 AND DIV NE 03 C |
| DO SET = PROBLEM='DIV' C |
| DO SET = ERRORS=ERRORS+1 C |
| DO BLOCK = PRINT ARG PROBLEM C |
| IF DIV = 01 AND AMT > 400000 C |
| DO SET = PROBLEM='AMT' C |
| DO SET = ERRORS=ERRORS+1 C |
| DO BLOCK = PRINT ARG PROBLEM C |
| IF DIV = 01 AND AMT > 200000 AND AMT <= 400000 C |
| DO SET = PROBLEM='AMT-WRN' C |
| DO SET = TOLERABLES=TOLERABLES+1 C |
| DO BLOCK = PRINT ARG PROBLEM C |
| IF DIV = 02 OR DIV = 03 AND AMT > 200000 C |
| DO SET = PROBLEM='AMT' C |
| DO SET = ERRORS=ERRORS+1 C |
| DO BLOCK = PRINT ARG PROBLEM C |
| IF DIV = 02 OR DIV = 03 AND AMT > 100000 AND AMT <= 200000 C |
| DO SET = PROBLEM='AMT-WRN' C |
PLEASE FILL IN RULE DEFINITION. 15.31.20 -
The parameters of the rule are defined as follows:
-
The ON DATA block checks each field extracted from the detail line, according to the user criteria as shown in Sources of Data—Reports and Files. A series of IF statements determines if the balancing criteria are met.
-
In the first DO SET parameter for each IF statement, if there is a problem, a variable called PROBLEM is set to equal a code that describes that problem. For example, in the first IF parameter, the code DIV is set if the division does not equal 01, 02, or 03.
-
In the second DO SET parameter for the first, second, and fourth IF statements that you see on the screen, the error counter, ERRORS, is incremented by 1.
-
In the third IF condition, another counter, TOLERABLES, is incremented and the variable, ERRORS, is not incremented. This occurs when the IF condition encounters an "unusual" situation, but not an error. The data, in that case, would be considered OK.
-
After the first two DO SET statements in each IF statement, the rule then executes an ON block called PRINT, using the DO BLOCK parameter. The DO BLOCK action parameter enables you to
-
group instructions in a balancing rule together, organizing a more complex rule into logical sections
-
reference an ON block, such as PRINT, from several other ON blocks in the rule
-
Without DO BLOCK actions, ON blocks are executed sequentially. ON blocks that are called using DO BLOCK parameters should therefore be located after the last sequential ON block in the rule. This ensures that these ON blocks are not executed except when called by a DO BLOCK parameter.
-
-
Examine the rest of this ON block. Use PF08/PF20, or execute the DOWN command, and scroll forward to the bottom of the rule.
Figure 80 End of Rule ARWARN04
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN04
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| IF DIV = 02 OR DIV = 03 AND AMT > 100000 AND AMT <= 200000 C |
| DO SET = PROBLEM='AMT-WRN' C |
| DO SET = TOLERABLES=TOLERABLES+1 C |
| DO BLOCK = PRINT ARG PROBLEM C |
| IF MONTHYR NE DB_PROCESS_MONTH C |
| DO SET = PROBLEM='DATE' C |
| DO SET = ERRORS=ERRORS+1 C |
| DO BLOCK = PRINT ARG PROBLEM C |
| =========================================================================== |
| EXECUTE PRINT UPON C |
| ON DATA |
| ALWAYS |
| DO PRINT = %%DIV %%NAME %%CUSTNO %%INVNO %%DATE %%AMT %%PROBLE F C Y |
| M |
| =========================================================================== |
| EXECUTE UPON C |
| ON |
======= >>>>>>>>>>>>>>> END OF RULE DEFINITION PARAMETERS <<<<<<<<<<<<<<< =====
PLEASE FILL IN RULE DEFINITION. 15.33.09-
The EXECUTE PRINT block has just one parameter, a DO PRINT instruction. Rather than having a separate ON block such as this one for printing, the rule also could have been defined with multiple instances of these same print instructions in the CHKDETL block. This illustrates how rules can often be written differently and still accomplish the same balancing task.
-
-
Ending the rule
You will now examine the ON block, ENDJOB, which is executed sequentially after all file input has been processed by the ON block called INPUT. It is physically located further up in this rule.
The last tasks before this rule ends are to
-
compare divisional totals accumulated from the detail rows for each division to the divisional totals extracted from the file
-
report these totals with any errors
-
terminate the rule
To accomplish this, only one generic set of balancing instructions is necessary for all divisions. This is done by generalizing the instructions in order to insert the division code into the variable names. This requires using the %% operator, as explained in DO Parameters.
The flow of logic in the ON block, ENDJOB, is illustrated in the following diagram:
Figure 81 Flow of ON Block Logic
-
A section of the ON block, called TOTALS, continually checks if all division totals are analyzed.
-
If all division totals are analyzed, the rule proceeds to another section of the ON block, called FINISH, where the final error count is printed and the rule is terminated.
-
If not (ELSE), a variable, D, is read, containing the current division name attached to the variable names. Division D totals are analyzed and printed. After the analysis, the rule returns to the section of the ON block called TOTALS.
-
Now examine the actual rule to see how this logic is defined. Use PF07/PF19, or execute the UP command, to scroll backward until you see ON block EXECUTE ENDJOB on the screen.
-
Place the cursor on the line beginning with the string "EXECUTE ENDJOB," and press PF08/PF20, or execute the DOWN command.
Figure 82 ON Block EXECUTE ENDJOB
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN04
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| EXECUTE ENDJOB UPON C |
| ON DATA |
| ALWAYS |
| DO SET = I=1 C |
| LABEL: TOTALS |
| IF I GT 3 C |
| DO GOTO LABEL FINISH |
| ELSE |
| DO SET = D=0%%I C |
| DO SET = DB_INVAMT%%D=AMT%%D C |
| DO SET = DB_COST%%D=COST%%D C |
| DO SET = PROBLEM=' ' C |
| DO SET = PROB1=' ' C |
| IF AMT%%D NE TAMT%%D C |
| DO SET = PROBLEM=' TOTAMT' C |
| DO SET = ERRORS=ERRORS+1 C |
| IF COST%%D NE TCOST%%D C |
| DO SET = PROB1=' TOTCOST' C |
| DO SET = ERRORS=ERRORS+1 C |
| ALWAYS |
PLEASE FILL IN RULE DEFINITION. 15.37.18-
This portion of the ON block does the following:
-
-
It starts creating a variable, I, which represents the division number being processed (either 1, 2, or 3).
-
There are exactly 3 divisions to process. If I is larger than 3, all divisions have been processed and the rule can proceed to the section called FINISH.
-
-
The ON block creates a second variable D, which represents the division code that is attached to the variable names (either 01, 02, or 03).
-
When a variable name is prefixed with the string DB_, Control-M/Analyzer identifies the variable as a database variable. In this rule, variables are updated only if the rule terminates OK. The value of two database variables is set for each division:
-
DB_INVAMTxx and DB_COSTxx
-
where xx is the division code. However, until the block performs a "commit" operation on these variables, these values have not been changed in the database.
-
-
Two variables, PROBLEM and PROB1, are set to equal a blank value. These variables are used to hold error conditions, if the totals are out of balance.
-
The ON block then performs the balancing analysis to see if the invoice amount for the division value that is set for AMT%%D (which was accumulated in the ON block CHKDETL) is equal to the total invoice amount, TAMT%%D (which, in turn, was extracted from the TOTALS line in the file).
-
If these two amounts are not equal, the value set for the variable PROBLEM is set to the error message you want on the print line, replacing its previous blank value.
-
The error count is then updated.
-
-
Press PF08/PF20, or execute the DOWN command, to scroll forward once.
Figure 83 Analysis on Cost Amounts
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN04
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| IF COST%%D NE TCOST%%D C |
| DO SET = PROB1=' TOTCOST' C |
| DO SET = ERRORS=ERRORS+1 C |
| ALWAYS |
| DO PRINT = %%BLANK F C |
| DO PRINT = DIVISION TOTAL CHECK F C |
| DO PRINT = %%D SALES: CALC %%AMT%%D F C |
| DO PRINT = %%D SALES: FILE %%TAMT%%D %%PROBLEM F C |
| DO PRINT = %%D COST: CALC %%COST%%D F C |
| DO PRINT = %%D COST: FILE %%TCOST%%D %%PROB1 F C |
| DO PRINT = %%BLANK F C |
| DO SET = I=INT(I+1) C |
| DO GOTO LABEL TOTALS |
| LABEL: FINISH |
| ALWAYS |
| DO PRINT = %%BLANK F C |
| DO PRINT = ERRORS %%ERRORS TOLERABLE ERRORS %%TOLERABLES F C |
| IF ERRORS > 0 C |
| DO COMMIT = NONE VAR C |
| DO TERMINAT = NOTOK COD 0999 |
PLEASE FILL IN RULE DEFINITION. 15.38.37As you continue looking through the rule, you see the same analysis that was done for problem analysis is performed on the cost amounts.
-
Compare the accumulated total cost for each division to the total cost amount that was extracted from the file.
-
Print the calculated and extracted amounts with appropriate headings and associated error messages.
-
Now that analysis of this division's totals has been completed, add 1 to the division count.
-
Return to the beginning of the ON block, to the section called TOTAL, where the rule checks if analysis has been completed for all divisions.
-
-
Look at the last few instructions in the rule. Place the cursor on the line beginning with the character string "LABEL: FINISH," and press PF08/PF20, or execute the DOWN command.
Figure 84 LABEL: FINISH
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN04
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| LABEL: FINISH |
| ALWAYS |
| DO PRINT = %%BLANK F C |
| DO PRINT = ERRORS %%ERRORS TOLERABLE ERRORS %%TOLERABLES F C |
| IF ERRORS > 0 C |
| DO COMMIT = NONE VAR C |
| DO TERMINAT = NOTOK COD 0999 |
| IF ERRORS = 0 C |
| DO COMMIT = ALL VAR C |
| DO PRINT = DIVISIONAL FILES ARE OK. DATA BASE IS UPDATED F C |
| IF TOLERABLES > 0 C |
| DO TERMINAT = OK COD 0009 |
| IF ERRORS = 0 AND TOLERABLES = 0 C |
| DO TERMINAT = OK COD 0000 |
| =========================================================================== |
| EXECUTE CHKDETL UPON C |
| ON DATA |
| IF DIV NE 01 AND DIV NE 02 AND DIV NE 03 C |
| DO SET = PROBLEM='DIV' C |
| DO SET = ERRORS=ERRORS+1 C |
PLEASE FILL IN RULE DEFINITION. 15.39.49The LABEL: FINISH instructions
-
print the final counts of errors and tolerable errors that have been accumulated throughout the execution of the rule
-
do not commit, or update, the database variables if there were any serious errors encountered at any time during the rule execution
-
In such cases the rule terminates NOTOK, with a user code of 999.
-
-
commit all variables, meaning that Control-M/Analyzer updates the database at this time, if there were no serious errors
-
The rule then prints a confirming message that the database has been updated. The database variables that are updated are INVAMT01, INVAMT02, INVAMT03, COST01, COST02, and COST03.
-
-
terminates the rule with user code 9 if there are tolerable errors
-
terminates the rule with a user code of 0 if there are no errors
Conclusion
This concludes your examination of the rule definition. You will now take a brief look at two user reports that result as output for this rule—one where the rule executed NOTOK, and one where the rule executed OK.
There are two jobs provided in the sample JCL library, related to rule ARWARN04: RUNRULE4 and RUNRUL4A.
Job RUNRULE4
RUNRULE4 uses an input file that contains serious errors. You may submit this job and review the outputs.
Figure 85 SYSUSER Report from RUNRULE4
INTRAC DAILY DIVISIONAL INVOICE ANALYSIS
FOR 000904
-- ------- -------- ------- ------- --------- ---------
DV CUST CUST# INV # DATE AMOUNT PROBLEM
-- ------- -------- ------- ------- --------- ---------
01 TERRANO 1TER001 CJ39398 030800 945245.00 AMT
02 SWANSON 2SWA001 MJ24545 040700 10987.55 DATE
02 ALBANAN 2ALB001 MJ24563 040800 110300.00 AMT-WRN
02 TRANKLE 2TRA002 BJ24572 040800 500.00 DATE
04 DURKENS 3DUR001 ZZ10906 040800 275000.00 DIV
DIVISION TOTAL CHECK
01 SALES: CALC 978365.250
01 SALES: FILE 978365.25
01 COST: CALC 938455.000
01 COST: FILE 901000.00
DIVISION TOTAL CHECK
02 SALES: CALC 679025.520
02 SALES: FILE 679025.52
02 COST: CALC 541873.000
02 COST: FILE 541873.00
DIVISION TOTAL CHECK
03 SALES: CALC 293764.810
03 SALES: FILE 293564.81
03 COST: CALC 264202.000
03 COST: FILE 264202.00
ERRORS 6.00 TOLERABLE ERRORS 1.000
In this report, because there were serious errors resulting in condition NOTOK, no database update occurred. There were several problems with the input file, including:
-
amounts that were intolerable
-
an invoice date with the wrong month
-
an invoice date with the wrong year
-
a record with a division code of 04.
One tolerable error produced a warning message on the amount.
When checking divisional totals in the ENDJOB block, two more serious errors were found—calculated total cost for division 01, and total invoice amount for division 03, were not in agreement with the file amounts.
Job RUNRUL4A
RUNRUL4A is almost identical to RUNRULE4 except that it uses a file with no serious error conditions. You may submit this job now and review the output.
Figure 86 SYSUSER Report from RUNRUL4A
INTRAC DAILY DIVISIONAL INVOICE ANALYSIS
FOR 000904
-- ------- -------- ------- ------- --------- ---------
DV CUST CUST# INV # DATE AMOUNT PROBLEM
-- ------- -------- ------- ------- --------- ---------
01 TERRANO 1TER001 CJ39398 030800 345245.00 AMT-WRN
02 ALBANAN 2ALB001 MJ24563 040800 110300.00 AMT-WRN
DIVISION TOTAL CHECK
01 SALES: CALC 378365.250
01 SALES: FILE 378365.25
01 COST: CALC 338455.000
01 COST: FILE 338455.00
DIVISION TOTAL CHECK
02 SALES: CALC 679025.520
02 SALES: FILE 679025.52
02 COST: CALC 541873.000
02 COST: FILE 541873.00
DIVISION TOTAL CHECK
03 SALES: CALC 368764.810
03 SALES: FILE 368764.81
03 COST: CALC 319302.000
03 COST: FILE 319302.00
ERRORS 0 TOLERABLE ERRORS 2.000
DIVISIONAL FILES ARE OK. DATA BASE IS UPDATED
-
This report, from RUNRUL4A, indicates no serious errors, although you did receive two warning messages.
-
As noted, the file is declared OK and the database has been updated.
You can now exit this rule and proceed to the next problem.
Problem 5: Check Weekly Database Amounts
One of the INTRAC managers just said, "Now our invoices are in balance. But you have a problem with profits. Every month one of our divisions is doing poorly." The manager wondered if Control-M/Analyzer could be used, not just as a data quality control tool, but also as an early warning system to management.
Problem
Each day, as the invoices from each division are processed, the Control-M/Analyzer database is updated with divisional totals for invoice amounts and costs. However, even when daily invoice amounts are balanced and meet the daily criteria, there can be problems that show up only over a period of time. For example, it may be valid for a division to have a very small amount invoiced on a given day. However, if this situation continued for a week, this would be very abnormal.
INTRAC has two problems in this situation:
-
No one at INTRAC has ever defined weekly "reasonableness" criteria for invoice and cost amounts.
-
The INTRAC executives suspect that from time to time there are problems with both the volume, or total dollar amount, of invoices, and with the profit margins of each of the divisions.
Solution — Overview
The head of ISD has met with the executives and determined the following guidelines:
-
Weekly sales for Division 01 must be at least $2,000,000.
-
Weekly sales for Division 02 must be at least $3,000,000.
-
Weekly sales for Division 03 must be at least $600,000.
-
Weekly profit margin for Division 01 must be at least 15%.
-
Weekly profit margin for Division 02 must be at least 20%.
-
Weekly profit margin for Division 03 must be at least 38%.
-
Profit margin = (Sales - Cost of Sales) * 100 / Sales
Since these are new guidelines being tried for the first time, you have been asked to ensure that they are easy to change.
Solution – Details
In this Control-M/Analyzer solution, the rule
-
accumulates weekly sales and costs, by division, by retrieving these amounts from various generations in the database
-
calculates margins for each division
-
analyzes weekly sales and margins by division, and reports these amounts and any abnormal situations
-
ends OK or NOTOK, depending on errors found
In this rule, you will learn how to refer to and access various generations of data from the database.
Opening Rule ARWARN05
-
Select rule ARWARN05 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.
-
The rule consists of the following three blocks:
-
INIT – Sets initial values for the variables that accumulate weekly totals. Also initializes an error counter and a blank, for printing blank lines.
-
ACCUMSLS – Accumulates weekly sales and cost amounts and calculates margins for each division.
-
CHECK – Checks the sales and margins for each division, prints the data with relevant problem messages, and terminates the rule accordingly.
Figure 87 Rule ARWARN05
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN05
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| OWNER M66 GROUP INTRAC |
| UPDATED 11/09/99 - 11:53:49 BY M66 |
| DESC CHECK WEEKLY SALES AND COST OF SALES AMOUNTS |
| OPTIONS |
| =========================================================================== |
| EXECUTE INIT UPON C |
| ON DATA |
| LABEL: SETVARS |
| ALWAYS |
| DO SET = WEEKSALES01=0 C |
| DO SET = WEEKSALES02=0 C |
| DO SET = WEEKSALES03=0 C |
| DO SET = WEEKCOST01=0 C |
| DO SET = WEEKCOST02=0 C |
| DO SET = WEEKCOST03=0 C |
| DO SET = CTR1=0 C |
| DO SET = BLANK=' ' C |
| =========================================================================== |
| EXECUTE ACCUMSLS UPON C |
| ON DATA |
PLEASE FILL IN RULE DEFINITION. 15.43.46
-
-
In the first ON block, look at the LABEL: SETVARS section; note the first six variables that are initialized with DO SET actions—from WEEKSALES01 through WEEKCOST3. These variables are used for accumulating weekly invoice and cost amounts.
-
Now examine the second ON block, called ACCUMSLS. Place the cursor in the COMMAND field and press PF08/PF20, or execute the DOWN command.
Figure 88 LABEL ACCUM in the ACCUMSLS ON Block
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN05
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| LABEL: ACCUM |
| ALWAYS |
| DO SET = WEEKSALES01=WEEKSALES01 + DB_INVAMT01@G%%CTR1 C |
| DO SET = WEEKSALES02=WEEKSALES02 + DB_INVAMT02@G%%CTR1 C |
| DO SET = WEEKSALES03=WEEKSALES03 + DB_INVAMT03@G%%CTR1 C |
| DO SET = WEEKCOST01=WEEKCOST01 + DB_COST01@G%%CTR1 C |
| DO SET = WEEKCOST02=WEEKCOST02 + DB_COST02@G%%CTR1 C |
| DO SET = WEEKCOST03=WEEKCOST03 + DB_COST03@G%%CTR1 C |
| DO SET = CTR1=INT(CTR1+1) C |
| IF CTR1<5 C |
| DO GOTO LABEL ACCUM |
| =========================================================================== |
| EXECUTE CHECK UPON C |
| ON DATA |
| ALWAYS |
| DO SET = MARGIN1=(WEEKSALES01-WEEKCOST01)/WEEKSALES01 C |
| DO SET = MARGIN2=(WEEKSALES02-WEEKCOST02)/WEEKSALES02 C |
| DO SET = MARGIN3=(WEEKSALES03-WEEKCOST03)/WEEKSALES03 C |
| IF WEEKSALES01 < 2000000 C |
| DO SET = PROBLEM01='SALES BELOW TARGET' C |
PLEASE FILL IN RULE DEFINITION. 15.44.57 -
Look at the first DO SET instruction in this ON block.
-
It sets variable WEEKSALES01 equal to the sum of the variables WEEKSALES01 and DB_INVAMT01@G%%CTR1.
-
When the rule started, variable WEEKSALES01 was initialized to 0.
-
The expression DB_INVAMT01@G%%CTR1 is defined as follows:
-
The string DB_INVAMT01 indicates that the variable INVAMT01 in the database is being referenced.
-
The @G symbol indicates a specific generation of variable INVAMT01 is being referenced. The string %%CTR1 is the generation of the variable being referred to by the @G symbol.
-
When the rule started, %%CTR1 was set to 0.
-
The expression DB_INVAMT01@G%%CTR1, therefore, refers to the value of generation 0 of database variable INVAMT01.
-
Each day, as INVAMT01 is updated from the daily invoice total for Division1, as set forth in the explanation of rule ARWARN04 in the section describing Problem 4, a new generation of INVAMT01 is created. The most recent generation of INVAMT01 is always generation 0. The next most recent generations are generations 1, 2, and so on.
-
-
Now examine the entire ACCUM procedure, shown in Figure 88. The rule selects the five most recent generations of each of the database variables, representing the most recent data for the week, as follows:
-
The rule first adds the value of generation 0 of each of the database variables into WEEKSALES01, WEEKSALES02, and so on.
-
The rule then adds 1 to the counter, CTR1, which represents the generation number.
-
If CTR1 is less than 5, it returns to LABEL: ACCUM to calculate another day’s worth of values. If CTR1 is greater than or equal to 5, meaning that all the figures for the week have been accumulated, the rule proceeds to accumulate margins based on these figures.
-
After calculating margins, the rule begins the analysis on all the figures.
-
Examining the Balancing Checks of the ON Block EXECUTE ACCUMSLS
-
-
Place the cursor on the line beginning with the string "IFWEEKSALES01=," and press PF08/PF20, or enter the DOWN command.
Figure 89 Balancing Checks of the ON Block EXECUTE ACCUMSLS
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN05
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| IF WEEKSALES01 < 2000000 C |
| DO SET = PROBLEM01='SALES BELOW TARGET' C |
| DO SET = CTR1=999 C |
| ELSE |
| DO SET = PROBLEM01=BLANK C |
| IF WEEKSALES02 < 3000000 C |
| DO SET = PROBLEM02='SALES BELOW TARGET' C |
| DO SET = CTR1=999 C |
| ELSE |
| DO SET = PROBLEM02=BLANK C |
| IF WEEKSALES03 < 600000 C |
| DO SET = PROBLEM03='SALES BELOW TARGET' C |
| DO SET = CTR1=999 C |
| ELSE |
| DO SET = PROBLEM03=BLANK C |
| IF MARGIN1 < 0.15 C |
| DO SET = PROBLEM04='MARGIN BELOW TARGET' C |
| DO SET = CTR1=999 C |
| ELSE |
| DO SET = PROBLEM04=BLANK C |
PLEASE FILL IN RULE DEFINITION. 15.46.10-
This group of IF statements performs the balancing checks for the accumulated amounts, in the following basic pattern:
-
-
Tests the accumulated amount to see if it breaks the rule. For example, the first IF statement is IF WEEKSALES01 < 2000000.
-
If the amount is in error, that is, if the first IF statement is less than 2000000
-
set an error message for later printing, in the first case "SALES BELOW TARGET", and
-
set the variable CTR1 to 999
-
999 in all these IF statements indicates that one or more of the rules has been broken. Later, this will be used to terminate the rule NOTOK.
-
-
If the test is OK, that is, if it is greater than the target, set the error message to blank.
-
Press PF08/PF20, or enter the DOWN command, to scroll forward one screen to examine the remainder of these balancing checks.
Figure 90 Last Balancing Checks of the ON Block EXECUTE ACCUMSL
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN05
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| DO SET = PROBLEM03=BLANK C |
| IF MARGIN1 < 0.15 C |
| DO SET = PROBLEM04='MARGIN BELOW TARGET' C |
| DO SET = CTR1=999 C |
| ELSE |
| DO SET = PROBLEM04=BLANK C |
| IF MARGIN2 < 0.2 C |
| DO SET = PROBLEM05='MARGIN BELOW TARGET' C |
| DO SET = CTR1=999 C |
| ELSE |
| DO SET = PROBLEM05=BLANK C |
| IF MARGIN3 < 0.38 C |
| DO SET = PROBLEM06='MARGIN BELOW TARGET' C |
| DO SET = CTR1=999 C |
| ELSE |
| DO SET = PROBLEM06=BLANK C |
| ALWAYS |
| DO PRINT = INTRAC WEEKLY INVOICE ANALYSIS F C |
| DO PRINT = FOR %%SYSDATE F C |
| DO PRINT = %%BLANK F C |
PLEASE FILL IN RULE DEFINITION. 15.47.07 -
After examining all the balancing checks, scroll forward once more to the end of this rule by pressing PF08/PF20, or entering the DOWN command.
Figure 91 End of Rule ARWARN05
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN05
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| ELSE |
| DO SET = PROBLEM06=BLANK C |
| ALWAYS |
| DO PRINT = INTRAC WEEKLY INVOICE ANALYSIS F C |
| DO PRINT = FOR %%SYSDATE F C |
| DO PRINT = %%BLANK F C |
| DO PRINT = SALES OF DIV 1 - %%WEEKSALES01 %%PROBLEM01 F C |
| DO PRINT = SALES OF DIV 2 - %%WEEKSALES02 %%PROBLEM02 F C |
| DO PRINT = SALES OF DIV 3 - %%WEEKSALES03 %%PROBLEM03 F C |
| DO PRINT = %%BLANK F C |
| DO PRINT = MARGIN OF DIV 1 - %%MARGIN1 %%PROBLEM04 F C |
| DO PRINT = MARGIN OF DIV 2 - %%MARGIN2 %%PROBLEM05 F C |
| DO PRINT = MARGIN OF DIV 3 - %%MARGIN3 %%PROBLEM06 F C |
| IF CTR1=999 C |
| DO TERMINAT = NOTOK COD 0099 |
| ELSE |
| DO TERMINAT = OK COD 0000 |
| =========================================================================== |
| EXECUTE UPON C |
| ON |
PLEASE FILL IN RULE DEFINITION. 15.47.56
After the rule performs all checks, it prints the balancing report.
Look at any problems that are encountered are referred to by using the variable names PROBLEM01, PROBLEM02, and so on, in each print line.
The rule terminates either OK or NOTOK, depending on the value of CTR1. As defined earlier, if any errors are encountered, variable CTR1 is set to 999.
Conclusion
-
You may now submit job RUNRULE5 and review the SYSUSER report.
Figure 92 SYSUSER Report from RUNRULE5
CopyINTRAC WEEKLY INVOICE ANALYSIS
FOR 000924
SALES OF DIV 1 - 1659125.250 SALES BELOW TARGET
SALES OF DIV 2 - 3110109.520
SALES OF DIV 3 - 33589357.810
MARGIN OF DIV 1 - -0.114 MARGIN BELOW TARGET
MARGIN OF DIV 2 - 0.202
MARGIN OF DIV 3 - 0.642-
The figures in the report which you produce may vary, depending on how often the demonstration rules have been run in your installation.
-
-
You can now exit this rule and proceed to the next problem.
Problem 6: Balance Monthly Commissions
The INTRAC ISD manager has asked for one last balancing job to be performed—a detailed review of the monthly commissions report.
Problem
Every month, the payroll department receives many adjustments from the sales operations department relating to salesperson commissions, as referred to in Problem 2. Salespeople and sales managers have been complaining to the executives of INTRAC that they do not trust the detailed sales commissions report. They believe that there may be several problems, and feel that
-
detailed invoice amounts do not equal the total reported sales
-
reported commissions owed do not equal total sales multiplied by a commission percentage
-
the reported payroll amount, which is the amount to be paid this month, does not equal YTD commissions owed minus YTD commissions paid
Unlike the report that was prepared in Problem 2, the sales management needs a balancing report that shows salesperson names. They need this report to review it with their salespeople.
Solution — Overview
The payroll department will employ a Control-M/Analyzer rule to audit every line of the Sales Commission Detail report, for the purpose of checking the problems reported above. They have designed a report that will summarize the reported amounts and calculated amounts. Having reviewed the report with the sales managers and received agreement from them, you are ready to write the rule.
Solution – Details
The rule consists of the following four ON blocks:
-
INIT – initializes values of variables which are used in the rule
-
INPUT – extracts data from the report
-
CHKNAME – establishes a table of salesperson numbers
-
FINISH – analyzes all the data in a table, prints the balancing report, and terminates the job
In this rule, you will
-
use the STOP and AND parameters of a WHEN clause to force Control-M/Analyzer to look for combinations of conditions in a report, before extracting data
-
set up and process a table of variables
Examine this rule online. Proceed to the Rule Definition facility, to the Rule List screen.
-
Select rule ARWARN06 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 93 Rule ARWARN06
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN06
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| OWNER M66 GROUP INTRAC |
| UPDATED 03/04/99 - 15:30:05 BY M66 |
| DESC CHECK MONTH SALES COMMISSIONS REPORT |
| OPTIONS |
| =========================================================================== |
| EXECUTE INIT UPON C |
| ON DATA |
| ALWAYS |
| DO SET = TOTPEOPLE=0 C |
| DO SET = LASTSALES=' ' C |
| 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 - 005 COL 002 - 014 STOP Y AND/OR A |
| STRING = SALESPERSON |
| STOP LINE 001 - 002 COL 001 - 020 |
| STRING = INTRAC |
PLEASE FILL IN RULE DEFINITION. 15.50.49 -
In the INIT ON block, two variables, TOTPEOPLE and LASTSALES, process a table containing each salesperson's relevant amounts from the report. These variables are discussed later in these instructions.
-
In the next ON block, INPUT extracts data from the report.
-
-
Place the cursor on the line beginning with the character string "EXECUTE INPUT," and press PF08/PF20, or enter the DOWN command.
Figure 94 EXECUTE INPUT ON Block
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN06
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| OWNER M66 GROUP INTRAC |
| UPDATED 03/04/99 - 15:30:05 BY M66 |
| DESC CHECK MONTH SALES COMMISSIONS REPORT |
| OPTIONS |
| =========================================================================== |
| EXECUTE INIT UPON C |
| ON DATA |
| ALWAYS |
| DO SET = TOTPEOPLE=0 C |
| DO SET = LASTSALES=' ' C |
| 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 - 005 COL 002 - 014 STOP Y AND/OR A |
| STRING = SALESPERSON |
| STOP LINE 001 - 002 COL 001 - 020 |
| STRING = INTRAC |
PLEASE FILL IN RULE DEFINITION. 15.50.49
Compound WHEN Statements
This ON block uses compound WHEN statements to locate certain sections of the report. The first compound WHEN statement performs the following actions:
-
It locates the string "SALESPERSON."
-
Whenever this string is found, the second WHEN statement searches for the string "/" on every subsequent line.
-
Every time the string "/" is found, the DO actions are performed. Because for third DO action the TYPE parameter is set to SU, the rule automatically totals the amount field found in columns 68 through 78, into a variable called SUM1%%SALESNO.
-
>The DO actions are stopped. The ON block searches again for the string, "SALESPERSON." When it finds the string, "INTRAC," in lines 1through2, this indicates a new page of the report.
-
Why was a compound WHEN structure used for this operation?
-
To access the different sections of the report from which to extract data, the rule needs to uniquely identify those sections. For example, the rule may be searching for the string "/" but there may be sections of the report where you do not want to extract any data. This can be done using WHEN statements, which enable the rule to easily extract data from different areas of the report, without requiring that each section have a fixed number of lines.
-
Examine how this is done by looking at a sample page from the report:
Figure 95 Sample Page of the Sales Operations Department Report
CopyINTRAC INC. SALES OPERATIONS DEPARTMENT DATE 09/12/00 TIME 23:50 PAGE 1
S A L E S C O M M I S S I O N S D E T A I L FROM 01/01/00 TO 01/12/00
| SALESPERSON HARVEY J. JONES (197) | INVOICE # | INVOICE DATE | AMOUNT | STATUS
+-----------------------------------------------------------------------------------------------------------
| | CJ39D94 | 02/02/00 | 2040.00 |COLLECTION |
| | CJ98443 | 03/03/00 | 245.00 | |
| | MJ24545 | 04/04/00 | 10344.40 | |
| | RJ10030 | 01/02/00 | 5329.39 | |
| | RJ12233 | 02/02/00 | 5000.00 | |
| | RJ30021 | 03/02/00 | 16670.10 | |
| | RJ32991 | 02/03/00 | 30300.44 | |
| | RJ33939 | 03/03/00 | 900.25 | |
| | RJ38001 | 04/04/00 | 1000.23 | |
| | RJ93043 | 04/04/00 | 415.89 | |
|+-----------------------------------------------------------------------------------------------------------
TOTAL SALES - THIS MONTH 72245.70 | PAID IN FULL|
ADJUSTMENTS -5800.70
YTD SALES (INCLUDING THIS MONTH) -127879.00
YTD COMMISSIONS PAID 0.00
YTD COMMISSIONS OWED -5115.00
COMMISSION PAYROLL AMOUNT 5115.00 - Find the line with the salesperson named "Harvey J. Jones," and number "197." Because this line was found as a result of the first WHEN parameter specified, this is called a LEVEL 1 line.
-
Look at the DO EXTRACT statements shown in Figure 94, and see how the first DO EXTRACT statement (LEVEL 1) is specified to extract the salesperson number (SALESNO). The next WHEN statement within a compound WHEN grouping would point to a LEVEL 2 line, and any other WHEN statements would point to LEVEL 3, LEVEL 4, and so on.
For the salesperson Harvey J. Jones, the rule processes all detail lines that are identified with a "/" between columns 50 through 60. Because these were found as a result of the second WHEN statement in the compound WHEN parameter, it is called a LEVEL 2 line.
Because this WHEN statement is also the last WHEN statement in the compound WHEN grouping, it is also referred to as a LEVEL 0 line. LEVEL 0 always refers to the last WHEN statement specified within a compound WHEN grouping.
As defined in the compound WHEN grouping, the number of lines of data between the LEVEL 1 line (SALESNO) and the LEVEL 0 or LEVEL 2 ("/") line may vary. That is, there can be any number of lines of data for Harvey J. Jones until the rule encounters the next SALESNO in the data it is searching.
Also, any other lines of the report that coincidentally contain a "/" character, such as the top two lines of the report, are not processed as detail lines for Harvey J. Jones because they are not preceded by a LEVEL 1 line containing the character string "SALESPERSON."
-
-
The rule searches for LEVEL 0 lines until a line containing the string "INTRAC" is found (see the top of the sample report).
-
Now look at the next compound grouping of WHEN parameters. Place the cursor on the line beginning with the character string "WHEN LINE 005" and press PF08/PF20, or enter the DOWN command.
Figure 96 Second Compound Grouping of WHEN Parameters
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN06
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| WHEN LINE 005 - 005 COL 002 - 014 STOP Y AND/OR A |
| STRING = SALESPERSON |
| STOP LINE 001 - 002 COL 001 - 020 |
| STRING = INTRAC |
| WHEN LINE 001 - 060 COL 001 - 020 STOP AND/OR |
| STRING = TOTAL SALES |
| DO EXTRACT = SALESNO |
| LEVEL 1 LINE +000 COL 0035 - 0037 PROCESS TYP |
| DO EXTRACT = NAME%%SALESNO |
| LEVEL 1 LINE +000 COL 0017 - 0033 PROCESS TYP |
| DO EXTRACT = MTHSLS%%SALESNO |
| LEVEL 0 LINE +000 COL 0068 - 0078 PROCESS TYP |
| DO EXTRACT = YTDSLS%%SALESNO |
| LEVEL 0 LINE +002 COL 0068 - 0078 PROCESS TYP |
| DO EXTRACT = YTDCOM%%SALESNO |
| LEVEL 0 LINE +003 COL 0068 - 0078 PROCESS TYP |
| DO EXTRACT = YTDOWE%%SALESNO |
| LEVEL 0 LINE +004 COL 0068 - 0078 PROCESS TYP |
| DO EXTRACT = PAYAMT%%SALESNO |
| LEVEL 0 LINE +005 COL 0068 - 0078 PROCESS TYP |
PLEASE FILL IN RULE DEFINITION. 15.54.04-
The WHEN statement locates the string "SALESPERSON."
-
Whenever the string "SALESPERSON" is found, the WHEN statement searches on every subsequent line for the string, "TOTAL SALES."
-
Every time the "TOTAL SALES" string is found, the WHEN statement performs the DO actions. Each time a value is extracted from the report, the salesperson number becomes part of the variable name. The result is a series of variables with names as follows:
Copy--------------------------- Salesperson -------------------------
1 2 3
NAME197 NAME101 NAME177
MTHSLS197 MTHSLS101 MTHSLS177
YTDSLS197 YTDSLS101 YTDSLS177
YTDCOM197 YTDCOM101 YTDCOM177
YTDOWE197 YTD0WE101 YTDOWE177
PAYAMT197 PAYAMT101 PAYAMT177 -
Each of these variables contains data extracted from the report.
-
The DO actions are stopped. The ON block searches again for the string "SALESPERSON" when it finds the string INTRAC in lines 1through2, indicating a new page of the report.
-
The ON block CHKNAME is called (see Figure 94 EXECUTE INPUT ON Block) for each detail line being processed. Now examine what the ON block CHKNAME does.
-
Examining the ON Block CHKNAME
-
Scroll forward to the bottom of the rule by pressing PF08/PF20, or by entering the DOWN command.
Figure 97 ON Block CHKNAME
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN06
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| DO PRINT = ***** SERIOUS COMMISSION ERRORS ***** F C |
| DO PRINT = ***** TOTAL NUMBER OF ERRORS %%ERRORCOUNT ***** F C |
| DO TERMINAT = NOTOK COD 0999 |
| ELSE |
| DO PRINT = %%BLANK F C |
| DO PRINT = %%BLANK F C |
| DO TERMINAT = OK COD 0000 |
| =========================================================================== |
| EXECUTE CHKNAME UPON C |
| ON DATA |
| IF SALESNO NE LASTSALES C |
| DO SET = TOTPEOPLE=INT(TOTPEOPLE+1) C |
| DO SET = NUMBER%%TOTPEOPLE=SALESNO C |
| DO SET = LASTSALES=SALESNO C |
| =========================================================================== |
| EXECUTE UPON C |
| ON |
======= >>>>>>>>>>>>>>> END OF RULE DEFINITION PARAMETERS <<<<<<<<<<<<<<< =====
PLEASE FILL IN RULE DEFINITION. 15.55.43-
This ON block is only performed when the salesperson number has changed during processing of the rule. The variable, SALESNO, is the actual salesperson number that is extracted from the LEVEL 1 line on the report. LASTSALES is a variable that stores the salesperson number whenever processing begins for a new salesperson.
-
CHKNAME performs the following actions:
-
-
Adds 1 to the count of the number of salespeople, tracked in variable TOTPEOPLE.
-
Creates a table of salesperson numbers, which will be used later. The table, in its final form, will appear as follows:
CopyVariable Name Contents
NUMBER1 197
NUMBER2 101
NUMBER3 177 -
Because this is now a new salesperson being processed, set the variable LASTSALES equal to the new salesperson number.
-
Examining the ON Block FINISH
-
After processing the report, the rule proceeds to the next sequential ON block, FINISH, which contains most of the balancing parameters.
-
-
Scroll backward using PF07/PF19, or by entering the UP command, until you see the ON block FINISH on the screen.
-
Place the cursor on the line beginning with the character string "EXECUTE FINISH," and press PF08/PF20, or enter the DOWN command.
Figure 98 ON Block FInish
LIBRARY : CTB.PROD.RULES RULE : ARWARN06
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| EXECUTE FINISH UPON C |
| ON DATA |
| ALWAYS |
| DO SET = I=1 C |
| DO PRINT = TOTAL # OF SALESPEOPLE=%%TOTPEOPLE F C |
| DO PRINT = %%BLANK F C |
| LABEL: TEST |
| IF I GT TOTPEOPLE C |
| DO GOTO LABEL ENDJOB |
| ELSE |
| DO PRINT = **** COMMISSION CONTROL - %%NAME%%NUMBER%%I **** F C |
| DO PRINT = REPORTED SALES %%MTHSLS%%NUMBER%%I F C |
| DO PRINT = CALCULATED SALES %%SUM1%%NUMBER%%I F C |
| DO PRINT = -------------------------------------------- F C |
| DO SET = DIFF1=ABS(SUM1%%NUMBER%%I-MTHSLS%%NUMBER%%I) C |
| DO PRINT = DIFFERENCE %%DIFF1 F C |
| DO PRINT = -------------------------------------------- F C |
| DO SET = COMMCALC=YTDSLS%%NUMBER%%I*0.04 C |
| DO PRINT = REPORTED COMMISSIONS OWED %%YTDOWE%%NUMBER%%I F C |
| DO PRINT = CALCULATED COMMISSIONS OWED %%COMMCALC F C |
PLEASE FILL IN RULE DEFINITION. 15.56.18
The FINISH block is defined as follows:
-
At the beginning of the FINISH block, variable "I" is set to the value 1. This variable keeps track of which salesperson's data, taken from the table of salesperson numbers created in CHKNAME, is being currently analyzed and reported.
-
The section of this block called LABEL: TEST checks whether all salespeople have been processed.
-
Because the report covers three salespeople in total, the variable TOTPEOPLE was set to 3 in the ON block CHKNAME. When the variable I, used to identify the salesperson on which you are currently working, is greater than 3, processing continues with the section in this ON block labelled ENDJOB.
-
Otherwise, the rule proceeds to analyze and report on the current salesperson's data, which has been stored previously in the table of salesperson number.
-
The remainder of the rule definition contains parameters that you learned in previous Problems.
Conclusion
With the next series of screens and report outputs (SYSUSER), you can compare the instructions in rule ARWARN06 to the output report produced.
Further explanation of rule definition parameters is available in the Control-M/Analyzer for z/OS User Guide.
-
You may use the RUNRULE6 job in the JCL library to run this rule, which produces the following output:
Figure 99 Sample Output Produced by the RUNRULE6 Job
CopyTOTAL # OF SALESPEOPLE=3
**** COMMISSION CONTROL - HARVEY J. JONES ****
REPORTED SALES 72245.70
CALCULATED SALES 72245.700
-------------------------------------------
DIFFERENCE 0.000
-------------------------------------------
REPORTED COMMISSIONS OWED -5115.00
CALCULATED COMMISSIONS OWED -5115.160
-------------------------------------------
DIFFERENCE 0.160
-------------------------------------------
REPORTED PAYROLL AMOUNT 5115.00
CALCULATED PAYROLL AMOUNT -5115.160
-------------------------------------------
DIFFERENCE ***** PROBLEM ***** 10230.160
-------------------------------------------
***** SERIOUS COMMISSION ERRORS - SEE ABOVE ***** -
If rule ARWARN06 is not already, open it now.
-
Place the cursor on the line in rule ARWARN06 that begins with the string EXECUTE FINISH UPON, and press PF08/PF20, or enter the DOWN command, to display that line at the top of the screen.
Figure 100 Rule ARWARN06 EXECUTE FINISH Block (Display 1)
CopyLIBRARY : CTBP.PROD.RULES RULE : ARWARN06
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| EXECUTE FINISH UPON C |
| ON DATA |
| ALWAYS |
| DO SET = I=1 C |
| DO PRINT = TOTAL # OF SALESPEOPLE=%%TOTPEOPLE F C |
| DO PRINT = %%BLANK F C |
| LABEL: TEST |
| IF I GT TOTPEOPLE C |
| DO GOTO LABEL ENDJOB |
| ELSE |
| DO PRINT = **** COMMISSION CONTROL - %%NAME%%NUMBER%%I **** F C |
| DO PRINT = REPORTED SALES %%MTHSLS%%NUMBER%%I F C |
| DO PRINT = CALCULATED SALES %%SUM1%%NUMBER%%I F C |
| DO PRINT = -------------------------------------------- F C |
| DO SET = DIFF1=ABS(SUM1%%NUMBER%%I-MTHSLS%%NUMBER%%I) C |
| DO PRINT = DIFFERENCE %%DIFF1 F C |
| DO PRINT = -------------------------------------------- F C |
| DO SET = COMMCALC=YTDSLS%%NUMBER%%I*0.04 C |
| DO PRINT = REPORTED COMMISSIONS OWED %%YTDOWE%%NUMBER%%I F C |
| DO PRINT = CALCULATED COMMISSIONS OWED %%COMMCALC F C |
PLEASE FILL IN RULE DEFINITION. 10.38.50
The code shown in this screen produced the following lines of the report:
TOTAL # OF SALESPEOPLE=3
**** COMMISSION CONTROL - HARVEY J. JONES **** -
Place the cursor on the line in rule ARWARN06 that begins with the string DO SET = COMMCALC=YTDSLS%%NUMBER%%I*0.04 and press PF08/PF20, or enter the DOWN command, to display that line at the top of the screen.
Figure 101 Rule ARWARN06 EXECUTE FINISH Block (Display 2)
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN06
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| DO SET = COMMCALC=YTDSLS%%NUMBER%%I*0.04 C |
| DO PRINT = REPORTED COMMISSIONS OWED %%YTDOWE%%NUMBER%%I F C |
| DO PRINT = CALCULATED COMMISSIONS OWED %%COMMCALC F C |
| DO SET = DIFF2=ABS(COMMCALC-YTDOWE%%NUMBER%%I) C |
| DO PRINT = -------------------------------------------- F C |
| DO PRINT = DIFFERENCE %%DIFF2 F C |
| DO PRINT = -------------------------------------------- F C |
| DO SET = PAYCALC=COMMCALC-YTDCOM%%NUMBER%%I C |
| DO PRINT = REPORTED PAYROLL AMOUNT %%PAYAMT%%NUMBER%%I F C |
| DO PRINT = CALCULATED PAYROLL AMOUNT %%PAYCALC F C |
| DO SET = DIFF3=ABS(PAYCALC-PAYAMT%%NUMBER%%I) C |
| DO PRINT = -------------------------------------------- F C |
| IF DIFF3 = 0 C |
| DO PRINT = DIFFERENCE %%DIFF3 F C |
| ELSE |
| DO PRINT = DIFFERENCE ***** PROBLEM ***** %%DIFF3 F C |
| DO PRINT = -------------------------------------------- F C |
| DO PRINT = %%BLANK F C |
| IF DIFF1 > 100 OR DIFF2 > 100 OR DIFF3 > 100 C |
| DO SET = ERRORCOUNT=ERRORCOUNT+1 C |
PLEASE FILL IN RULE DEFINITION. 17.36.48
The code shown in this screen produced the following lines of the report:
REPORTED COMMISSIONS OWED -5115.00
CALCULATED COMMISSIONS OWED -5115.160
-------------------------------------------
DIFFERENCE 0.160
-------------------------------------------
REPORTED PAYROLL AMOUNT 5115.00
CALCULATED PAYROLL AMOUNT -5115.160
-------------------------------------------
DIFFERENCE ***** PROBLEM ***** 10230.160 -
Place the cursor on the line in rule ARWARN06 that begins with the string IF DIFF1 > 100 OR DIFF2 > 100 OR DIFF3 > 100 and press PF08/PF20, or enter the DOWN command, to display that line at the top of the screen.
Figure 102 Rule ARWARN06 EXECUTE FINISH Block (Display 3)
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN06
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| IF DIFF1 > 100 OR DIFF2 > 100 OR DIFF3 > 100 C |
| DO SET = ERRORCOUNT=ERRORCOUNT+1 C |
| DO PRINT = ***** SERIOUS COMMISSION ERRORS - SEE ABOVE ***** F C |
| DO PRINT = %%BLANK F C |
| DO PRINT = %%BLANK F C |
| ELSE |
| DO PRINT = %%BLANK F C |
| ALWAYS |
| DO SET = I=INT(I+1) C |
| DO GOTO LABEL TEST |
| LABEL: ENDJOB |
| IF ERRORCOUNT>0 C |
| DO PRINT = %%BLANK F C |
| DO PRINT = %%BLANK F C |
| DO PRINT = ***** SERIOUS COMMISSION ERRORS ***** F C |
| DO PRINT = ***** TOTAL NUMBER OF ERRORS %%ERRORCOUNT ***** F C |
| DO TERMINAT = NOTOK COD 0999 |
| ELSE |
| DO PRINT = %%BLANK F C |
| DO PRINT = %%BLANK F C |
PLEASE FILL IN RULE DEFINITION. 17.41.15
The code shown in this screen produced the following line of the report:
***** SERIOUS COMMISSION ERRORS - SEE ABOVE ***** -
After analyzing and printing the balancing report for one salesperson, the counter, I, is incremented by 1. This variable is used to signify the salesperson number. Processing then goes back to the label TEST, where the rule checks if it has processed all of the data for all salespeople. If yes, processing continues with ENDJOB.
-
Place the cursor on the line in rule ARWARN06 that begins with the string LABEL: ENDJOB and press PF08/PF20, or enter the DOWN command, to display that line at the top of the screen.
Figure 103 Rule ARWARN06 LABEL: ENDJOB
CopyLIBRARY : CTB.PROD.RULES RULE : ARWARN06
COMMAND ===> SCROLL===> CRSR
+---------------------------------- BROWSE -----------------------------------+
| LABEL: ENDJOB |
| IF ERRORCOUNT>0 C |
| DO PRINT = %%BLANK F C |
| DO PRINT = %%BLANK F C |
| DO PRINT = ***** SERIOUS COMMISSION ERRORS ***** F C |
| DO PRINT = ***** TOTAL NUMBER OF ERRORS %%ERRORCOUNT ***** F C |
| DO TERMINAT = NOTOK COD 0999 |
| ELSE |
| DO PRINT = %%BLANK F C |
| DO PRINT = %%BLANK F C |
| DO TERMINAT = OK COD 0000 |
| =========================================================================== |
| EXECUTE CHKNAME UPON C |
| ON DATA |
| IF SALESNO NE LASTSALES C |
| DO SET = TOTPEOPLE=INT(TOTPEOPLE+1) C |
| DO SET = NUMBER%%TOTPEOPLE=SALESNO C |
| DO SET = LASTSALES=SALESNO C |
| =========================================================================== |
| EXECUTE UPON C |
PLEASE FILL IN RULE DEFINITION. 17.43.56-
The code shown in this screen produced the following lines of the report and terminates the job, depending on the results.
Figure 104 Sample Output Produced by LABEL: ENDJOB
Copy**** COMMISSION CONTROL - ALI MCGRATH ****
REPORTED SALES 15000.00
CALCULATED SALES 15000.000
--------------------------------------------
DIFFERENCE 0,000
--------------------------------------------
REPORTED COMMISSIONS OWED 13515.16
CALCULATED COMMISSIONS OWED 13515.160
--------------------------------------------
DIFFERENCE 0,000
--------------------------------------------
REPORTED PAYROLL AMOUNT 11632.03
CALCULATED PAYROLL AMOUNT 11632.030
--------------------------------------------
DIFFERENCE 0,000
--------------------------------------------
**** COMMISSION CONTROL - MARYJANE INKSTER ****
REPORTED SALES 16500.00
CALCULATED SALES 16500.000
--------------------------------------------
DIFFERENCE 0,000
--------------------------------------------
REPORTED COMMISSIONS OWED 39995.16
CALCULATED COMMISSIONS OWED 39995.160
--------------------------------------------
DIFFERENCE 0,000
--------------------------------------------
REPORTED PAYROLL AMOUNT 39995.16
CALCULATED PAYROLL AMOUNT 39995.160
--------------------------------------------
DIFFERENCE 0,000
--------------------------------------------
***** SERIOUS COMMISSION ERRORS *****
***** TOTAL NUMBER OF ERRORS 1.000 ***** -
Control-M/Analyzer Capabilities Summary
In defining actual rules to handle the realistic problems presented in this chapter, you used ON blocks and DO parameters. These Control-M/Analyzer capabilities are summarized below:
ON Blocks
You've seen that every rule is made up of ON blocks. There are two main types of ON blocks:
-
blocks that process an external data source, extracting information, and
-
blocks that work on internal data, such as variables
As Figure 105 illustrates, there are several types of external data sources:
Figure 105 ON Block Structure Summary
In Figure 106, the two types of data sources (ON SYSOUT and ON FILE) that were used in solving the six problems described in this chapter are checked.
While the other three types of data sources (ON CLASS, ON DDNAME, and ON DSN) would require different ON specifications, the rule definitions that would use these data sources would be nearly identical to those using ON SYSOUT and ON FILE.
Figure 106 Data Sources That ON Statements Can Process
DO Parameters
Figure 107 illustrates the DO parameters that can be used in Control-M/Analyzer balancing rules. The DO parameters that were used in solving the six problems in this chapter are checked.
Figure 107 What Automated Balancing Action Parameters (DO Statements) Can Do
From the diagram, you see that by performing the exercises in this guide, you have
-
performed a great deal of variable manipulation, using DO EXTRACT, DO SET, and DO COMMIT
-
used DO SHOUT to invoke the IOA SHOUT facility
-
The DO COND adds or deletes conditions from the IOA Conditions file.
-
printed reports, using DO PRINT
-
DO REMARK creates a one line remark which is placed in the Invocation Report and the Rule Activity display.
-
modified the order of execution of the rule, using DO BLOCK, DO GOTO, and DO TERMINAT
-
While you have not called other rules (DO RULE), or user-defined routines within a rule (DO CALLUSER), these action parameters are very similar to the others.
-
You did not need to use "AutoEdit" manipulation actions (DO GETMEM, DO ADDSYM, DO PUTMEM) in this demo. These special purpose variables are explained in the Control-M/Analyzer for z/OS User Guide.