× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks Scott.

I'm trying to replace a FTP process with the IFS api's.
I'm getting a "ftp_550-File in use by another process error".
When I attempt to do a put, but I want to know if the file is
"in use" before I attempt to do the put. I have a feeling that we
Have some users opening this text file via notepad.....

How do you check the errno?



Gerald Magnuson
Supervisor, Systemi Administration & Development
The Knapheide Manufacturing Company
Quincy, IL 62301



-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Tuesday, July 24, 2007 5:00 PM
To: Midrange Systems Technical Discussion
Subject: Re: QNTC open() api question

Hi Gerald,

What is the standard way to code and test the open() api to see if the
file (in QNTC) is already open by another user?

Hmmm... I have no idea if QNTC handles object locking or not? In most
IFS filesystems, you'd do something like this:

in C: rc = open(filename, O_RDONLY|O_SHARE_NONE);
in RPG: rc = open(%trimr(filename): O_RDONlY+O_SHARE_NONE);

The O_SHARE_NONE flag says "I don't want to share this file with anyone"

so if someone else already has it open, rc will be -1, and errno will be

set to EBUSY.

But, I have no idea how well this works with /QNTC , since in that case
it would be the Windows computer (rather than i5/OS) that keeps track of

who is using the file and whether sharing is allowed.

Plus, it's important to understand that many/most PC programs don't keep

the file open. They load the whole file into memory then close it -- a
very different approach than is used with the databases that System i
professionals are accustomed to. For example, Microsoft Excel will
probably load it's entire XLS file into memory, then close the file. It

doesn't keep it open, so you can't use O_SHARE_NONE to check for it. It

does, however, create a "flag file" (a copy of the file under a special
filename) that other instances of Excel will check for to determine if
the file is in use. That may sound weird, but you have to understand
that Windows is an evolution of MS-DOS, and MS-DOS didn't have any
concept of locking, so it was left to the programmers to come up with
their own method.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.