Previous Topic: Demonstration (2): Printing a Total CountNext Topic: Performing Arithmetic Operations


Demonstration (3): Using the Value of a Work Field

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 1

010 COUNT 1 establishes a numeric work field having the value of 1.

0151*000 COUNT

0151 identifies the work field COUNT on a type 5 parameter. An automatic running total is kept.

000 suppresses the printing of the field value (1) on the report. (More than one such type 5 parameter can be used, if needed.)

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.

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 1
0151*000 COUNT
0151*010 DEPARTMENT      HH 'DEPARTMENT'
0151*020 EMPLOYEE        HH '  EMPLOYEE NAME'
0161*040 'NUMBER OF EMPLOYEES'
0161*050 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