[U2] - Can a program determine File doesn't exist in TRANS()

43 views
Skip to first unread message

George Gallen

unread,
Mar 24, 2022, 10:34:19 AMMar 24
to mvd...@googlegroups.com
This is UV11 I'm currently running on

if you have  X=TRANS("SOMEFILE","ID",1,'X')

I haven't found any way to programmatically determine that SOMEFILE doesn't exist from the TRANS() read
aside from executing a TRANS("VOC","SOMEFILE",-1,'X") first to see if it's in the VOC at all - if I go that route
might as well switch to an OPEN/READ

I've tried V and C vs ('X') - X and V trigger a runtime warning - but if it's running as a phantom
that doesn't help.  C will return the ID if it doesn't exist - or if the combo of file/id doesn't exist

I can always swap to an OPEN / READ and have the OPEN trigger the file doesn't exist
but trying to reduce my OPENs for TRANS() for those 1x read only requests and use
OPEN only with WRITEs or if I need to lock a record on READ.

Any other ideas other than preface with a VOC read?

KOSDAY SOLUTIONS

unread,
Mar 24, 2022, 12:03:38 PMMar 24
to Pick and MultiValue Databases
Play with STATUS function after TRANS
In my tests STATUS() returns a "2" when the file or record does not exist. If the TRANS is correct STATUS() returns a "0".
Angel

George Gallen

unread,
Mar 24, 2022, 1:13:04 PMMar 24
to mvd...@googlegroups.com
Thanks.

At first I didn't think there would be much difference between using 'C' vs 'X' which would
return the ID if the file or ID was not found from TRANS() and status()

but with playing the STATUS() return 0 if good read OR good file/no record id - and only 2 if the file
is not found.  and using 'C' vs 'X' returns the ID instead of "" if the record is not found.

so - if status() = 0 and data returned # ID - good file / good record
        if status() = 0 and data returned = ID - good file / recordid does not exist
        if status() = 2 bad file

using 'C' instead of 'X' or 'V' will eliminate the run time error being displayed



From: mvd...@googlegroups.com <mvd...@googlegroups.com> on behalf of KOSDAY SOLUTIONS <kosdays...@gmail.com>
Sent: Thursday, March 24, 2022 12:03 PM
To: Pick and MultiValue Databases <mvd...@googlegroups.com>
Subject: [mvdbms] Re: [U2] - Can a program determine File doesn't exist in TRANS()
 
--
You received this message because you are subscribed to
the "Pick and MultiValue Databases" group.
To post, email to: mvd...@googlegroups.com
To unsubscribe, email to: mvdbms+un...@googlegroups.com
For more options, visit http://groups.google.com/group/mvdbms
---
You received this message because you are subscribed to the Google Groups "Pick and MultiValue Databases" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mvdbms+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mvdbms/990ece55-580e-46aa-9709-eaf56080087en%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages