[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: INTERACTIVE AND BATCH modes
> My code so far goes as follows:
> let $system_call = 'IF F$MODE() .NES. 'BATCH' THEN
> MODE_TEST:="INTERACTIVE" '
>
> call system using $system_call #status
>
> let $mode = getenv('MODE_TEST')
> ..
> ..
> ..
>
> I've also tried let $system_call = 'MODE_TEST:=F$MODE()'
>
> The main issue is that the SYMBOL MODE_TEST doesn't seam to be
> getting assigned. I've debuged the code to see what's getting what
The first "trick" is that, under VMS, the "getenv" function looks at
logicals, not symbols. Thus, something like this should work:
let $system_call = 'define/job/nolog MODE_TEST ''F$MODE()'
You need the /job so that the logical define is not tied to the spawned
subprocess but rather to the whole job; otherwise it would be vanish
before execution returned to your SQR program. The /nolog prevents a
warning message from being printed if MODE_TEST already has a value (such as
if you ran the program more than once).
However, my tests show that when you use CALL SYSTEM USING, the F$MODE() is
not evaluated they way it would be on the command line or in a .COM file.
A work-around would be to use your "if" idea:
let $system_call = 'if f$mode() .eqs. "INTERACTIVE" ' ||
'then define/job/nolog "INTERACTIVE" '
You could also create a .com file that contained the line
$ define/job/nolog MODE_TEST 'F$MODE()
and call that .com file from the CALL SYSTEM USING.
(It might be easier to simply put
$ define MODE_TEST 'F$MODE()
login.com or something like that; then you wouldn't need to spawn from
within the SQR, and the define would run only once per login.)
Nathan
----------------------------------------------------------------------------
Nathan Treadway | Ray Ontko & Co. | info@ontko.com (auto-reply server)
nathant@ontko.com | Richmond, IN | ftp.ontko.com, http://www.ontko.com/