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


  • Subject: Re: API to check if IFS file is buzy ?
  • From: Jocke Berggren <jocke@xxxxxxx>
  • Date: Tue, 07 Sep 1999 08:39:27 +0200

I'we got some ideas about open() with oflag O_SHARE_NONE , and
thought it would return -1 if the file is not able to be open exclusive.

But My RPG-LE program says error 3021 all the time on a test file
thats is not used. Cant find what 3021 is either.

Maby there is errors in my code, and I have only guessed how to deal
with O_SHARE_NONE flag to get it into integer value.

If I change Oflagdef = (1)  it all works fine, but I want the SHARE_NONE
bit also.

Heres my code:

**************************************************************************** 
******
D fOpen           PR            10i 0 ExtProc('open')
D                                 *   Value
D Oflag                         10i 0 Value

D fClose          PR            10i 0 ExtProc('close')
D                               10i 0 Value

D qqErrno         PR              *   ExtProc('__errno')

D Miscellaneous   DS
D  DspError                      4S 0 INZ
D   DspErrorA                    4A   OVERLAY(DspError)

DpPathname        S               *   Inz(%Addr(Pathname))
DPathname         S             64A
DRs               S             10i 0
DRc               S             10i 0
D Errno           S             10i 0 Based(perrno)

D Oflagdef        C                   Const(2000001)

C                   EVAL      Pathname = '/ftp/Test1.txt' + X'00'
C                   EVAL      Rs = fOpen(pPathname:Oflagdef)

C                   IF        (Rs < 0 )
C                   EVAL      perrno = qqErrno
C                   EVAL      DspError = Errno
C     Rs            DSPLY
C     DspErrorA     DSPLY
C                   ENDIF

C                   if        (Rs > 0)
C                   EVAL      Rc = fClose(Rs)
C     Rs            DSPLY
C                   endif

C                   EVAL      *INLR = *ON
C                   RETURN
**************************************************************************** 
***********

>Hmmm looks like you will have to delve into the Unix style APIs. I think
>that  "DosSetFileLocks()--Lock and Unlock a Byte Range of an Open File" may
>be a way to accomplish what you want. Also you might want to check to see if
>there is an exit point on the FTP server for the transfer complete.



+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


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.