Access DBF from FTP Server - ftp

I Have a application on Clipper,DBF.
Is It Possible to access DBF file from FTP Server Using Clipper Program?
Thanks.

No, not really.
FTP is not a "shared folder". You can create a batch file which will download file via FTP, then run your clipper application, then after application finishes copy modified .DBF back to FTP server.
Note however that it will be slow (as you need to transfer whole .DBF file even if you need just a tiny bit of it) and that you MAY NOT use it at more than one place at a time (running it in more than one place will overwrite data, including possibility of file truncation/corruption)
There are utilities that present FTP as a filesystem ("shared folder"), for example curlftpfs, but while it allows you to just run .exe directly instead of via aforementioned .bat file, ALL THE LIMITATIONS mentioned in previous paragraph still apply - it is not possible to avoid them due to nature of FTP.

Related

Using IIB File nodes to move, copy, download and rename (S)FTP files without opening them

I am using IIB, and several of the requirements I have are for message flows that can do the following things:
Download a file from an FTP and/or SFTP server to the local file system, with a different name
Rename a file on the local file system
Move and rename a file on the (S)FTP server
Upload a file from the file system to the (S)FTP server, with a different name
Looking at the nodes available (FileInputNode, FileReadNode, FileOutputNode); it appears that they can read and write files in this way; but only by copying them into memory and then physically rewriting the files - rather than just using a copy/move/download-type command, which would never need to open the file in the same way.
I've noticed that there's options to move store files locally once the read is complete, however; so perhaps there's a way around it using that functionality? I don't need to open the files into memory at all - I don't care what's in the files.
Currently I am doing this using a Java Compute Node and Apache Commons Net classes for FTP - but they don't work for SFTP and the workaround seems too complex; so I was wondering if there was a pure IIB way to do it.
There is no native way to do this, but it can be done using Apache Commons VFS

FTP Jar file from share path on windows to IFS location in AS400?

I am looking for an approach / design through which i want to automate the process of FTP from windows location to IFS location present on AS400 environment when ever there is a new file added to windows path.
Below is the approach I thought, Please refine it if needed.
We have an option WRKJOBSCDEthrough which we can run a CL program in a scheduled threshold of 1hr.
To write a CL program which invokes a script(pyton/shell) to talk to windows location(say X:drive having its IP as xx.xxx.xx.xx).
Shell script has to search for latest file in the location X:drive and FTP that jar(of size 5mb max) to IFS location(say /usr/dta/ydrive) on AS400 machine.
Thus, CL program we invoked in STEP2 has to mail to me using SNDDSTthe list of all the jars ftp'd by the scheduler job that runs every 1 hr in STEP1.
All I am new to CL programming/RPGLE . Please help me with some
learning stuff and also design of such concepts.
You could use a library like the one provided by Scott Klement at https://www.scottklement.com/ftpapi/ to roll your own automation client. It was designed to be used from RPG, and is easy to use. From there it is a simple task to:
retrieve a list of files in the directory
parse the list to retrieve file timestamps
get any files with a timestamp later than the last successful run
The CL command RUNRMTCMD can be used to invoke a command on a PC running a rexec() client. iSeries Access for Windows offers such a client, and there are others available. With the iSeries client, the output of the PC command is placed in a spool file on the AS/400, which should contain the results of the FTP session.
You can copy the spool file to a file using the CPYSPLF command and SNDDST it to yourself, but I am not sure the contents will be converted from EBCDIC to ASCII.
Check out Easy400.net for the MMAIL programs developed by Giovanni Perotti. This package includes an EMAILSPL command to email a spool file. I believe you will need to pay $50 for the download.
I think you are on the right track, but the are a lot of details.
You have to learn to program windows. dotnet filewatcher Out of scope for a complete answer. All of the other solutions seem to be polling solutions "Are we there yet?" "No were not there."

Windows: How to lock an FTP downloaded file

I have one application in which I download files from FTP server.
As the file is downloading, a third party begins uploading that file and so it ends up with a corrupt file and is unable to process it.
Does any know about how to deal with situation other than using .complete file mechanism? (keeping track of when the download is complete)
Is it possible to lock the file on the FTP server? The FTP server is windows.
No, there is no standard locking mechanism, it's all between up to you and the other party. Here are some ways to do it in addition to creating a .complete file;
The uploader uploads the file as file.xls.tmp, and when it's complete, rename to file.xls.
The uploader uploads to a tmp directory, and when it's complete, moves it to the scanned dir.
The uploader uploads the file, and the downloader scans file dates to find files written before a certain time. This is not as reliable, since a file from a crashed uploader may be scanned.
There are probably more versions, particularly with a custom ftp server, but using the plain standard doesn't allow for much "fancy stuff".

Fastest way to move files within remote computer from Cocoa application?

I have files stored in a shared directory on one computer and a Cocoa Application running on another computer on the same LAN.
I want the application to move files within the shared directory.
I’m using -NSFileManager copyItemAtPath: toPath: error:. But sometimes it seems extremely slow, regardless of file size. Why would that operation be much longer than doing it directly on the shared directory’s computer?
I'd guess, I don't know for sure, that NSFileManager first downloads the file to copy and then reuploads the downloaded file under a different name. The last thing it does is removing the original file. Of course the downloading and uploading take some time.
The reason for this procedure is that most protocols don't have a 'copy' command. So the client will have to do all the work itself with the explained procedure.

Prevent the access from copying a file when other resources are using it

In my application, i have one exe file that will do some conversion on my videofiles in a directory, and also i have used cute ftp to transfer the files present in the directory to another server.
CUTE FTP is configured to be run on every mins.
When 25% of job is over for a video file, CUTEFTP is transferred that file to other server.
What are the ways to fix this problem.
Process the file in a different directory and then move it to a place where CUTE FTP will pick it up after the conversion is finished.
[EDIT] Don't use copy, use move. Both directories must be on the same harddisk. When using the Windows Explorer, use "Cut" or just drag the file with the mouse. Make sure there is no little "[+]" when you drop it.

Resources