[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Writing Files to IFS
Sender: "Buzz Fenner" <bfenner@xxxxxxxxxxxxxxxx>
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()?
That is exactly what I came up with; I've tested it and it works.
>> 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 went back and read the documentation on FTP_binaryMode in the COPY member
and realized I did not have it in ASCII mode. After flipping binary mode
*OFF, the copy to the qsys.lib physical file worked, but the result was a
lot of truncated data
>> 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...
I sort of see how FTP_getraw works, but my ILE RPG skills are unfortunately
not where they need to be yet. An example of a write procedure would be
nice. But, FWIW, your procedures are making me look like a genius!
Thanks.
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------