Do you check/change accounts when you open files? Changing accts will
probably cause issues. Check FILEINFO(). Also, dimensioned arrays can be
dynamically resized b might also be helpful?

      SUB OPEN.FILE.SUB(FNAME,FVAR,ERR)
      COMMON /OPEN.FILES/ FNAMELIST, FVARLIST(1), LAST.ACCT
      $OPTIONS -STATIC.DIM   ;* redimension array on the fly
      IF UNASSIGNED(LAST.ACCT) THEN LAST.ACCT = bb   ;* check account b
      otherwise can screw up filepointers
      IF @WHO # LAST.ACCT THEN
         MAT FVARLIST = bb
         FNAMELIST = bb
         LAST.ACCT = @WHO
      END
      FIND FNAME IN FNAMELIST SETTING A THEN
         IF FILEINFO(FVAR(A),0) THEN ;* valid file handle
         b&
         END ELSE
            FNAMELIST = DELETE(FNAMELIST,A)
            GOSUB OPEN.FILE:
         END
      END ELSE
         GOSUB OPEN.FILE:
      END
      ...
      RETURN
      OPEN.FILE:
         NEXT.POS = DCOUNT(FNAMELIST,@AM) + 1
         DIM FVARLIST(NEXT.POS)   ;* redimension array on the fly
         OPEN b&
         b&
      RETURN


Stuart Boydell



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of "Scott Ballinger"
<[EMAIL PROTECTED]>
Sent: Friday, 25 August 2006 10:08
To: u2-users@listserver.u2ug.org
Subject: [U2] Need help - UV intermittent & roving file open error

I have a little file open subroutine that I use in a lot of places to
keep open files in common:

Recently (within the last two weeks) I have started getting the
following error:

[SNIP]

Program "SB1": Line 6, Read operation failure. [EBADF] Bad file number
>

Any suggestions will be greatly appreciated- perhaps the "OPEN.FILE.SUB
needs to be more robust? I suppose I could do a test read like "READ XXX
FROM FILEVAR,"TEST" ON ERROR .... " after opening the file in the
OPEN.FILE.SUB, but that doesn't really solve the problem and seems like
a lot of overhead. OPEN.FILE.SUB is embedded in a lot of places and I
really don't want to have to replace it with discrete file opens
everywhere!
 
********************************************************************** 
  
This email message and any files transmitted with it are confidential and 
intended solely for the use of addressed recipient(s). If you have received 
this email in error please notify the Spotless IS Support Centre (+61 3 9269 
7555) immediately, who will advise further action. This footnote also confirms 
that this email message has been scanned for the presence of computer related 
viruses.
  
********************************************************************** 
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to