[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference visa::ftsv

Title:File Transfer Spooler for VMS
Moderator:ANNECY::BENDRIS
Created:Mon Dec 12 1994
Last Modified:Sat May 24 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:86
Total number of notes:232

25.0. "Copying [...]" by BIGUN::chmeee::Mayne (My TARDIS isn't big enough) Tue Apr 04 1995 06:39

T.RTitleUserPersonal
Name
DateLines
25.1use a command file ...EMNTAL::STADELMANNSepp @ZUO 760-2609Wed Mar 19 1997 16:4412
    I wrote a command procedure used to establish a ftsv job into an ftsv
    batch queue for each directory and subdirectory. The procedure issues a
    dir / since command and builds a command file with the propper spool
    commands.
    
    The command file was built in a hurry "2 houers", requires still more
    work to be perfect but has helped since very often to achive what you
    want.
    
    I will post it into the next reply.
    
    Sepp,
25.2my "prep.com"EMNTAL::STADELMANNSepp @ZUO 760-2609Wed Mar 19 1997 16:46141
$!
$!--- prepare a spool copy setup command file   ! author Sepp Stadelmann
$!
$!      use the following syntax
$!
$!      @mycom:prep gnpike::fbe$root:[public...] /since=15-sep-1995
$!
$!
$ set noon
$!
$! set the to-date tdo from system date
$!
$ tod = f$edit(f$extract(0,12,f$time()),"upcase,collapse,trim")
$!
$! check path ro read from p1
$!
$ spec = F$PARSE("",p1,,,"SYNTAX_ONLY")
$ if spec .eqs. ""
$    then
$      write sys$output "PREP: syntax error; p1 is wrong ! " + p1
$      exit
$ endif
$!
$! check the since switch for syntax
$!
$ mysince = ""
$ frd = "all"
$ if p2 .nes. "" .AND. -
     f$edit(f$extract(0,5,p2),"COLLAPSE,UPCASE,TRIM") .nes. "/MAIL" 
$  then
$   if f$edit(f$extract(0,7,p2),"COLLAPSE,UPCASE,TRIM") .nes. "/SINCE=" 
$    then 
$      write sys$output "switch `/since` is not specified as `/since=15-sep-1995`"
$      exit
$    else
$      frd = f$edit(f$extract(7,12,p2),"upcase,collapse,trim")
$      mysince = "/since=" + frd
$   endif
$ endif
$!
$! check the mail switch for syntax
$!
$ SENDMAIL = ""
$ if p3 .nes. ""
$   then 
$     if f$edit(f$extract(0,6,p3),"COLLAPSE,UPCASE,TRIM") .nes. "/MAIL=" 
$       then 
$          write sys$output "switch `/mail=` is not specified as `/MAIL=(node::user,node::user)`"
$          exit
$       else
$         SENDMAIL = "/MAIL"
$         post = f$edit(f$extract(6,80,p3),"upcase,collapse,trim")
$         show symbol post
$     endif
$ endif
$!
$ inpf = "until-" + tod + ".dat"
$ outf = "xfer-" + frd + ".com" 
$ cmd = "dir/nohead/notrail/out=" + inpf + " " + p1 + " " + mysince 
$ write sys$output "PREP: doing $ " + cmd
$ cmd
$!
$ ON CONTROL_Y THEN GOTO endit
$ cur = f$directory()
$ cur = f$extract(0,f$length(cur)-1,cur)
$
$ t = f$verify(0)
$ write sys$output "PREP: reading " + inpf
$ OPEN/READ/ERROR=OPEN_READ_ERROR 	INPUT_FILE	'inpf
$ write sys$output "PREP. creating " + outf
$ OPEN/WRITE/ERROR=OPEN_WRITE_ERROR  	OUTPUT_FILE	'outf
$ t= f$verify(t)
$ tdir = ""
$ sdir = ""
$ since = "''p2'"
$ IF SENDMAIL .EQS. "/MAIL" 
$  THEN 
$    a1 = "$ spool copy /NOTIFY=MAIL=" + post + " " + since
$    show symbol a1
$  ELSE
$    a1 = "$ spool copy " + since
$ ENDIF
$
$LOOP:
$ READ/END_OF_FILE=ENDIT  INPUT_FILE  rec
$!show symbol rec
$ t1 = f$locate("[",rec)                  ! return index to [
$!show symbol t1
$ t2 = f$locate("]",rec)                  ! return index to ]
$!show symbol t2
$ a2 = f$extract(0,t1,rec)                ! GNPIKE::FBE$ROOT:
$!show symbol a2
$ a3 = f$extract(t1,(1+t2-t1),rec)        ! [PUBLIC]
$!show symbol a3
$ a4 = f$extract(1+t2,f$length(rec),rec)  ! filename.ext
$!show symbol a4
$ tdir = cur + "." + f$extract(1,f$length(a3),a3)
$!show symbol tdir
$ a5 = a1 + " " + a2 + a3 + "*.* "
$!show symbol a5
$!------ can we create the file in local tdir ? -----
$ f = tdir + "x.x;1"
$ on error then goto mkdir
$retry:
$ assign nl: sys$error /nolog
$ assign nl: sys$output /nolog
$ create/nolog 'f'      ! fails if local directory does not exists
$ delete/nolog 'f'
$ set noon
$ deassign sys$error
$ deassign sys$output
$!----- now we'r able to create a file in 'tdir' -----
$ if sdir .nes. tdir            ! do we copy into this directory already ? 
$  then                         ! no, add copy record
$   a6 = a5 + tdir              ! a5 has source / tdir has target
$   show symbol a6              ! show life singe to user
$   WRITE OUTPUT_FILE a6        ! and append it to target command file
$   sdir = tdir                 ! remember; we copy into this already
$ endif
$ GOTO LOOP
$
$ENDIT:
$ CLOSE INPUT_FILE
$ CLOSE OUTPUT_FILE
$ EXIT
$
$OPEN_READ_ERROR:
$ write sys$output "OPEN_READ_ERROR:"
$ CLOSE INPUT_FILE
$ exit
$
$OPEN_WRITE_ERROR:
$ write sys$output "OPEN_WRITE_ERROR:"
$ CLOSE OUTPUT_FILE
$ CLOSE INPUT_FILE
$ exit    
$
$mkdir:
$ create/dir 'tdir'  ! create a diretory
$ goto retry
$
25.3EMNTAL::STADELMANNSepp @ZUO 760-2609Wed Mar 19 1997 16:473
    I warned you, it still requires a bit work.
    
    Sepp :-)