HP3000-L Archives

December 2007, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Joshua Johnson <[log in to unmask]>
Reply To:
Joshua Johnson <[log in to unmask]>
Date:
Sat, 1 Dec 2007 02:17:37 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (141 lines)
Hello,

When using FTP I have found that if a transfer fails part way into the
transfer then you end up with an incomplete file on the remote system. To
avoid incomplete files being processed. I have used a temp file name to
perform the initial PUT command, then when the PUT is complete I call REN to
give the file it's intended name. If the transfer fails the REN will never
happen and the receiver will know the transfer failed. If the remote file
exists or may exist you can call DEL first then PUT/REN. You must call
EXITONERROR before your DEL command so it won't exit if the file doesn't
exist, then EXITONERROR again after the delete command to set the flag back.
Another solution is to use a second confirmation file that could included
the EOF and/or byte count of the data file. Another problem I had was not
all errors caused FTP to exit when exitonerror was set (can't remember which
ones, too long ago). To determine the exact error I would colon to MPE and
set a variable before the command, then colon to MPE after the command and
set appropriate variables if it failed (snip example below). The variable
FTPLASTREPLY is very helpful along with FTPLASTERR. To make your $STDLIST
cleaner you can redirect the FTP output to a file and only display it if an
error occurred (run ftp.arpa.sys;stdin=*!_ft_tmpin;stdlist=*!_ft_list).

    echo EXITONERROR                                 >  *!_ft_tmpin
    echo :setvar _ft_lastcmd 'OPEN'                  >> *!_ft_tmpin
    echo OPEN !_ft_rmnode                            >> *!_ft_tmpin

    echo :setvar _ft_lastcmd 'USER'                  >> *!_ft_tmpin
    echo USER !_ft_rmuname                           >> *!_ft_tmpin
    echo !_ft_rmpass                                 >> *!_ft_tmpin
    echo :if lft(ftplastreply,2)='53'                >> *!_ft_tmpin
    echo :  setvar _ft_fail true                     >> *!_ft_tmpin
    echo :  setvar _ft_failuser true                 >> *!_ft_tmpin
    echo :endif                                      >> *!_ft_tmpin

Several years ago I wrote an application that was a front end for regular
FTP. It stored the user/password/remote directory, etc information in a
database accessed with a Cobol program. The rest was all CI script. It had
different configs for production/test/development environments so you could
move a job/program through environments without any code changes for remote
hosts, it would know where it was and use the configs for that environment.
It had a method to determine what FTP command failed and then if appropriate
would stage the transfer and keep trying until the server became
available/issue resolved (background job handled retries). It did the rename
thing of course and if the rename failed it would re-connect and delete the
temp file so it didn't clutter up remote servers. It could transfer a file
to multiple hosts with one call to the app. Then only stage hosts that
failed. Logging everything too of course. It would do GET and DIR on remote
hosts also. I have all the code if anyone is interested in FTP on steroids.
It has a Quick screen to put the configs into the database, but you could
use Query or Suprtool.

Joshua Johnson

-----Original Message-----
From: HP-3000 Systems Discussion [mailto:[log in to unmask]] On Behalf
Of John Pitman
Sent: Friday, November 30, 2007 10:03 PM
To: [log in to unmask]
Subject: Re: [HP3000-L] variable question

I have found setting passive to help make the transfer less likely to time
out on you. Uses a different no of ports or something.

jp
________________________________________
From: HP-3000 Systems Discussion [[log in to unmask]] On Behalf Of Olav
Kappert [[log in to unmask]]
Sent: Saturday, 1 December 2007 12:55 PM
To: [log in to unmask]
Subject: Re: [HP3000-L] variable question

Opps, I did not see the FTP.  So Dave is right.  You need to pipe in
your input if you are going to use FTP.  The only way to do that is to
echo everything needed for FTP into a file and use that as redirected
input..

Olav.

Dave Powell, MMfab wrote:

>First off, FTP can't expand variables, but :echo can, so you need to build
a
>file (any old temp file is ok), and redirect FTP's input to it, more or
less
>like:
>
>!FILE  FTPI = FTPI; REC=-72,,F,ASCII
>!ECHO exitonerror                            >>  *FTPI
>!ECHO verbose                                >>  *FTPI
>!ECHO open whatever           >>  *FTPI
>!ECHO user whoever>>  *FTPI
>!ECHO put !remotefile                   >>  *FTPI
>!ECHO quit                                   >>  *FTPI
>!
>!RUN FTP.ARPA.SYS    <   FTPI
>!IF  FTPLASTERR      <>  0
>!    some error routine, etc
>
>This will also give you better error checking if anything goes wrong.
>
>Also, you dont need the 1st 4 setvars that just dummy-out the variables you
>are going to set later.
>
>Also, it looks to me like your code would eat the leading zeros
single-digits
>months.  Try the "rht" function like Keven said
>
>----- Original Message -----
>From: "mag" <[log in to unmask]>
>To: <[log in to unmask]>
>Sent: Friday, November 30, 2007 13:58
>Subject: [HP3000-L] variable question
>
>
>hello,
>
>My file name,remotefile, is not coming out like I thought.  I am trying to
>name
>the file "cntr" and concatenate the month and year to the file name.  What
I
>am getting is  this : "!file_name".  Can you see what I am doing wrong?
>Thanks!
>
>!setvar file_name ' '
>!setvar remotefile ' '
>!setvar mon ' '
>!setvar yr ' '
>!setvar mon '!hpmonth'
>!setvar yr '!hpyear'
>!setvar file_name 'CNTR!mon!yr'
>!setvar remotefile "!file_name"
>!COMMENT
>
>!FTP
>OPEN
>USER
>!put !remotefile
>

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2