[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: System Call to Copy & Rename file
- Subject: Re: System Call to Copy & Rename file
- From: Vishner@AOL.COM
- Date: Mon, 19 Jun 2000 14:26:12 -0600
Hi Robbi,
COPY is not a primary DOS command. It is not a ".com",
".exe",".bat", etc. It is part of COMMAND.COM. If you want to execute a COPY,
DIR, etc., try concatenating a reference to COMMAND.COM before your COPY
command...
Let $command_str =
'C:\WINDOWS\COMMAND.COM /c ' ||
'COPY C:\TEMP\payroll.dk C:\SavBond\'||$filename
Alternatively, if you still want to use a BAT file, create a shortcut in
windows for the BAT file, specifying "CLOSE ON EXIT" under the PROGRAM tab of
PROPERTIES.
HTH,
Hugh Vishner
In a message dated Mon, 19 Jun 2000 3:15:26 PM Eastern Daylight Time, "Wendel,
Robbi" <rwendel@NESPOWER.COM> writes:
<< Yes. I even placed the call after I did a close just to make sure. Kathy
Anderson responded to me directly and I want to put her post here so that
maybe someone can tell me how to expand it.
*****************************************************************
KATHY ANDERSON WROTE:
I'm not sure if this will work but I've tried using the call system command
before to do a DOS copy and it didn't work. But if I put the copy command
in a bat file and used the call system with the bat file it did.
Begin-procedure System-call
open 'c:\temp\copy.bat' as 1
for-writing
record=100:vary
Let $filename = '06_15_00.txt'
Let $command_str = 'COPY C:\TEMP\payroll.dk C:\SavBond\'||$filename
write 1 from $command_str
close 1
Display $command_str
Call System Using 'c:\temp\copy.bat ' #stat
if #stat <> 0 !failed
Display 'Copy/Rename of Payroll.dk Failed.'
Display #stat
stop quiet
else
Display 'Copy/Rename of Payroll.dk Completed.'
end-if
End-procedure System-call
*****************************************************************
This use of the bat file works great! The only problem is that it leaves the
MSDOS window open and I would like that to be transparent to the user. Can
anyone tell me how to accomplish this from the system call???
TIA,
Robbi
-----Original Message-----
From: George Mansoor [mailto:GMansoor@GETTY.EDU]
Sent: Monday, June 19, 2000 1:57 PM
To: SQR-USERS@list.iex.net
Subject: Re: System Call to Copy & Rename file
have you closed c:\TEMP\payroll.dk before running your system-call proc?
>>> rwendel@NESPOWER.COM 6/19/00 11:37:50 AM >>>
Hello All,
I have been asked to do some file manipulation within an SQR that is
currently being done by the user after completion of the SQR. The SQR
creates a file called payroll.dk in C:\TEMP . This flat file is then copied
by the user into another folder C:\SavBond with a new name that corresponds
with a date that was prompted during the run of the SQR. I have written
this code segment, and for the life of me can not get it to run. The new
file name would be in the format of 06_15_00.txt I am running Win98. I
have tested this COPY command at the MSDOS prompt and it works, but it won't
work from with SQR. I know it must be something really easy that I am
missing. Any help is greatly appreciated - even if the result is that I am
a dope !!
Begin-procedure System-call
Let $filename = '06_15_00.txt'
Let $command_str = 'COPY C:\TEMP\payroll.dk C:\SavBond\'||$filename
Display $command_str
Call System Using $command_str #stat
if #stat <> 0 !failed
Display 'Copy/Rename of Payroll.dk Failed.'
Display #stat
stop quiet
else
Display 'Copy/Rename of Payroll.dk Completed.'
end-if
End-procedure System-call
TIA,
Robbi
>>