home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************************************
- ** **
- ** GBRoute Plus ARexx Script **
- ** **
- ** (c) 1991 Complex Computers **
- ** **
- ** Name : gbrconsole.rexx **
- ** **
- ** Description : Calculates a route with optional 'Via' **
- ** **
- *****************************************************************************/
-
- TEMPFILE = 'ram:$$temp' /* This can be any valid filename */
-
- say 'GBRoute Plus ARexx Demonstration'
-
- options prompt 'Enter Start: ';
- /* get starting place */
- pull start
-
- options prompt 'Enter Destination: ';
- /* get destination place */
- pull dest
-
- options prompt 'Via: (or Enter)';
- /* get destination place */
- pull via
- /* send commands to GBRoute */
- options results /* neeed this if we are to get */
- /* returned values */
- address GBR
- 'from' start
- p1 = result
- 'to' dest
- p2 = result
- 'via1' via
- v1 = result
- say 'Calculating journey from: 'p1' to: 'p2 ' via: 'v1
- 'go'
- /* Check for no route */
- if result == 'RESULT' then do
- /* output journey to file */
- 'file' TEMPFILE
- /* open file */
- open(file, TEMPFILE, read)
- /* loop until the end of the file */
- do while eof(file)=0
- /* read a line from file */
- st = readln(file)
- /* and print it */
- say st
- end
- /* close the file */
- close(file)
-
- address command
- delete TEMPFILE
-
- address 'GBR'
-
- 'dist'
- d = result
- 'time'
- t = result
- 'cost'
- c = trunc(result/100,2) /* pounds.pence */
- say 'This journey costs £'c' and takes 't'mins covering 'd' miles!'
- end
- /* Route not possible */
- else say result
- exit
-