Subject: | |
From: | |
Reply To: | Emerson, Tom # El Monte |
Date: | Thu, 14 Oct 1999 16:23:19 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
> -----Original Message-----
> From: Abraham Zwygart [mailto:[log in to unmask]]
>
> Hi all,
>
> I need to move a file from the hp3000 979 to a Novell server.
> I have done
> this in the past and have had no problem. This is the first
> time that I
> used variables in the ftp process and it dose not seem to
> work. The file
> being transferred is created daily and has the creation date
> in the file
> name.
> [snip setup]
> :FTP
> File Transfer Protocol [A0008S33] (C) Hewlett-Packard Co. 1990
> [snip to command that fails]
> ftp> put CU!_YEAR!_MONTH!_DAY
> NONEXISTENT PERMANENT FILE (FSERR 52)
> Data Transfer Request Failed. (FTPERR 13)
>
> Is the variables not working because I am in a program?
Bingo -- yes, at that point the "command line" is not being parsed by
MPE/iX's command interpreter, but rather by FTP's command parser.
> Is there a way to define the file name in the jobstream for the ftp
process to work?
Since the command "FTP" runs FTP.ARPA.SYS, you can do the following:
!echo open remote.system.name >ftpcmds
!echo user myself >>ftpcmds
!echo pass hidden >>ftpcmds
!echo cd /mp/prod/custserv/order_re >>ftpcmds!
!echo put CU!_YEAR!_MONTH!_DAY >>ftpcmds
!echo quit >>ftpcmds
!run ftp.arpa.sys <ftpcmds
Interestingly enough, you can insert ":" commands into FTP and it will
execute them "back" at the CI level. For instance, you can use ":listf" at
the FTP prompt to get a listing from the LOCAL machine -- this is directly
synonymous to using "!" in "unix" oriented FTP clients.
Because of that, you can ALSO insert :IF commands into the ftp command
stream, and it works (to some degree) If the expression ends up being
false, FURTHER ":" commands will not be executed (until an :ELSE or :ENDIF
command is encountered) although further FTP commands will still continue to
execute. Here is a useful approach to using this fact: [note: I'm using
both STREAMX and MPEX features in this example]
%runCREATE FTP.Arpa.sys
%RUNinput open {server} <<-- "server" is a STREAMX variable set earlier
%runinput user anonymous
%runinput pass [log in to unmask]
%runinput cd /pub/incoming
%runinput binary
%repeat
%setvar filetosend "![rfile.file]"
%setvar flagtosend "![rfile.file]F"
%if ![rfile.eof] <> 0
% runinput put ./!filetosend
% runinput :IF FTPLASTERR=0 THEN
% runinput :purge ./!filetosend
% runinput :echo process this file !>./!flagtosend
% runinput :endif
% runinput put ./!flagtosend
% runinput :setvar FTPLASTERR 0
%else
% runinput :purge ./!filetosend
%endif
%forfiles /CCV/PUB/M[CT]######
%
%runinput quit
%runactivate
In this example, the files to be sent/processed are similar to what you're
doing -- they contain the month and day they correspond to in the filename.
A "flag" file, which is the same filename but with an "F" suffix, is created
ONLY if the file successfully transferred to the remote machine [and by the
same token, the source file is deleted from the local host...]
In MPEX, runCREATE, runINPUT, and runACTIVATE does all the behind-the-scenes
work of building an input file, loading the file with reasonable commands,
and ultimately running the program with input re-directed to this file.
|
|
|