Previous Topic: Add SMF Fields to a ReportNext Topic: Modify and Create Table Processing


Create and Add Work Fields to a Report

In the two previous sections, you reviewed examples of creating work fields. In both cases, we created work fields to define a field relative to an existing ACFFLT file field. In the first case, we created a work field to specify a different title. In the second case, we moved file information to a work field for output editing purposes.

You can use work fields for other reasons such as counter or result fields.

In the following example, the DEFINE statement creates a work field. The new field, AMPM, specifies whether the action took place in the morning or afternoon. The field AMPM is initialized to blanks and has a blank header. The PRINT statement places the fields to print in any order you want. The first field listed is printed at the left margin. Each succeeding field prints to the right of the field listed before until all are printed.

     DEF AMPM (2) = ' ' ' '
            .
            .
      IF HOUR < 12 THEN
          SET AMPM='AM'
      ELSE
          SET AMPM='PM'
      ENDIF
            .
            .
      PRINT DATE
            TIMESECONDS
            AMPM
            LOGONID
            JOBNAME
            SUBMITTOR
            SOURCE
            PROGRAM
            REASON_NUMBER
            VTYPE
            CPU

The previous modified program produces the changes to this report.

03/29/02                           LOGON AND PASSWORD VIOLATIONS
                 STARTING DATE: 03‑29‑02    ENDING DATE: 03‑29‑02 
                 STARTING TIME: 10.59       ENDING TIME: 15.04 
‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑ 
    DATE   TIME         LOGONID   JOBNAME   SUBMITTOR  SOURCE     PROGRAM    REA 
                                            LID/PROC                           C 
‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑ 
03‑29‑02  10.59.30  AM  AUEJJV                         H06L84F 
03‑29‑02  11.09.55  AM  TLCISO    STARMAN   STARMAN    USCHGOVB 
03‑29‑02  11.21.50  AM  TLCISO    TLCISO    LOGON      V4L3ED 
03‑29‑02  13.24.58  PM  SSESWB    SSESWB    LOGON      V4L3E0 
03‑29‑02  14.02.48  PM  SVNSKS    SVNSKS    LOGON      V4L3EA 
03‑29‑02  14.20.10  PM  TSTRJM                         H06L867 
03‑29‑02  14.43.44  PM  CICSID9   SSELHS5   SSECICS    T86C       SSD5 
03‑29‑02  14.44.28  PM  CICSID9   SSELHS5   SSECICS    T827       SSD5 
03‑29‑02  14.44.55  PM  CICSID8   SSELHS5   SSECICS    T827       SSD5 
03‑29‑02  14.48.36  PM  AUEDRL                         H06L83D
END OF REPORT