WRITEF Statement

WRITEF 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

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

Parameter(s)

start.pos

The 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.

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=vTHIS IS A TEST"

WRITEF Y ON X,"PROG",0

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

WRITEF I ON "ABC" J

See Also

Statement and Function Reference