Operating System - OpenVMS
1748283 Members
4012 Online
108761 Solutions
New Discussion юеВ

Re: DCL script to FTP files

 
Robert Gezelter
Honored Contributor

Re: DCL script to FTP files

Ben,

Personally, I have used bare FTP and COPY/FTP. As Hoff has noted, whether COPY/FTP exists depends on the version of OpenVMS with which one is dealing.

That said, if one is dealing with different versions of invoking FTP, in many cases one can deal with this by defining a DCL symbol for FTP (e.g., FTPUTILITY to avoid confusion) whose value is either "FTP" or "MULTINET FTP" (or others) depending on what is available on that node. That way, the dependency is limited to a a highly localized point in the script (you may guess why I make this recommendation).

I do not disagree with Hoff's comments, however, FTP is often used as a lingua franca between a variety of systems, and thus may be unavoidable, despite its age and admitted security-related drawbacks.

- Bob Gezelter, http://www.rlgsc.com
Richard Whalen
Honored Contributor

Re: DCL script to FTP files

Though MultiNet 4.0 is very old, it looks like it should support COPY/FTP.
John Gillings
Honored Contributor

Re: DCL script to FTP files

Seconding (or 3rd or 4th) to use COPY/FTP - it covers most cases. If you have something tricky, say creating directories, instead of writing a file from your procedure then executing it, just write it to SYS$OUTPUT

FTPCMD.COM
$ wo="WRITE SYS$OUTPUT"
$ wo "cd /VAX/OUT/SHARE/"
$ wo "put ''source_file' ''target_file'"
$ wo "bye"

You can execute the procedure and PIPE it into an FTP command to be executed:

$ PIPE @FTPCMD | -
FTP/INPUT=SYS$PIPE 10.37.2.23 /username=ftp_to_share/password="1password23"

The PIPE can, of course be inside a procedure. Saves all the hassle of dealing with temporary files.
A crucible of informative mistakes
Sam Samalsson
Occasional Visitor

Re: DCL script to FTP files

$ copy /ftp /log /ascii -
$1$dga418:[ftp.temp]*.*;* -
192.168.249.12"UserName PassWord"::"ftp-temp/"

You may use logicals and/or symbols instead
og the specifics
The Brit
Honored Contributor

Re: DCL script to FTP files

The other BIG advantage of using the "copy/ftp" command is that it returns $status and $severity, which allows error handling on failed copies. (this is much more complicated when using FTP from within a command file).

Dave.
Craig A
Valued Contributor

Re: DCL script to FTP files

For those people who use COPY/FTP can I ask how you deal with potential network glitches that could cause the command to not complete?

How do you ensure that files are not left "hanging"?

Cheers

Craig
Steven Schweda
Honored Contributor

Re: DCL script to FTP files

> How do you ensure that files are not left
> "hanging"?

What's a "hanging" file?

If the command hangs, then you can pretty
safely conclude that the transfer was not
complete. If the command completes, then its
status value should tell you whether the
command succeeded or failed. Right?

If you want a serious test, then suck the
file back in, and compare it with what you
sent. Or start using fancy checksums or
other data integrity tests. (A truncated
Zip archive, for example, will be identified
as corrupt by any reasonable UnZip program.)

Many things are possible. What's your goal?
Craig A
Valued Contributor

Re: DCL script to FTP files

Steven

I take the view that that the network link will always fail at the most inopportune time.

Therefore, I wish to mitigate the effect of a transfer failing and, thus, potentially causing a remote trigger job from picking up a file fragment.

On that basis, I can think of no useful reason to use COPY/FTP rather than a script that has a degree of intelligence in it.

Craig


Steven Schweda
Honored Contributor

Re: DCL script to FTP files

> Therefore, I wish to mitigate the effect of
> a transfer failing and, thus, potentially
> causing a remote trigger job from picking
> up a file fragment.

I always wonder how a "remote trigger job"
can distinguish between a partial transfer
and a complete transfer. Everything's
complicated.

Did the original inquiry here mention any
"remote trigger job"? Why work hard to solve
a problem which doesn't exist (here)?

> On that basis, I can think of no useful
> reason to use COPY/FTP rather than a script
> that has a degree of intelligence in it.

_I_ wasn't the one who was pushing COPY /FTP,
but it certainly "has a degree of
intelligence in it." On the other hand, to a
casual reader, it's not immediately obvious
where all the "intelligence" might be in the
scripts/fragments exhibited here, so far. I
can _imagine_ writing a fancy script which
would detect a hung transfer, but that script
might or might not use COPY /FTP.

If it does what you want, then use it. If
something else is better at doing what you
want, then use _that_. I don't care. In any
case, deciding exactly what to do often
requires knowing exactly what you want to do.
"How do I make FTP work" is not a detailed
enough problem specification to get me all
excited about the relative merits of using
COPY /FTP or some other FTP client.
Jim_McKinney
Honored Contributor

Re: DCL script to FTP files

> I can think of no useful reason to use COPY/FTP

Don't know what the trigger is for your remote processing but it seems that if you want to drive it from the FTP client side you could just base the trigger decision on whether or not the COPY/FTP returned a successful status. Or, if you're driving the processing of the transferred file from the remote end you might choose to do something like transfer a FILE.TRIGGER (could even be zero blocks) upon a successful transfer status from the COPY/FTP of the FILE.DAT and have the remote end use the presence of that file as an indicator that the transfer was successful and as a trigger for processing.