     /*         MESSAGE BASE SUBJECT THREAD REPORT          */
     /*             Usage: GAPREPRT FTHD.RPT M              */
START
VIRTUAL
  msg_file      STRING  32      "D:\GAP\MAIN\MSGS.DAT"        /* Message base */
  str_number    STRING  12      LNG_STR(number)
  left_date     DATE     4      date
  read_date     DATE     4      (STRIP(to) <> "ALL" AND date_read = 0)
                                 ? 1 : date_read
  select        INT2     2      (STRIP(subject) = "COMMENT") ? 3 : 0
                                 
  referto       STRING  12      (refer = 0) ? "None" : LNG_STR(refer)

  vf1           INT2     2      (type <> 82 AND type <> 83) ? 1 : 0
  vf2           INT2     2      (type = 82) ? 2 : 0
  vf3           INT2     2      vf1 + vf2              /* This Section    */
                                                       /* allows you to   */
  security      STRING 10      : vf3                   /* manipulate the  */
                                 0 "Password"          /* the security    */
                                 1 "None"              /* field.          */
                                 2 "Private"

SEARCH 
  FILE msg_file USING_KEY num_idx    /* # after index = forum # */

SELECT
   type <> 82 AND select <> 3      /* no private mail, no COMMENTS */

SORT USING_KEY
  NO_MOD       subject            /* Alphabetically by Subject */
  INTEGER      number             /* This is most appealing    */
CONTROL

  1     subject


ACCUMULATOR                       /* keep a running total  */

  thread_total  FRQ     subject

DISPLAY

  DEVICE        OUTFILE
  PAGE_LENGTH   0

IMAGE

REPORT_HDR                        /* Change Forum Name below */
+
+       WRITERS FORUM MESSAGE THREAD REPORT - as of @xxxxxxx
                                                    SYS_DATE
+
+ Start #  Who Started It All    What It is All About   Total Msgs
+ ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
+
CONTROL_FTR(1)
+  @xxxxx  @xxxxxxxxxxxxxxxxxxxx @xxxxxxxxxxxxxxxxxxxxx   @999
   number  from                  subject                  thread_total
EXIT
