From:	CSBVAX::MRGATE!RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP 18-OCT-1988 00:23
To:	ARISIA::EVERHART
Subj:	Re: com file tree utility


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Mon, 17 OCT 88 20:12:07 PDT
Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Mon, 17 Oct 88 19:41:54 PDT
Received: by ucbvax.Berkeley.EDU (5.59/1.31)
	id AA18838; Mon, 17 Oct 88 19:29:27 PDT
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 14 Oct 88 10:36:27 GMT
From: munnari!mimir!hugin!augean!sirius!hacker!jeremy@uunet.uu.net  (Jeremy Begg)
Organization: Management Information Systems, Adelaide, South Australia
Subject: Re: com file tree utility
Message-Id: <411@misadel.oz>
References: <8809232057.AA04879@ucbvax.Berkeley.EDU>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

In article <8809232057.AA04879@ucbvax.Berkeley.EDU>, BURRIS%LCAM1@ICDC.LLNL.GOV ("Keith L. Burris - System Manager...", in training!) writes
:
> Date sent  23-SEP-1988 10:10:32
>
> Greetings:
>       Does any one out there have a com file tree utility?

        Someone here wrote a command procedure which does what you want, I
think.  I haven't looked at the code but I'm told it works.  I take no
responsibility one way or the other!

$!
$!      FOLLOW.COM      -       Follow a command procedure thru sub commands
$!
$!      By Rob Mayfield.
$       on error then goto error_handler
$       on severe_error then goto error_handler
$       on warning then goto error_handler
$       on control_y then goto e2rror_handler
$       say = "write sys$output "
$       error_occurred = 0
$       quo[0,8] = 34
$       command_file = p1
$       file_1 = "file_" + f$fao("!SL",f$environment("DEPTH"))
$       if file_1 .eqs. "file_1"
$         then  error_occurred = 133
$               say "Wait a sec ..."
$               set mess/nofac/noide/nosev/notext
$       endif
$ loop_deass:
$       if file_1 .eqs. "file_1" .and. error_occurred .gt. 100
$         then  error_occurred = error_occurred - 1
$               call deass_fil error_occurred
$               goto loop_deass
$       endif
$       error_occurred = 0
$       set mess/fac/ide/sev/text
$       goto cont_af_deas
$ deass_fil: SUBROUTINE
$       if error_occurred .gt. 150
$         then file_2 = "file_" + f$fao("!SL",error_occurred-200)
$         else file_2 = "file_" + f$fao("!SL",error_occurred-100)
$       endif
$!      say "Deassigning ",file_2
$       deass file_2
$       exit
$ ENDSUBROUTINE
$ cont_af_deas:
$       if file_1 .eqs. "file_1" .and. command_file .eqs. ""-
          then-
                inquire/nopunc command_file "_Follow which .COM file : "
$       if command_file .eqs. "" then goto res_point
$       if f$locate(".COM",command_file) .eq. f$length(command_file)-
          then-
                command_file = command_file + ".COM"
$       say "          BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
$       say "          B BEGINNING               :: ",command_file
$       say "          BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
$       open/read/share=write/error=file_open_err          'file_1 'command_file
$ read_loop:
$       read/end_of_file=eof_handler/error=read_err/nolock 'file_1 com_line
$       say com_line
$       c_ats = f$locate("@",com_line)
$       c_quo = f$locate(quo,com_line)
$       if      c_ats .ne. f$length(com_line) .and. c_quo .gt. c_ats
$         then  com_line = f$edit(com_line,"COMPRESS,UNCOMMENT")
$               com_line = f$extract(c_ats + 1, 999,com_line)
$               c_ats = f$locate("@",com_line)
$               c_len = f$length(com_line)
$               c_spa = f$locate(" ",com_line)
$               c_sla = f$locate("/",com_line)
$               if c_sla .lt. c_spa then c_spa = c_sla
$               c_fil = f$extract(0,c_spa,com_line)
$               @ws$com:follow 'c_fil
$       say "          RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"
$       say "          R RESUMING  --  IN        :: ",command_file
$       say "          RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"
$       endif
$ f_continue:
$       goto read_loop
$       stop
$ eof_handler:
$       say "          FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$       say "          F FINISHED                :: ",command_file
$       say "          FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$       goto procedure_end
$ read_err:
$       say ""
$       say "%FOLLOW-F-FAILREAD,  Failed to read past point currently reached"
$       say "%FOLLOW-W-COMNOFOL,  Command procedure not properly followed ..."
$       say ""
$       goto procedure_end
$ file_open_err:
$       say ""
$       say "%FOLLOW-F-FAILOPEN,  Failed to open command file - ",command_file
$       say "%FOLLOW-W-COMNOFOL,  Command procedure not properly followed ..."
$       say ""
$       goto procedure_end
$ error_handler:
$       stat = $status
$               on severe_error then goto error_handler
$               on error then goto error_handler
$               on warning then goto error_handler
$       if error_occurred .gt. 100      then goto loop_deass
$       if error_occurred .gt. 150      then goto loop2_deass
$       error_occurred = 1
$       if stat .eqs. "%X00000001" then stop
$       if stat .eqs. "%X00030001" then stop
$       if stat .eqs. "%X00010001" then stop
$       say "%FOLLOW-F-STUFFUP,  Something went terribly wrong !"
$       say "%FOLLOW-D-DETAILS,  Status is ",stat
$       say "%FOLLOW-S-SORRY,  Sorry ..."
$       say ""
$       goto procedure_end
$       stop
$ e2rror_handler:
$       on controly then goto error_handler
$       say "%FOLLOW-F-CONTROLY,  Control-Y was pressed - WAIT !!"
$       set mess/nofac/noide/nosev/notext
$       error_occurred = 233
$ loop2_deass:
$       if error_occurred .gt. 200
$         then  error_occurred = error_occurred - 1
$               call deass_fil error_occurred
$               goto loop2_deass
$       endif
$       error_occurred = 0
$       set mess/fac/ide/sev/text
$       say "%FOLLOW-I-EXITING,  Exiting ..."
$       say ""
$!      goto procedure_end
$       stop
$ procedure_end:
$       close/error=res_point 'file_1
$ res_point:
$       exit
$       stop
--------------------------------------------------------------------------------
        Jeremy Begg

  +-------------------------------------------------------------------+
  | Management Information Systems,  |  E-Mail:  jeremy@misadel.oz    |
  | 125 Dew Street, Thebarton,       |   Phone:  +61 8 3524877 (work) |
  | South Australia 5031             |                                |
  +-------------------------------------------------------------------+

