UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software

rocketsoftware.com
from rocketsoftware.com More from this publisher
11.04.2013 Views

WRITEU Syntax WRITEU expr {ON | TO} [file.var,] record.ID.expr [ON ERROR statements] Description The UniBasic WRITEU command writes a record to a file without releasing locks. WRITEU writes regardless of lock status. Note: UniBasic locks are advisory only. For more information, see Developing UniBasic Applications. Warning: Do not use UniBasic READ and WRITE commands to open or modify binary data in DIR-type files (for example, BP). Doing so can corrupt data in the file. Instead, use OSREAD or OSBREAD after executing the UniBasic NOCONVERT command. Updating Alternate Key Indexes Remember the following points about alternate key indexes when you code WRITEU statements: 1-917 UniBasic Commands Reference Alternate key indexes that are currently enabled are automatically updated when you write a record. If you execute the ECL command DUP.STATUS ON, and then write a record that creates a duplicate alternate key, WRITEU sets the STATUS return value to 10. If the NO.DUPS keyword was specified when the alternate key index was created, UniBasic will not write a record that would create a duplicate index key. Instead, the ON ERROR clause executes (or the program aborts if ON ERROR is not coded) and the STATUS function returns a value of 10. RFS does not support NO.DUPS.

Parameters The following table describes each parameter of the syntax. Parameter Description expr Specifies an expression to write to the file. ON | TO file.var, Specifies a file to receive the expression. If you do not specify a file.var, UniData writes to the default file. If no default file is open, a fatal WRITEU error occurs. A default file is one for which no file variable is assigned in the OPEN statement. record.ID.expr Specifies a record to receive the expression. ON ERROR statements Specifies statements to execute if the WRITEU statement fails with a fatal error (such as the file is not open, an I/O error occurs in the write process, or the record contains a duplicate alternate index key). If the transaction is not aborted by the ON ERROR clause, processing continues, and the transaction could commit inappropriately. WRITEU Parameters STATUS Function Return Values After you execute WRITEU, the STATUS function returns one of the values described in the following table. Return Value Description 0 Successful write. 1 System error, such as a damaged file. STATUS Function Return Values WRITEU 1-918

WRITEU<br />

Syntax<br />

WRITEU expr {ON | TO} [file.var,] record.ID.expr [ON ERROR statements]<br />

Description<br />

The <strong>UniBasic</strong> WRITEU command writes a record to a file without releasing locks.<br />

WRITEU writes regardless of lock status.<br />

Note: <strong>UniBasic</strong> locks are advisory only. For more information, see Developing<br />

<strong>UniBasic</strong> Applications.<br />

Warning: Do not use <strong>UniBasic</strong> READ and WRITE commands to open or modify<br />

binary data in DIR-type files (for example, BP). Doing so can corrupt data in the file.<br />

Instead, use OSREAD or OSBREAD after executing the <strong>UniBasic</strong> NOCONVERT<br />

command.<br />

Updating Alternate Key Indexes<br />

Remember the following points about alternate key indexes when you code WRITEU<br />

statements:<br />

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

Alternate key indexes that are currently enabled are automatically updated<br />

when you write a record.<br />

If you execute the ECL command DUP.STATUS ON, and then write a<br />

record that creates a duplicate alternate key, WRITEU sets the STATUS<br />

return value to 10.<br />

If the NO.DUPS keyword was specified when the alternate key index was<br />

created, <strong>UniBasic</strong> will not write a record that would create a duplicate index<br />

key. Instead, the ON ERROR clause executes (or the program aborts if ON<br />

ERROR is not coded) and the STATUS function returns a value of 10. RFS<br />

does not support NO.DUPS.

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

Saved successfully!

Ooh no, something went wrong!