Previous Topic: Grouping Feature Example 1

Next Topic: Grouping Feature Example 3


Grouping Feature Example 2

Request:

A report of production work run between 8 a.m. and 12 noon on Mondays only, during the first quarter of 1998.

  1. Build CRITERIA statement to select 01/01/98 through 03/31/98.
  2. Build GROUP and GROUPC statements as follows:
              points to Reader Start Date
              in Basic Accounting Table
              │
              │     points to Reader Start Time (HH)
              │     in Basic Accounting Table
              │     │
              │     │        points to production
              │     │        run indicator within
              │     │     ┌─ Job Name in Basic
              ▼     ▼     ▼  Accounting Table
             ┌──┐ ┌───┐ ┌───┐
    BGROUP   0046 S0102 S0161 S
  position   1         2         3         4         5                 8
    1........0.........0.........0.........0.........0..            ...0

S in the line above is the selection indicator.

  position   1         2         3         4         5                 8
    1........0.........0.........0.........0.........0..            ...0
    BGROUPC  1930102   } (1st Monday in quarter)
    BGROUPC  1930109   } (2nd Monday in quarter)
              .        }           .
              .        }           .
              .        }           .
    BGROUPC  1930327   } (last Monday in quarter)

  position   1         2         3         4         5                 8
    1........0.........0.........0.........0.........0..            ...0
         8 a.m. through 12 noon
               ▼      ▼
    BGROUPC  208      11
             production run indicator
              ▼
    BGROUPC  3P

Example 2 shows you how to use the grouping feature to selectively retrieve only those accounting records that qualify for selection. By setting the selection/rejection indicator on the GROUP statement to S, a record must pass all three criteria to be selected for further processing. Group #1 definition requires the record to have a reader start date equal to that of an identified Monday in the first quarter.

If qualified, then Group #2 definition requires the record to have a reader start time between 8 a.m. and 12 noon. If qualified, then Group #3 definition requires the record to have a job name starting with the letter P. (This assumes that all job names beginning with P indicate production, S for systems, C for checkout, and so forth, as an example.)

Any record failing one of the criteria is automatically rejected from further processing. You could then define a SORT statement to sort on reader start date (major) and the hours position of reader start time (intermediate) to cause production statistics to come out hourly within date for each Monday in the first quarter.