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.

Parameters<br />

The following table describes each parameter of the syntax.<br />

Parameter Description<br />

Examples<br />

In the following example, the program statement reserves resource 12 if another<br />

program is not using it. If resource 12 is already in use, the current program suspends<br />

execution and waits until UniData unlocks resource 12.<br />

LOCK 12<br />

In the next example, the program segment locks resource 44 if it is available. If it has<br />

already been locked, the program attempts to lock resource 45. If both resources are<br />

unavailable, the program stops.<br />

1-426 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong><br />

resource.num Specifies a number associated with a resource. resource.num can<br />

be any number from 0 through 63.<br />

For assistance in assigning resource numbers, see your system<br />

administrator.<br />

THEN statements END Specifies statements to execute if the LOCK statement executes<br />

successfully.<br />

ELSE statements END Specifies statements to execute if another user has reserved the<br />

resource (using the same resource number) so that the LOCK<br />

statement fails to lock it.<br />

If you do not specify an ELSE clause and the requested resource<br />

has already been locked, the current program waits until that<br />

resource is released.<br />

Use the ECL command DEFAULT.LOCKED.ACTION BELL<br />

to make the terminal beep while you wait for UniData to release<br />

the lock.<br />

LOCK Parameters<br />

T1 = 44; T2 = 45<br />

LOCK T1 ELSE LOCK T2 ELSE STOP

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

Saved successfully!

Ooh no, something went wrong!