|
I am creating an association between some iSeries data and files that reside on Windows servers. When the file name is entered, I'd like to verify the file exists, but I'm not sure how.
The iSeries can access Windows file shares via the /QNTC filesystem. For example, we have a server named RED (that's just the name we used) and on that server we have a share named ISDOCS where we store our documentation for the Information Systems department. If I wanted to access a file named "TimeMgt2.xls" in a folder called "scottk" I could refer to it from the iSeries using the following IFS path:
/QNTC/SERVER4/isdocs/scottk/TimeMgt2.xlsWhen I use that path, it actually logs on to the Windows server named SERVER4 (using the userid/password of the iSeries user who tried to access it) and refers directly to that file.
If I wanted to check if that file existed, I could write an RPG program (or any other ILE HLL) to call the access() API. That API checks whether a file exists (and optionally, whether you have access to it) for example:
/free filename = '/QNTC/SERVER4/isdocs/scottk/TimeMgt2.xls'; if (access(%trimr(filename): F_OK) = 0); // hurray! file exists endif;Personally, that's the approach I'd take. I wouldn't even look at FTP for something like this unless for some reason Windows network access isn't available (which would be strange, since it's a Windows server!).
If you must use FTP, it'd be MUCH easier with FTPAPI than it would be with the i5/OS FTP client. With FTPAPI you'd be able to keep the session open and just check for files. If you used the i5/OS FTP client, you'd have to make a new connection each time, then parse the FTP log.
But, again, I wouldn't even consider FTP unless there isn't a better way. I don't understand why everyone is discussing writing a complex, awkward, FTP kludge at this point in time.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.