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.

WRITE<br />

Syntax<br />

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

Description<br />

The <strong>UniBasic</strong> WRITE command writes an expression to an opened file and releases<br />

locks set by the same process.<br />

Note: WRITE updates the record and releases UniData locks regardless of lock<br />

status. To check for and retain record locks, use the WRITEU command. For more<br />

information, see Developing <strong>UniBasic</strong> Applications.<br />

To maintain file integrity, UniData locks records with a nonprogrammable lock<br />

during a write. UniData releases this lock immediately after the WRITE command<br />

executes.<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 WRITE<br />

statements:<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, WRITE sets the STATUS return<br />

value to 10.<br />

WRITE 1-902

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

Saved successfully!

Ooh no, something went wrong!