WRITEB Statement

WRITEB allows you to write a specified number of characters into any binary 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. WRITEBU is very similar to WRITEVU, and sets items locks.

Format

WRITEB 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 will be inserted at the specified starting position. Otherwise, it will replace the number of bytes characters starting at the start position. If the start position is beyond the end of the existing item, space characters are used to pad the data to the specified size.

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.

Description

Binary items are stored in 2000-byte increments, so there may be extra data following the last meaningful data byte.

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"

WRITEB Y ON X,"PROG",0

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

WRITEB I ON "ABC" J

See Also

Statement and Function Reference