Thanks much for the help Scott and Buck,
I've got the file coming in ok now :-)
One thing that does not seem to be working
well is when I pull the file in to my local iSeries, the data is not coming
over record by record, it's filling the destination physical file up in
one long stream. I've tried both without having the destination file
present in the target library and then with the file present and it did
not seem to matter.
As with before, it is probably something
basic, but I did not see anything in the API code or examples that referenced
this sort of get scenario.
Thanks again for the help and sorry
to be such a pain with entry level questions.
Brian
Scott Klement <sk@xxxxxxxxxxxxxxxx> Sent by: owner-ftpapi@xxxxxxxxxxxxx
02/04/2005 11:10 AM
Please respond to
ftpapi@xxxxxxxxxxxxx
To
ftpapi@xxxxxxxxxxxxx
cc
Subject
Re: Changing Local Directory
Sender: Scott Klement <sk@xxxxxxxxxxxxxxxx>
> I am working on some programs that will use FTPAPI. I've looked
at some
> of the sample programs and I am not 100% sure of how to handle changing
> the local directory on the iSeries that I want to receive files in
to.
Remember, you're writing an RPG program! This is very different from
writing an FTP script for IBM's FTP command. In the case of an FTP
script, you're limited to only commands that the FTP client understands.
An RPG program can do just about anything that you can imagine.
So, your question could be re-phrased as "How do I change my current
IFS
directory in an RPG program?" You don't use FTPAPI, you use
the chdir()
IFS API, or you call QCMDEXC and run the CHDIR CL command.
There are examples of this in the "TESTMIRIN" sample program
that comes
with FTPAPI.
> I believe the default is to put the files in to the IFS. I see
there is
> a NAMEFMT command, so I think maybe I should use that, but I wanted
to
> ask.
NAMEFMT has nothing to do with where files end up. It has to do with
the
format of the filenames that you pass.
To specify a file called 'BLAH' in library QGPL using namefmt 1 (which
is
the only one that FTPAPI supports) you'd code:
/QSYS.LIB/QGPL.LIB/BLAH.FILE/BLAH.MBR
You can specify anything in your system via IFS pathnames. They're
not
just limited to PC style stream files.
FTPAPI does not support 'NAMEFMT 0' if you execute the FTP_NAMFMT() API
to
change the nameformat, it will only change it ON THE SERVER, it won't
change it in FTPAPI.
(If I had a dime for every time I explained this...)
> On a related note, my practice in the past has been to pull the files
from
> the remote server in to the DB2 side of the iSeries, since the data
is
> typically text only and many times is coming from another iSeries.
Would
> I be better off to pull the file to the IFS?
Depends on what you're doing. If the file is text stream file, then
I'd
say yes -- the IFS is a better place. If it's a database file or
a save
file, then obviously that wouldn't work as well.
If this is data that you're going to read immediately, process, and then
delete the file, you might consider using the FTP_getraw() API as an
alternative. In that case, you'd read the data directly into your RPG
program and wouldn't need to save it to a file at all.
But, in any case, you need to use namefmt 1 for the peLocal parameter
to the FTP_put() or FTP_get() API calls. You can only use namefmt
0 for
the peRemote parameters, and only when you're talking to an iSeries FTP
server.
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubsribe from the list send
mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------