     /*******************************************************/
     /* This script will create a report called MSG-DOR.TXT */
     /* showing the # of doors opened VS. # of messages     */
     /* written and will display a ratio of the two.        */
     /*      (For those that have a ratio >= 5 to 1)        */
     /*******************************************************/

START

VIRTUAL

  userfile      STRING  32      "C:\GAP\MAIN\USERS.DAT"
  username      STRING  32      sysop <> 1 ? STRIP(first) # " " # STRIP(last) :
                                "SYSOP"
  ratio         INT2     2      (doors_opened = 0 AND messages_left = 0)
                                 ? 0 : doors_opened / messages_left

  divider       INT2     2      messages_left = 0 ? 0 : 1


SEARCH

  FILE userfile USING_KEY user_index


SELECT

  ratio >= 5 AND ratio <> 0 AND divider >= 0

SORT USING_KEY                      /* format report according to the      */
                                    /* following fields.                   */
  DSC_NO_MOD     ratio              /*  Ratio (ascending order - best 1st) */
  NO_MOD        last                /*  By last name  (ascending order)    */
  NO_MOD        first               /*  By first name (ascending order)    */


DISPLAY

  DEVICE        OUTFILE
  PAGE_LENGTH   0                     /* no page formatting */


IMAGE

REPORT_HDR

+
+
+              DOORS OPENED vs. MESSAGES LEFT RATIO as of @xxxxxxx
                                                                 SYS_DATE
+
+    Name                        Doors opened   Msgs. left          Ratio
+    ======================================================================
BODY
+    @xxxxxxxxxxxxxxxxxxxxxxxxxxx  @9999         @9999           @9999 to @
     username                      doors_opened  messages_left ratio divider



EXIT
