[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Copying files for archive



I am not sure whether you'd be running into the what
i encountered, but we had something similar occur.
The command we needed to execute actually did
run, but only after our sqr had finished.  If you check
from the command line after the sqr has run and the
batch file results are in place, then the thing to do is
alter the system command.

You can get the NT to wait with the following marvelously
unintuitive sequence:

let $command = 'cmd /c @start /min /wait cmd /c "your_real_work_here"
CALL SYSTEM USING $command #retval WAIT

hope this helps,

joan

-----Original Message-----
From: C. Duncan Hudson <c_duncan_hudson@YAHOO.COM>
To: Multiple recipients of list SQR-USERS <SQR-USERS@list.iex.net>
Date: Tuesday, September 22, 1998 7:35 AM
Subject: Copying files for archive


>I've written a small SQR (4.0 for NT/95) job that takes a program's
>name, it's location (drive and directory), and a destination directory
>as input.  It then copies all of the SPF and S0? files associated with
>that program to the destination (archive) directory.  It actually does
>this by building a DOS batch file on the fly, which is then called by
>the CALL SYSTEM USING command.
>
>Here's my problem:  The job runs fine on my machine.  When I move it
>to the production NT server it runs, but doesn't work.  The batch file
>returns a 0 status, but the files don't get copied.  The NT server,
>that runs the job has all of the necessary permissions on the
>destination drive.  The code follows.  If anyone has any thoughts I
>would really appreciate them.  Thanks in advance,
>
>
>Dunc.
>
>
>begin-program
> input $source 'Enter Source Drive (eg. C:\)'
> input $destination 'Enter Destination Path (eg. C:\Archive\ or
>\\Host\Share)'
> input $program 'Enter Program name'
>
> date-time () 'YYYYMMDD-HHMISSpm-' &datetime
> lowercase $program
> let $spaces = ' '
>
> if ((substr($source, length($source), 1)) != '\')
>    let $source = $source || '\'
>    display $source
> end-if
> if ((substr($destination, length($destination), 1)) != '\')
>    let $destination = $destination || '\'
> end-if
>
> let $bat_file  = $source || 'move.bat'
> unstring $program by '.' into $exe $extenstion
>
> if (($exe = '') or ($extenstion = ''))
>    display 'Invalid SQR Program name, abending.'
>    stop quiet
> else
>    open $bat_file as 0 for-writing record=132:fixed status=#open_status
>    if (#open_status != 0)
>       string 'Invalid Source Drive/Share (' $source '), abending.' by
>'' into $message
>       display $message
>       stop quiet
>    else
>       do command_line ('.s0* ')
>       do command_line ('.sp* ')
>       close 0
>    end-if
> end-if
>
> let $DOS_command = $bat_file
> call system using $DOS_command #DOS_status
> if (#DOS_Status != 0)
>    display 'Program failed with DOS Status:' noline
>    display #DOS_status
>    stop quiet
> else
>    display 'MOVE.BAT returned 0.'
> end-if
>
> ! REM CHECK TO SEE IF IT WORKED.
>
> let $filename = $destination || &datetime || $exe || '.spf'
> display 'Filename: ' noline
> display $filename
> let #fstatus = exists($filename)
> display 'SPF File presence check returned: ' noline
> display #fstatus
>end-program
>
>
>begin-procedure command_line ($extension)
> display 'Writing to batch file...'
> string 'xcopy ' $_exe $extension ' ' $_destination &_datetime $_exe
>$extension ' /V /C /F'
>     by '' into $command_line
> display $command_line
> write 0 from $command_line:132
> write 0 from $spaces:132
>end-procedure
>
>
>
>_________________________________________________________
>DO YOU YAHOO!?
>Get your free @yahoo.com address at http://mail.yahoo.com