Here's a loop I use for getting a next ID on a heavily used system... LOOP UNTIL RECORDLOCKED(F.GRTRANS,NEXT.AVAIL) > 1 DO LOOP WHILE READV z FROM F.GRTRANS,NEXT.AVAIL,0 DO NEXT.AVAIL += 1 REPEAT RECORDLOCKU F.GRTRANS,NEXT.AVAIL LOCKED NEXT.AVAIL += 1 REPEAT
> -----Original Message----- > On Behalf Of Gyle Iverson > Subject: RE: [U2] [UV] WHILE READNEXT id DO > > > Ray Wurlod opined: > >Personally, I love this syntax. When training others, I > >usually explain it in this form; READNEXT has to generate a > >true/untrue value of some kind to determine whether to go down > >its THEN or ELSE path. We take advantage of that "Boolean > >context" to trigger the behaviour of WHERE or UNTIL in a > >looping context. > > > >READNEXT is not the only statement that exhibits this > >behaviour. Almost any statement that has THEN/ELSE can use > >it. But READNEXT, READSEQ/READBLK are the most "sensible". > [snip] > >It would be nice were there a section in the BASIC manual > >about the Boolean context of certain statements, but that's > >only a minor complaint. Of course, each statement syntax that > >appears to make at least one of THEN or ELSE mandatory would > >need a note referring to this section. > > Hello, Ray. > > We can agree that the syntax has a certain appeal, yet finding a practical > use for such has always escaped me in real applications for anything but > READNEXT. Why? The syntax precludes handling of ON ERROR or > LOCKED clauses. > > Never mind that the READNEXT, READSEQ and READBLK statements > should [but do > not] have an ON ERROR clauses. After all, files may be damaged or networks > may be interrupted. I assume your "sensible" reference would not be so if > these statements should later support such a clause. > > Writing robust, recoverable, error-tolerant code precludes taking the > approach that a file I/O statement may have only a THEN or ELSE condition. > Perhaps if there were a structured exception mechanism within BASIC one > could safely use such syntax, but I discourage its use for anything but > simple one-time utility programs. > > Best regards, > Gyle ********************************************************************** 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 viruses. ********************************************************************** ------- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/