[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Writing Files to IFS



Sender: Scott Klement <sk@xxxxxxxxxxxxxxxx>


1st, thanks for replying to my question in Midrange-L (Enumerating Files).
I thought about your reply and looked at possibly (after downloading all
files using MGET) appending all the data together from the FTP'd files
(they'll all have the same format) to a file in qsys.lib file system.

Take a look at TESTMGET (rather than TESTGET) Notice the FTP_list() subprocedure? What that returns is a list of files on the FTP server into an array in your program.


When you run through the DO loop that follows this function, it's looping through the array and calling the FTP_get() procedure for every file in that directory (and therefore performing an "MGET" operation)

Since you have the filenames at that point, couldn't you just issue the CPYFRMSTMF in the same loop, immediately after the FTP_get()?

So, I ran TESTGET with a qsys.lib file as the destination and the data is un-readable (basically hex). Obviously, something is occurring that I don't understand.

I'm assuming (based on the fact that CPYFRMSTMF works) that this is an ASCII text file. Are you using ASCII mode when you download the file?



I can use the MGET code to output a DB2 file that will contain the
downloaded filenames and then use CPYFRMSTMF statements to do the
conversion, but I wanted to investigate what you suggested before I went
that route.  Can you explain what is going on?


The other thing I suggested on MIDRANGE-L was that you could use FTP_getraw() instead of FTP_get() in order to allow you to use RPG's file op codes (such as WRITE, UPDATE, O-specs, etc) to write the results to disk. I don't think there are any samples of this in the FTPAPI package, but there probably should be.

The specifics of this approach will depend on what type of data is in the files you're downloading...

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------