WRITEFU Statement

WRITEFU allows you to write a specified number of characters into any normal item stored in a disk file. The syntax is very similar to WRITEV, but rather than specifying the attribute to be written, you specify the starting position and number of bytes to be written. WRITEFU behaves like WRITEVU, and sets and obeys item locks.

Format

WRITEFU str ON filevar,item.id,start.pos,no.of.bytes (ON ERROR)

Parameter(s)

start.pos

Start position. If a start position of zero or less is specified, the string is output in form of any existing data in the item. If the start position is beyond the end of the existing item, space characters are used to pad the data to be specified.

no.of.bytes

Number of bytes. If the number of bytes is specified as zero or less, the string will be inserted at the specified start position. Otherwise, it replaces the number of bytes characters starting at the specified start position.

The SET-WRITE-LOCK system switch controls whether the WRITEU, MATWRITEU, WRITEVU and WRITEFU statements in mvBASIC set an item lock if an item lock is not already set. Refer to the SET-WRITE-LOCK system switch in the Guide to mvBase Files and Accounts for additional information.

Example

In this example, the string value "THIS IS A TEST" is inserted prior to the first attribute of item PROG in the file opened and assigned to variable X.

Y="THIS IS A TEST"

WRITEFU Y ON X,"PROG",0

The following example demonstrates incorrect use. The comma is missing between ABC and J.

WRITEFU I ON "ABC" J

See Also

Statement and Function Reference