Operating System - OpenVMS
1748252 Members
3975 Online
108760 Solutions
New Discussion

FTP and OpenVMS command file symbols

 
Rich Bordewick
Advisor

FTP and OpenVMS command file symbols

Hello,

I am attempting to spawn a command file to use FTP to transfer a file.  The spawn command spawns the string "@CommandFile FileToTransfer".

The statement in the command file "Sho Sym 'P1'  lists "FileToTransfer".  But the FTP command

Put 'P1' 'P1'

does not translate P1.

I am working with OpenVMS V8.3-1H1 on an Itanium HP Integrity 2660.

Any suggestions?

6 REPLIES 6
abrsvc
Respected Contributor

Re: FTP and OpenVMS command file symbols

If the following is what you are entering, it should work. 

$ SPAWN @CommandFile FileToTransfer

The value "FileToTransfer" should be interpreted as P1 for the procedure.  Note the following as a test that works:

===============

$ Cre test.com

$ Write sys$output "''p1'"   ! note the double quote followed by two apostrophes before the p1

$exit ! CTRL-Z

$ spaw @test test

==================

If you are following the same pattern and it does not work, please post the exact procedure used.

 

Dan

The above should print out the word test on the terminal.

 

 

abrsvc
Respected Contributor

Re: FTP and OpenVMS command file symbols

Missed the actual problem...

If you are attempting to translate P1 once you have invoked FTP, it wont work.  To do what you want may take a extra step or two.  Please describe EXACTLY what you are trying to do so we can provide a simple solution.

Dan

Steven Schweda
Honored Contributor

Re: FTP and OpenVMS command file symbols

> Please describe EXACTLY what you are trying to do [...]

   Usually a good idea.

   On VMS, scripting the simple FTP client may be difficult.  In many
cases (especially single-file transfers), COPY /FTP can be much easier.
(But may be less efficient for multi-file transfers, using a new
connection for each one.)

      help copy /ftp

   For fetch ("get") operations, Wget can work well.  There exists a
Wput program for doing "put" operations, and I may have an old one lying
around somewhere, but no bets on its condition.  I don't use it, but
cURL could be worth a look, too.

      http://antinode.info/dec/sw/wget.html

Steven Schweda
Honored Contributor

Re: FTP and OpenVMS command file symbols

> I am working with OpenVMS V8.3-1H1 on an Itanium HP Integrity 2660.

   For future reference, actual output from:

      tcpip show version

can be more informative than any (less complete) summary.

H.Becker
Honored Contributor

Re: FTP and OpenVMS command file symbols

It would have helped if you showed your command procedure - with sensitive information removed.

P1 is a DCL symbol (or variable), which is only substituted (or expanded) in the DCL context. When you enter the FTP command you can use DCL symbols for the command arguments/parameters. But once the FTP program runs and prompts you for an FTP command you are no longer in a DCL context. The PUT command is in the program context and there P1 has no definition (or value).

You need to let DCL substitute the symbols and write that to the input for FTP. FTP reads its input from SYS$INPUT or whatever you direct it to with /INPUT. So either redirect SYS$INPUT or use /INPUT.

Usually this is done by writing an input file - in the DCL context, so with the WRITE command. You can use the PIPE command and WRITE to write the SYS$INPUT for FTP, something like

$ pipe write sys$output "put ''p1' ''p1'" |ftp host/username=remote-username/password=remote-password

Obviously you need to have the remote username and the password in this command. I don't know how you did this in your command procedure and whether this is OK in your environment.

And then there are other tools for example COPY/FTP, which are easier to use from the DCL command line - that is with DCL symbols.

Hoff
Honored Contributor

Re: FTP and OpenVMS command file symbols

The preferred command for network file transfers is scp or sftp with the "-B" option and with certificates in place of passwords (and an ssh and sftp intro), but — if complete data insecurity, well-known problems with network firewalls, and the exposure of server passwords don't dissuade you — then use the COPY /FTP command here. 

DCL symbol substitution is only available at the $ DCL command prompt (either prompting interactively, or within a command line within a DCL command procedure beginning with $); when DCL is prompting and processing the command.   Within a tool or a utility such as FTP or from from within the OpenVMS linker, no DCL symbol substitutions are honored.

Please also upgrade to HPE OpenVMS I64 V8.4 with current OpenVMS patches, or potentially to VSI OpenVMS I64 V8.4-2; to a more recent release