Use FILEINFO(filevariable,0). It returns a 1 if the file variable has been assigned. Regards,
LeRoy F. Dreyfuss Product Manager IBM UniVerse and UniData (U2) Extended Relational Databases [cid:_2_10A2B7D010A2B57C0051F19F872570EB] Information Management Software Tel: 303-773-7783 Fax: 303-773-5915 Mobile: 720-341-4317 Tie-line: 656-7783 External email: [EMAIL PROTECTED] WWW: http://www.ibm.com/software/data/u2 "Bill Haskett" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 01/01/2006 04:16 PM Please respond to u2-users@listserver.u2ug.org To <u2-users@listserver.u2ug.org> cc Subject [U2] [UD] Is a file opened? How can I tell if a file is open in UniData (in ECLTYPE P)? I've tried the UNASSIGNED() function and this doesn't work under certain conditions. For instance, in some code I want to open a file if it already isn't opened. Normally I'd do the following: COMMON FileVariable (or COMMON /FILES/ FileVariable) IF UNASSIGNED(FileVariable) THEN OPEN 'FileName' TO FileVariable ELSE DoSomethingElse END or, in other mvDbms I might: IF NOT(ASSIGNED(FileVariable))... Although this works fine in UV and all other mvDbms products it doesn't work in UniData. It appears it's because defining a variable as COMMON actually assigns it a value (zero or empty depending on UDT.OPTIONS 15). Of course, when I alter the critical line above to: IF UNASSIGNED(FileVariable) OR FileVariable = 0 THEN ... then if the variable has actually been assigned the program aborts with the message: "...Illegal use of the file, select, cursor, BCI, Socket, HTTP, XML, SCTX ,MQS, SOAP or database variable.". Is there a function I can use in UniData, anywhere in any program, to test if a file has been opened in common? As always, thanks. Bill ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ [demime 1.01d removed an attachment of type image/jpeg] ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/