DCL problem -- redirecting SYS$INPUT -- please help! :-(
Date: 25 Jun 93 23:05:56 GMT
Message-ID: <Lc4P6B2w165w_at_vicuna.ocunix.on.ca>
Hello!
I am having a small problem with the redirection of SYS$INPUT from within a DCL script. Basically, I have a .COM file that can be called in either BATCH or INTERACTIVE mode, getting input from either the user or from a passed parameter as appropriate, does some stuff, calls Oracle RPT, and then cleans up and exits.
Regardless of what mode the program is run in, I try to redirect SYS$INPUT so that RPT can read required values in (such as period date, etc.). I've got it working this way with no problem...the problem I occur is when I try to redirect SYS$INPUT *back* to the original value it was set to.
Funny thing is, if I redirect SYS$INPUT back in interactive mode, everything works fine, but if I do it in BATCH mode (meaning SYS$INPUT will point once again to the internal DCL file, I believe) I run into problems.
Here, fully commented, is an excerpt of what I am trying to do. I left out the redirection for interactive mode -- since it works fine.
$! Do some initialization, create a temporary file with the passed parm. $! Create a view in SQL*Plus for use by the RPT report.
$ sqlplus / _at_sys$input
create view temp_view as
select surname, birth_date
from employee_table
where birth_date > '700101';
exit;
$!$ define/nolog sys$input 'OLD_INPUT' ! Point SYS$INPUT to original value.
$ open/write OUTFILE temp.tmp ! Create a temporary file.
$ write OUTFILE 'P1' ! Write the parm to it (period date).
$ close OUTFILE ! Close the file.
$!
$ OLD_INPUT=f$trnlnm("SYS$INPUT") ! Get the old value of SYS$INPUT
$ define/nolog sys$input temp.tmp ! Point SYS$INPUT to temporary file.
$ rpt report.rpt report.rpf / ! Run the report. RPT prompts for
$ ! period date & reads it from file OK.
$ rpf report.rpf report.lis -f ! Create the final report output file.
$! Now drop the temporary view. This part fails with an error reading $! the SYS$INPUT or something...
$ sqlplus / _at_sys$input
drop view temp_view;
exit;
$ exit ! That's all, folks.
So what is going on here, is VMS simply loosing it's place in the DCL script as far as SYS$INPUT is concerned?
What would be a good way to fix this...while not having to juggle with creating external scripts, etc...I like one .COM file and one .RPT file (and so does my boss).
Any information you could provide would be most appreciated. Please respond via e-mail to preserve bandwidth. If you decide to post, however, please note that I've directed follow-ups to comp.os.vms as this isn't *really* that much of an Oracle issue.
Thanks in advance!
+-------+< Unabashed Apache Indian Fan! >+------+-------------------+ | Steve Frampton - frampton_at_vicuna.ocunix.on.ca | Steve Frampton | | I collect postcards! If you send me one from | #2-286 Queen St. || your area, I'll send one in return. Send to >| Kingston, Ontario | | (Don't forget both email and mailing address) | CANADA K7K 1B8 |
+-----------------------------------------------+-------------------+Received on Sat Jun 26 1993 - 01:05:56 CEST