1752667 Members
5544 Online
108788 Solutions
New Discussion юеВ

FTP command file issue

 
SOLVED
Go to solution

FTP command file issue

Hello, I have a niggle - I've written a .com file with an 'FTP server user pass' line in, but when it's run it immediately logs out.
What am I doing wrong?
14 REPLIES 14
Hoff
Honored Contributor
Solution

Re: FTP command file issue

OpenVMS V6.2 with its contemporary IP stacks introduced the COPY /FTP command, which is usually vastly easier to incorporate into a DCL command procedure.

http://labs.hoffmanlabs.com/node/136

As for what's wrong with your particular DCL code here, you'll want to post that code, how you're invoking the code ("immediately logs out" can be indicative of a user-mode coding error in some contexts, or of an inner-mode and thus more serious error in others), along with some information on which IP stack and version and ECO level is in use here, and the OpenVMS version.


Duncan Morris
Honored Contributor

Re: FTP command file issue

Dave,

please make a text file copy of the command procedure and post it as an attachment.

Without this information, we will be left guessing in the dark.

Duncan

Re: FTP command file issue

$ ftp serv /USERNAME="user" /PASSWORD="pass"
$ put test.ops "TEST.OPS"
$ ascii
$ quit

It gets as far as logging in then comes back with a '221 goodbye'.

Re: FTP command file issue

I meant to add, when i run each line manually it all works correctly.
Craig A
Valued Contributor

Re: FTP command file issue

Try:

$ COPY/FTP/ASCII/LOG TEST.OPS -
SERV"username password"::

Craig

Re: FTP command file issue

Should've added that the put test.ops "TEST.OPS" was because it's going onto a UNIX box, and I need it in uppercase.
Hoff
Honored Contributor

Re: FTP command file issue

The put and quit and such are ftp commands and are not $ DCL commands, and just as soon as the $ ftp command connects, the EOF that arises when an application (FTP) reads its data encounters a $, the connection gets torn down.

If this is V6.2 or later, use this:

$ COPY /FTP /ASCII test.ops -
server"user pass"::TEST.OPTS
$

If this is older or if you want to use the hard way, then use this:

$ ftp serv /USERNAME="user" /PASSWORD="pass"
ascii
put test.ops TEST.OPS
quit
$

And the next thing you'll usually encounter with "the hard way" is that you can't do DCL symbol substitution in the commands, which means you need to use a custom-created file for the transfer and @ it.

http://labs.hoffmanlabs.com/node/1339

An example of building a data file from DCL:

http://labs.hoffmanlabs.com/node/163

If you're just getting going with DCL and DCL procedures, have a look at the User's Guide in the OpenVMS manual set, too.
Hoff
Honored Contributor

Re: FTP command file issue

> I meant to add, when i run each line manually it all works correctly.

I would doubt you entered ftp> $ put

In a DCL procedure, the $ is a flag that indicates "this is a DCL command". Bash doesn't have something similar here, if you're coming over from Unix. The $ differentiates between commands and data. Commands have symbol substitution and other such, and data does not. And the very first $ that an application reads is treated as an EOF for the application command input.

Unless you need to use a leading $ on your application input data, and then you use $ DECK and $ EOD commands. Which is described here:

http://labs.hoffmanlabs.com/node/1339

Hoff
Honored Contributor

Re: FTP command file issue

ps: please always post your OpenVMS version and architecture. With that detail (for instance, in this case), we can tell if COPY /FTP (or some analogous mechanism) is an option, or whether there are other ways to get the file specification replicated over to the Unix box in the appropriate file case.