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 OSBWRITE, the STATUS function returns one of the values<br />

described in the following table.<br />

Examples<br />

Value Description<br />

0 The write was successful.<br />

1 The file name is invalid.<br />

2 You do not have permission to access the file.<br />

4 The file does not exist.<br />

STATUS Function Return Values<br />

In the following example, the program statement writes the data in TEST to the<br />

RFILE starting from the beginning of the file:<br />

OSBWRITE TEST ON RFILE AT 0<br />

In the next example, the program segment reads REC.ID from a select list, reads the<br />

associated record from the CLIENT file, and appends the record onto a variable<br />

(BLOCK), terminating each record with an ASCII 10 (line feed). When it is<br />

complete, the code writes the block to the NTFS or UNIX file name opened to the<br />

variable CLIENT.SEQ.<br />

DONE = 0<br />

LOOP<br />

READNEXT REC.ID ELSE DONE = 1<br />

UNTIL DONE DO<br />

READ REC FROM CLIENT,REC.ID ELSE REC = ' '<br />

IF REC THEN<br />

REC = REC.ID:@FM:REC<br />

BLOCK := REC:CHAR(10)<br />

END<br />

REPEAT<br />

OSBWRITE BLOCK ON CLIENT.SEQ AT 0<br />

OSBWRITE 1-552

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

Saved successfully!

Ooh no, something went wrong!