In-Groups-Of Command

If you need to sort a report using a numeric field, you can group the sort field values together and define the range of each group using the command IN-GROUPS-OF.  The example below shows a list of employees with 5, 10 and 15 year anniversaries. The field EMPYEARS is defined from the field AC:EMPMTHS which uses the current date to calculate the months of employment.

 

EX AC

DEFINE FILE AC ADD

EMPYEARS/I6 = AC:EMPMTHS/12;

END

TABLE FILE AC

PRINT AC:EMPDATE

BY EMPYEARS IN-GROUPS-OF 5

BY AC:WNAME

IF EMPYEARS EQ 5 OR 10 OR 15

END

 

The report generated would look like this:

 

EMPYEARS  AC:WNAME          AC:EMPDATE

--------  --------          ----------

5         FROG, JANET       01/23/1995

          MONKEY, ALAN      11/25/1994

10        SNAKE, EMILY      01/08/1990

          ARDVARK, JOHN     08/07/1989

15        GIRAFFE, JUAN     08/27/1984