Operating System - OpenVMS
1752375 Members
5879 Online
108787 Solutions
New Discussion юеВ

How copy file form detached process?

 
SOLVED
Go to solution
Antoniov.
Honored Contributor

How copy file form detached process?

I have to write a little program using C language; this application have to copy file from a source folder into various folder.
Program runs in detach mode; I used LIB$SPAWN system routine but doen't work (exit status = %X7FF58005 I don't known).
I think this happens because deteched process has not a CLI (Command Language Interpreter) so it isn't possible execute a DCL command.
How can I do this?
Also, sometimes I have to send the file to another node using FTP.

Tahnks to all
Antoniov
Antonio Maria Vigliotti
15 REPLIES 15
├Еge R├╕nning
Trusted Contributor

Re: How copy file form detached process?

A CLI is mapped to your process by a system image called SYS$SYSTEM:LOGINOUT.EXE. When a detached process is created without executing LOGINOUT.EXE, a CLI is not mapped to the process.

Solution:

$! Create a command procedure that just has the RUN program command,
$! This procedure is the /INPUT for the RUN/DETACH command below.
$
$ create detach.com
$ RUN detach.exe
$!

$! Run loginout.exe as the image to create the detached process
$!
$ RUN/DETACH/ERROR=detach.err/OUTPUT=detach.out/INPUT=detach.com -
sys$system:loginout.exe
$!

The procedure to use with SYS$CREPRC is the same. Pass SYS$SYSTEM:LOGINOUT.EXE as the "image" and pass "detach.com" as the
"input".

VMS Forever
Ian Miller.
Honored Contributor

Re: How copy file form detached process?

There isn't a callable copy but you can use the convert routines see http://h71000.www7.hp.com/doc/731FINAL/4493/4493pro_006.html#4493_conv_chap

or the backup api (VMS V7.1 and later) - see
http://h71000.www7.hp.com/doc/731FINAL/4493/4493pro_001.html#4493_bu_chap
____________________
Purely Personal Opinion
Craig A Berry
Honored Contributor

Re: How copy file form detached process?

Other options including grabbing the rmscopy routine from [.vms]vms.c in the Perl sources or searching for fast_io_copy.c in the comp.os.vms archives. The latter uses the $IO_PERFORM interface (also demonstrated in SYS$EXAMPLES:IO_PERFORM.C).

There was a recent discussion of callable FTP on comp.os.vms. There's more than one way to do it, depending on your TCP/IP stack.
Vouters
Advisor

Re: How copy file form detached process?

Hi Antoniov,

This example might be a little too complicated to fit your needs and you might simplify it but here is a C program you might use to replace your lib$spawn call to a sys$creprc call and also using the persona system calls.
If you also have Visual C++ on your PC computer, you might also give it a try.
http://h18000.www1.hp.com/support/asktima/communications/00A16286-AD980927-1C02A1.html
Hoping this can help you in your daily job.
Regards,
Philippe
Antoniov.
Honored Contributor

Re: How copy file form detached process?

Hi Age,
I hasn't tought to LOGINOUT that's a good idea but my example doesn't work.
You can see attachment.
Where do I wrong?

Bye
Antoniov
Antonio Maria Vigliotti
Antoniov.
Honored Contributor

Re: How copy file form detached process?

..and here there is the 2.nd attachment.
Antonio Maria Vigliotti
Antoniov.
Honored Contributor

Re: How copy file form detached process?

Hi Ian,
I've already user convert, mey be a good idea if I don't find a ready-to-use routine.
I never user backup routine, but some my oldest customer still works with OVMS 6.1 (yes the very old version) so, if is possible, I prefer use convert.

Thanks
Antoniov
Antonio Maria Vigliotti
Antoniov.
Honored Contributor

Re: How copy file form detached process?

Hello Craig,
I've found IO_PERFORM.C; now I'm reading it to understand as working then I'll compile to try.
I'll post the result.

Thanks
Antoniov
Antonio Maria Vigliotti
Antoniov.
Honored Contributor

Re: How copy file form detached process?

Hello Philippe,
same answer to Craig.

To all
I believe does exist a simple solution but there nothing simple using computer.
Now I'm trying the prio .C examples.

Thanx
Antoniov
Antonio Maria Vigliotti