[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
Robbi,
I would recommend instantiating the Command.Com using the Windows
environment variable Comspec. From there I would run the copy command
within that instance of Command.Com.
See the code sample below:
Begin-procedure System-call
Let $filename = '06_15_00.txt'
Let $CommandSystemVariable = getenv('COMSPEC')
Let $command_str = $CommandSystemVariable || '/C 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
Best of Luck,
Myron Dietz
Senior Programmer/Analyst
1800 East Imhoff
Norman, OK 73071
Phone (405) 360-5500 X 4604
Myron.dietz@omd.hitachi.com
The Difficult is that which can be done immediately; the Impossible that
which takes a little longer.
--George Santayana
"Wendel,
Robbi" To: SQR-USERS@list.iex.net
<rwendel@NESPO cc:
WER.COM> Subject: System Call to Copy &
Rename
Sent by: file
"Discussion of
SQR, Brio
Technology's
database
reporting
language"
<SQR-USERS@lis
t.iex.net>
06/19/00 01:37
PM
Please respond
to sqr-users
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