HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

How to run "set file/attrib" from an FTP client?

 
SOLVED
Go to solution
Matthew Beermann
Occasional Visitor

How to run "set file/attrib" from an FTP client?

I'm writing a program that will be uploading files via FTP from a Microsoft Windows box to OpenVMS. I've noticed that the resulting file ends up with the wrong attributes. Specifically, I need to run set file/attrib=(rfm:stmlf,rat:cr) afterwards.

My question is, how do I do this from the FTP _client_, or get VMS to choose the correct format in the first place? I have to assume that in general no interactive login to the OpenVMS box will be available, and thus I can't issue the command from the console.

I apologize if this has been asked before, but I couldn't find the answer in the Ask the Wizard archives...

Client: Microsoft Windows SP2 FTP
Server: OpenVMS 7.3-2, MultiNet V4.4(91)
13 REPLIES
Jan van den Ende
Honored Contributor

Re: How to run "set file/attrib" from an FTP client?

Matthew,

I know of no way to do that (but I do not know Multinet, if someone knows a Multinet solution..?)

However, we have a solution for automatically processing files received via ftp, and your request amounts to simple processing.
This assumes:
- a dedicated account to receive the files.
- no other uses for that account.
Since you are now writing the program, I will asume that you can (arrange to) meet these requirements.

The account will have NETWORK and BATCH access, but NO INTERACTIVE. The SYS$LOGIN has (at least) two subdirectories.
The files are ftp'd to one of those.
The account will have a LOGIN.COM which,
IF F$GETJPI("","mode") .eqs. "NETWORK"
submits a batchjob /AFTER=
The batchjob will test the existence of the network job, if present, just wait a little and retry.
RENAME the received file away from the tranfer directory, and do you thing with it. (Maybe you need to do more processing? This is also a nice way to get rid of the ugly polling for a received file, and just get riggered by the receipt of the file.

I leave it up to you to do the checking for multiple simultanious files etc.

Succes!

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Thomas Ritter
Respected Contributor

Re: How to run "set file/attrib" from an FTP client?

Matthew, we perform these types of activities. Write a DCL command procedure to perform the FTP. After successfully getting the file execute the appropriate DCL commands.
Some advice: always "get" files using some temporary name. Only after a successful "get" or "put" rename the file to that expected. This way should the transfer be interrupted, the receiver will not process an incomplete file. We perform hundreds of FTP per day. Simple things like this can prevent a lot of time wasting.

Some example code:
$ ftp 192.168.0.1/username=secret/pass=secret
get data.txt data.tmp
bye
$ if $severity .and. 1
$ then
$ rename data.tmp *.txt
$ endif
$ set file ...
$ ...
Jan van den Ende
Honored Contributor

Re: How to run "set file/attrib" from an FTP client?

Thomas,

in principle, that WOULD work, but if, and ONLY if, the receiving {VMS) system would/could somehow be in control.
If, however, the transfers are generated "just when", you would need quite elaborate procedures to login to VMS and get this done, which WOULD conradict the prerequisites if I read them correctly.

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Steven Schweda
Honored Contributor
Solution

Re: How to run "set file/attrib" from an FTP client?

Should we assume that you're using type
ASCII FTP transfers, and getting attributes
like "Record format: Variable length"? If
not, what should we be assuming?

I know nothing about the MultiNet FTP
server, but a quick Google search for

vms OR openvms multinet ftp server file format

found "Chapter 18, MultiNet v4.4
Installation and Administrator's Guide",
which mentions the "site" command, and it
seems to offer some hope. I quote:

SITE SPAWN command

Spawns a subprocess and uses the rest of the
line as a VMS DCL command. Not valid for
CAPTIVE processes.


If that does what I think it might, then it
looks as if it might be able to handle a SET
FILE /ATTR command. I don't have a
convenient MultiNet FTP server on which to
test my hypothesis. (I assume that if you
can manage a PUT command from your program,
that you can also manage a (fancy) SITE
command.)

Apparently, SPAWN enablement is optional,
and may be set independently for individual
users.

Nothing similarly fancy seems to exist for
the HP TCPIP FTP server.
Thomas Ritter
Respected Contributor

Re: How to run "set file/attrib" from an FTP client?

Use ftp> help/remote to see what multinet can support with the "quote" command.
On VMS we have

FTP> help/remote
214-The following commands are recognized:
USER TYPE RETR RNFR NLST PWD ALLO EPSV
PASS STRU STOR RNTO CWD CDUP SYST QUIT
SITE PORT STOU DELE MKD NOOP STAT HELP
MODE EPRT APPE LIST RMD ABOR PASV
214 End of Help.
Steven Schweda
Honored Contributor

Re: How to run "set file/attrib" from an FTP client?

> Use ftp> help/remote [...]

Except that this tells you about FTP
commands, which is not what we want here
(at least so long as it includes SITE, which
_is_ what we want here).

Note that "help/remote" on the TCPIP FTP
client is equivalent to "quote help" on
practically any other FTP client. (And
"quote help" works on the TCPIP FTP client,
too.)

What would be more useful would be:
ftp> site help

which might give a more helpful response
than this one from my TCPIP V5.4 - ECO 5 FTP
server:

214-The following SITE commands are recognized:
214 VMS +VMS+ ULTRIX UNIX NONE

That's where it'll say SPAWN (if anywhere),
and if it does, then you should be in
business.
Steven Schweda
Honored Contributor

Re: How to run "set file/attrib" from an FTP client?

> ftp> site help

Oops. Make that:

ftp> quote help site

This stuff isn't complicated. Really.
Richard Whalen
Honored Contributor

Re: How to run "set file/attrib" from an FTP client?

The "SITE SPAWN SET FILE/ATTRIBUTE..."
will do the job, but make sure that you need to do this. If you are doing a (default) ASCII upload to VMS from Windows, then the FTP server is converting the FTP text stream to the common VMS format of a variable length record, carriage return carriage control file. If you really want a stream file to be written, then you need to use the SITE RMS STREAM ON command.
Steven Schweda
Honored Contributor

Re: How to run "set file/attrib" from an FTP client?

Plus, if you expect SET FILE /ATTR to work,
then an ASCII file transfer would be the
wrong thing to do. After an ASCII transfer
which produced a RFM:VAR file, you'd need to
CONVERT it, not just change its attributes.

After a _binary_ transfer the bits should be
ok, but the attributes may be something like
fixed-512 instead of Stream_LF, and in that
case, SET FILE /ATTR could do the job.

But, yes, after a little more manual reading,
it sure looks as if SITE RMS STREAM ON would
be _the_ thing to do.

As usual, it helps to ask for the best
solution to the problem, _not_ for the best
way to implement a sub-optimal solution to
the problem. But sometimes you get lucky,
and someone (else, in this case) provides the
answer to the un-asked question instead of
the asked question.
Andy Bustamante
Honored Contributor

Re: How to run "set file/attrib" from an FTP client?


Is the Windows client on the same local network segment as your Alpha? Pathworks32 provides an "unsupported" NFT executable for the Windows world, allowing you to submit a batch job from the client. In your upload script, you would add a submit command to start a batch job on the VMS side. Although this is "unsupported" we continue to use this functionality.

Andy Bustamante
If you don't have time to do it right, when will you have time to do it over? Reach me at first_name + "." + last_name at sysmanager net
Matthew Beermann
Occasional Visitor

Re: How to run "set file/attrib" from an FTP client?

Thanks, all, for the help. "site spawn set file/attrib..." does indeed do the trick (and it also helped me find the UNIX counterpart, "site chmod...").

For the record, the reason I needed to apply those particular attributes after the upload is that Java needs them in order to read a jar properly. http://h18012.www1.hp.com/java/documentation/1.4.2/ovms/docs/user_guide.html#binary
Sebastian Bazley
Regular Advisor

Re: How to run "set file/attrib" from an FTP client?

In which case, another way is:
* zip the jar files on Windows
* copy the zip using binary mode.
* unzip them on VMS (Info-Zip)

The jars will have the correct characteristics.
Matthew Beermann
Occasional Visitor

Re: How to run "set file/attrib" from an FTP client?

Thanks, all, for the help. "site spawn" it is.