     /*******************************************************/
     /* This report script will create a report of all      */
     /* users, sorted by home phone number and name.  The   */
     /* output will be sent to a disk file called PHONE.TXT */
     /*******************************************************/

     /*******************************************************/
     /* Note that the report scripts look a great deal like */
     /* C code!  ALL report script commands are in upper    */
     /* case.  References to user file or message file      */
     /* fields are detailed in the documentation.           */
     /*******************************************************/


     /*******************************************************/
     /* 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:\GAP\MAIN\USERS.DAT"
  username      STRING  32      sysop <> 1 ? STRIP(first) # " " # STRIP(last) :
                                "SYSOP"



     /*******************************************************/
     /* 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 USING_KEY user_index



     /*******************************************************/
     /* 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!)         */
  NO_MOD        home_phone          /*  By home phone                      */
  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        OUTFILE
  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
+ HP : @xxxxxxxxxxxxxx    Name : @xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
       home_phone                username
        
        
     /*******************************************************/
     /* EXIT must be the last line in each script           */
     /*******************************************************/


EXIT
