Previous Topic: What You Can DoNext Topic: Demonstration (2): Printing a Total Count


Demonstration (1): Printing the Count of each Occurrence

Objective

This report assigns a number to each employee in the public relations department by adding 1 to the value of a numeric work field. The value of the work field is printed out each time a new employee is processed.

Parameters

01OUT D

01OUT D suppresses the automatic total of the employee number column.

010 COUNT

010 COUNT establishes the numeric work field COUNT.

0151*030 COUNT

0151*030 COUNT prints the value of the work field COUNT.

017010 COUNT + 1 COUNT

017010 COUNT + 1 COUNT adds 1 to the value contained in the work field COUNT.

Complete Code

col. 2
▼
IN 200 F 400 PS(TAPE)
REC EMPLOYEE        5   20
REC DEPARTMENT    115   25
SEL DEPARTMENT EQ 'PUBLIC RELATIONS'
013 EMPLOYEE COUNT
01OUT D
010 COUNT
0151*010 DEPARTMENT      HH 'DEPARTMENT'
0151*020 EMPLOYEE        HH '  EMPLOYEE NAME'
0151*030 COUNT SZ=3      HH 'EMPLOYEE NUMBER'
017010   COUNT + 1 COUNT

Result

REPORT NO. 01        EMPLOYEE COUNT                  mm/dd/yy PAGE     1           DEPARTMENT            EMPLOYEE NAME                             EMPLOYEE NUMBER                                                                                   1   PUBLIC RELATIONS          MICHAEL   ANGELO                                      2   PUBLIC RELATIONS          DONTE     BANK                                        3   PUBLIC RELATIONS          JOCK      JACKSON                                     4   PUBLIC RELATIONS          CAROL     MCDOUGALL                                   5   PUBLIC RELATIONS          LAURA     PENMAN                                      6   PUBLIC RELATIONS          BETSY     ZEDI