Previous Topic: Demonstration (1): Printing the Count of each OccurrenceNext Topic: Demonstration (3): Using the Value of a Work Field


Demonstration (2): Printing a Total Count

Objective

This report counts the number of employees processed by adding 1 to the value of the numeric work field. The final value of the work field is printed out by using a type 6 parameter.

See the chapter "Controlling Total Lines" for details about type 6 parameters.

Parameters

010 COUNT

010 COUNT establishes the numeric work field.

0161*040 'NUMBER OF EMPLOYEES' 0161*050 COUNT

0161*040 and 0161*050 are type 6 parameters used to label the print line and obtain the last value in 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
010 COUNT
0151*010 DEPARTMENT      HH 'DEPARTMENT'
0151*020 EMPLOYEE        HH '  EMPLOYEE NAME'
0161*040 'NUMBER OF EMPLOYEES'
0161*050 COUNT
017010   COUNT + 1 COUNT

Result

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