× 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.



Hi Chamara,

I'm going to guess that your "common folder" is in the root file system of the IFS? If not, please specify which file system it's in.

Your RPG program opens the file with the open() API? If so, you can specify the O_SHARE_NONE flag. This will lock the file so that your program is the only one that can use it. If another job has the file open when you call the open() API, open() will return -1 and set errno to EBUSY.

However, there's nothing in place to prevent one user from overwriting another user's uploaded file before your RPG program runs. Frankly, this isn't a very good design for an application.

I would consider a solution similar to what Paul Nicolay recommends... except I would give some thought to whether you can simply process the file directly as it's read from the browser, and avoid saving it to the IFS altogether. That way, you can give the user immediate feedback of errors. But if that's not possible, then saving it to a unique filename (as Paul suggests) is certainly an option as well!


Chamara Withanachchi wrote:
Hi Scott,

My case is like this we have a common folder in ifs and it contain one txt file and all our system I user can placing one file to it with contains some txn from pc based software. We are accessing that file from rpg program and writing then to our db2 files in iseries.
Since lot of users doing this what I want is to lock that particular txt file while my rpg program is running.
Hope u got my case. And do u know any solutions for this.
Please note that the txt file is having same name for all users. Users are trained to put txt file by using iseries navigator.



Regards,

Chamara Withanachchi
Owner of www.rpgiv.info
WWW.RPGIV.INFO
Mob: +971 50 5698644
Tel: +971 6 5595887
chamaraw@xxxxxxxxxx
www.rpgiv.info

Sent from my BlackBerry® wireless device

-----Original Message-----
From: Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>

Date: Fri, 26 Dec 2008 04:01:36 To: RPG programming on the IBM i / System i<rpg400-l@xxxxxxxxxxxx>
Subject: Re: Ifs file locking


Hello Chamara,

Does any one know how to implement a file locking mechanism when ifs
folders/files access from iseries navigator.

I'm not sure what you're asking. When you say "IFS folders/files" which file system of the IFS are you referring to?

Are you only accessing the files via navigator (in which case, this question isn't related to RPG, and belongs elsewhere) or are you referring to files that you create from RPG, and then make available via Navigator? If so, how are you going about creating them from RPG.

It would help a lot if you'd explain what problem you're trying to solve. File locking is just a means of solving a problem, there may be other (easier/better) ways to solve the same problems... but since we don't know what the problem is, we can't suggest them.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.