home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / Database / GBROUTE1,03PLUS.DMS / in.adf / ARexx / GBRBIAS.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1991-09-12  |  3.0 KB  |  75 lines

  1. /*****************************************************************************
  2. **                                                                          **
  3. **                       GBRoute Plus ARexx Script                          **
  4. **                                                                          **
  5. **                       (c) 1991 Complex Computers                         **
  6. **                                                                          **
  7. **  Name : gbrbias.rexx                                                     **
  8. **                                                                          **
  9. **  Description : Calculates a route from Cromer to Lyme Regis              **
  10. **                with progressively increasing B road Bias                 **
  11. **                                                                          **
  12. *****************************************************************************/
  13.  
  14. TEMPFILE = 'ram:$$temp'               /* This can be any valid filename    */
  15.  
  16. say 'GBRoute Plus Bias Demonstration'
  17.  
  18. start = Cromer
  19.  
  20. dest = Lyme Regis
  21.  
  22. options results                        /* neeed this if we are to get       */
  23.                                        /* returned values                   */
  24. address 'GBR'
  25.  
  26. 'from' start                           /* give GBR start and destination    */
  27. p1 = result
  28. 'to' dest
  29. p2 = result
  30.  
  31. say 'Calculating journey from: 'p1' to: 'p2 
  32.  
  33. do i=1 to 6                            /* loop with biasb from 1 to 6       */
  34.    'biasb' i                           /* set B road bias                   */
  35.  
  36.    say 'With B Road Bias at : 'i
  37.  
  38.    'go'                                /* calculate the route               */
  39.  
  40.                                        /* Check for no route                */
  41.    if result == 'RESULT' then do
  42.                                        /* output journey to file            */
  43.       'file' TEMPFILE
  44.  
  45.       open(file, TEMPFILE, read)
  46.                                        /* loop until the end of the file    */
  47.       do while eof(file)=0
  48.                                        /* read a line from file             */
  49.          st = readln(file)
  50.                                        /* and print it                      */
  51.          say st
  52.       end
  53.                                        /* close the file                    */
  54.       close(file)
  55.  
  56.       address command                  /* call DOS delete command           */
  57.       delete TEMPFILE
  58.  
  59.       address 'GBR'                    /* now back to GBRoute               */
  60.  
  61.       'dist'                           /* get distance, time and cost       */
  62.       d = result
  63.       'time'
  64.       t = result
  65.       'cost'
  66.       c = trunc(result/100,2)          /* convert to pounds.pence           */
  67.  
  68.       say 'This journey costs £'c' and takes 't'mins covering 'd' miles'
  69.    end
  70.                                        /* Route not possible                */
  71.    else say result
  72. end
  73.  
  74. exit                                   /* exit ARexx script                 */
  75.