[comp.os.vms] Redirection of IO...

STODGHIP@DICKINSN.BITNET ("Jam Fan ", Stodghill, Paul) (08/20/87)

I have a question for all the VMS gods out there. How do I do this,

        $ define/user sys$input input.dat
        $ define/user sys$output output.dat
        $ run the_program

within a program (.EXE as opposed to .COM). The following call will not work

        LIB$SPAWN('run the_program','input.dat','output.dat',...)

because after executing 'run the_program' LIB$SPAWN tries to execute INPUT.DAT
I'm working on a program to do general redirection of IO and this problem has
me at a stand still. Could someone help me?

                                        -- Paul Stodghill
                                           Bitnet: STODGHIP@DICKINSN.Bitnet
                                           USMail: Computer Center
                                                   Dickinson College
                                                   Carlisle, PA  17013

carl@CITHEX.CALTECH.EDU (Carl J Lydick) (08/21/87)

 > I have a question for all the VMS gods out there. How do I do this,
 > 
 >         $ define/user sys$input input.dat
 >         $ define/user sys$output output.dat
 >         $ run the_program
 > 
 > within a program (.EXE as opposed to .COM). The following call will not work
 > 
 >         LIB$SPAWN('run the_program','input.dat','output.dat',...)
 > 
 > because after executing 'run the_program' LIB$SPAWN tries to execute
 > INPUT.DAT I'm working on a program to do general redirection of IO and this
 > problem has me at a stand still. Could someone help me?

The problem is that the logical names created by LIB$SPAWN aren't USER_MODE.  
The only simple workaround I know of is to create a file with the commands:
        $ define/user sys$input input.dat
        $ define/user sys$output output.dat
        $ run the_program
in it, then use lib$spawn to create a process with that file as its input.