     /*******************************************************/
     /* This report script will create an ISAM Data file    */
     /* that can later be copied to USERS.DAT and reindexed.*/
     /* It will set the security level of any user that has */
     /* an upload/download ratio based upon the following   */
     /* table. Users above level 50 are not affected.       */
     /* Note:                                               */
     /*   There is a sort of "fudge factor" built in that   */
     /*   is unavoidable.  That being, a user can download  */
     /*   1 file, upload none, and the ratio will be the    */
     /*   same as 1:1.                                      */
     /*                                                     */
     /* Be sure to change the path statement in the VIRTUAL */
     /* section to match your path to the USERS file.       */
     /*                                                     */
     /* To use the new user file that is created, copy      */
     /* USERS3.TXT to  MAIN\USERS.DAT, delete USERS.IDX,    */
     /* and run GAPREBLD.  Can be placed in an event by     */
     /* using RATIO.BAT included with GAPREPRT.
     /*******************************************************/

     /*******************************************************/
     /* All report scripts must begin with START            */
     /*******************************************************/

START


     /*******************************************************/
     /* Virtual fields are used within the report.  They    */
     /* are normally used to provide computations.  For     */
     /* instance, the username field is taking the user's   */
     /* first name and last name, striping off the spaces   */
     /* and then joining the two names together.            */
     /*******************************************************/


VIRTUAL

  userfile      STRING  32      "D:\NODE2\MAIN\USERS.DAT"
  up            SFLOAT   4      uploads   = 0 ? 1.0 : uploads
  down          SFLOAT   4      downloads = 0 ? 1.0 : downloads
  ratio         SFLOAT   4      down / up

     /*******************************************************/
     /*                    Table Of Ratios                  */
     /*                                                     */
     /*   Uploads   Downloads   Ratio   Level               */
     /*   -------   ---------   -----   -----               */
     /*      5+         1        0.20     45                */
     /*    2 - 4        1        0.50     40                */
     /*      1          1        1.00     35                */
     /*      1          6        6.00     30                */
     /*      1         11       11.00     25                */
     /*      1         13+      13.00     20                */
     /*******************************************************/


  level1        INT2     2      (ratio <= 0.20 AND level <= 50)
                                 ? 45 : 0

  level2        INT2     2      (ratio >  0.20 AND ratio < 1.00
                                               AND level <= 50)
                                 ? 40 : 0
  
  level3        INT2     2      (ratio >= 1.00 AND ratio < 6.00
                                               AND level <= 50)
                                 ? 35 : 0

  level4        INT2     2      (ratio >= 6.00 AND ratio < 11.00
                                               AND level <= 50)
                                 ? 30 : 0

  level5        INT2     2      (ratio >= 11.00 AND ratio < 13.00
                                                AND level <= 50)
                                 ? 25 : 0

  level6        INT2     2      (ratio >= 13.00 AND level <= 50)
                                 ? 20 : 0

  new_level     INT2     2      level1 + level2 + level3 + level4 +
                                level5 + level6

  user_level    INT2     2      (new_level <> 0) ? new_level : level


     /*******************************************************/
     /* The SEARCH section is where you tell the report     */
     /* generator how to search the file.  In this case, we */
     /* are searching by the userindex.  The same way you   */
     /* see the users in GAPUSER.                           */
     /*******************************************************/


SEARCH 

  FILE userfile ALL



     /*******************************************************/
     /* The SELECTION section is where you tell the report  */
     /* generator how to select individual records.  For    */
     /* instance, you could tell it to to select ONLY those */
     /* users with a level of 90 or greater.                */
     /*******************************************************/


SELECT

  ALL


     /*******************************************************/
     /* The sort section allows you to format the report in */
     /* any order you wish.  It must be realized however    */
     /* that in using SORTS, the report generator will need */
     /* to actually sort the data before it prints the      */
     /* report.  This may take some time with large files.  */
     /*******************************************************/

     
SORT USING_KEY                      /* format report according to the      */
                                    /* following fields.                   */
  DSC_NO_MOD    sysop               /*  By sysop flag (IMPORTANT!)         */
  DSC_NO_MOD    level               /*  By user level (decending order)    */
  NO_MOD        last                /*  By last name  (ascending order)    */
  NO_MOD        first               /*  By first name (ascending order)    */


     /*******************************************************/
     /* The DISPLAY section is where you tell the report    */
     /* generator where to send the report.  Output can be  */
     /* directed to any valid DOS device.                   */
     /*******************************************************/

DISPLAY

  DEVICE        INPFILE     /* INPFILE is an ISAM data file */
  PAGE_WIDTH    652         /* PAGE_WIDTH is record length  */
  PAGE_LENGTH   0           /* no page formatting           */


     /*******************************************************/
     /* The IMAGE section is where the report is actually   */
     /* produced.   You set up exactly how you want the     */
     /* report to appear, and the report generator will     */
     /* substitute your user or message fields in place of  */
     /* of the format specifications.                       */
     /*                                                     */
     /* Anything after a '+' is printed except that the     */
     /* format specifications are substitued with the       */
     /* actual fields that appear in the line beneath.      */
     /*                                                     */
     /* Inside the body, you may refer to either an actual  */
     /* DODA name, or a name that was defined in the        */
     /* VIRTUAL section above.  For instance, "username"    */
     /* does not exists as one of the DODA names but it was */
     /* defined in the VIRTUAL section as a formula to use  */
     /* "first" and "last" (both defined in DODA)           */
     /*******************************************************/


     /*******************************************************/
     /*  NOTE!!!  DO NOT place any comments after a line    */
     /*  that begins with a '+'!  If you do, then your      */
     /*  comments will be printed and/or shown!             */
     /*******************************************************/



IMAGE

BODY

+@D
first last handle city password home_phone data_phone subscription
user_level timeson last_date last_time ttl_mins cur_mins uploads
downloads total_bytes cur_bytes private protocol page_length
last_dir_date last_message messages_read messages_left forums_joined
blts_read doors_opened last_forum expert sysop up_bytes cur_downs
birthdate comment forum1 forum2 forum3 fmes


     /*******************************************************/
     /* EXIT must be the last line in each script           */
     /*******************************************************/


EXIT
