[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FTP_PUT
Sender: Scott Klement <sk@xxxxxxxxxxxxxxxx>
Hi Al,
I am doing an ftp_put and I need to append the day of the month to the
name of the file I am "putting" to the FTP server. e.g. the June 1st
file would be filename01 June 2nd would be filename02 etc.Is there any
way I can do this without coding 31 ftp_put's and choosing the one that
corresponds to the day of the month?
It's perfectly okay to use variables or even expressions for the names
of the files that you'd like to PUT. For example:
D local s 100A
D remote s 50A
D day s 2A
.
.
c eval local = '/acct/receivables/statement'
c + %editc(CustNo:'X') + '.pdf'
c move *day day
c eval remote = 'filename' + day
.
.
c if ftp_put(sess: remote: local) < 0
c eval Msg = ftp_errorMsg(sess)
c** "MSG" contains the error message. Show it to the user.
c endif
Or, if you wanted to be a little more fancy, the following code would also
work, and eliminate the need for the extra variables. I guess it depends
on how comfortable you are with expressions
c if ftp_put(sess
c : 'filename'
c + %editc(%subdt(%date():*DAYS):'X')
c : '/acct/receivables/statement'
c + %editc(CustNo:'X') + '.pdf'
c eval Msg = ftp_errorMsg(sess)
c** "MSG" contains the error message. Show it to the user.
c endif
Of course, you could use /FREE to make the code a little easier to read
(the long expressions can be difficult to line wrap, etc)
Anyway, FTPAPI gives you the flexibility to do it however you like.
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------