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

Re: Question about using FTPAPIR4 under V5R2



Sender: Scott Klement <sk@xxxxxxxxxxxxxxxx>


Are these limitations of the IBM API?

Huh? Which IBM API? IBM does not have an API for FTP.


I wanted to replace our current routine with API calls so I could test for errors after each step, but I guess that will have to wait. Our current callable FTP routine is a combination of CL & RPG to create and execute an FTP script using the OS400 FTP command, then parse the log looking for error codes. Is this the best approach for sending/receiving for the QSYS (lib/fil.mbr) format?

I don't know what the "best" way to do it is, but I suspect that the definition of "best" varies widely depending on your requirements.


I think you're making too much of the namefmt issue. FTPAPI uses namefmt 1 because it's universal. Everything you can do with namefmt 0 can also be done with namefmt 1 -- but not vice-versa. For example, if you have a library called JOHNLIB that contains a file called TESTFILE which in turn has a member called MYMBR, using namefmt 0 in IBM's client you might've run the following command:

put JOHNLIB/TESTFILE.MYMBR

To do the same thing with FTPAPI, you do:

rc = ftp_put(sess: '/QSYS.LIB/JOHNLIB.LIB/TESTFILE.FILE/MYMBR.MBR')

The capabilities are the same. The only difference is a SLIGHT difference in syntax. You could, very easily, create the "namefmt 1" path using a little bit of string concatenation, like this:

 eval    pathname = '/QSYS.LIB'
                  + '/' + %trimr(Library) + '.LIB'
                  + '/' + %trimr(File)    + '.FILE'
                  + '/' + %trimr(Member)  + '.MBR'

That way, your program can receive the library, file and member names as parameters or have them in separate variables.

Surely this is much easier than writing a routine to analyze the output of IBM's FTP command?

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