SETREM

SETREM

Top  Previous  Next

 

The SETREM statement sets the remove pointer of a string.

 

 

Format

 

SETREM offset ON string

 

where

 

offsetis the character offset of the remove pointer to be set.

 

stringis the string on which the remove pointer position is to be set.

 

 

Assigning a character string variable automatically sets the remove pointer to zero, effectively pointing one character before the start of the string. The SETREM statement allows an application to set the remove pointer to an arbitrary offset into string. The STATUS() function will return zero if the action is successful.

 

If the offset is negative or greater than the length of string, any existing remove pointer is not altered and the STATUS() function will return error code ER$LENGTH.

 

SETREM is typically used with GETREM() to save and restore the remove pointer position.

 

 

Example

 

RMV.PTR = GETREM(S)

GOSUB PROCESS.DATA

SETREM RMV.PTR ON S

 

The above code fragment saves the remove pointer associated with string S and restores it after execution of subroutine PROCESS.DATA which might change this remove pointer.

 

 

See also:

GETREM, REMOVE