11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

STATUS Function Return Values<br />

After you execute READFWDL, the STATUS function returns one of the values<br />

described in the following table.<br />

Value Description<br />

0 Successful read.<br />

10 <strong>UniBasic</strong> found and read a duplicate alternate index key value, and ECL<br />

DUP.STATUS is on.<br />

STATUS Function Return Values<br />

Example<br />

This example uses the following program to lock the CLIENT file for two minutes:<br />

OPEN "CLIENTS" TO CLIENT.FILE ELSE STOP<br />

FILELOCK CLIENT.FILE LOCKED PRINT "CLIENTS FILE already locked."<br />

SLEEP 120<br />

FILEUNLOCK CLIENT.FILE<br />

If you execute the following program:<br />

OPEN 'CLIENTS' TO tmp ELSE STOP<br />

SETINDEX 'LNAME', 'Smith' ON tmp<br />

FOR X = 1 TO 5<br />

READFWDL rec FROM tmp THEN PRINT rec:", ":rec:" ":rec<br />

ELSE STOP<br />

NEXT X<br />

END<br />

Notice that execution halts on the second program until the first program unlocks the<br />

CLIENTS file. This is because commands that set shared locks cannot access files<br />

locked with exclusive locks (FILELOCK sets an exclusive lock).<br />

Note: If the first program had set a shared lock, the second program would have been<br />

able to read the records.<br />

READFWDL 1-615

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!