SINSERT


PLBCMP Only

 

The SINSERT instruction provides a means of inserting data from a character string variable into another character string variable. The transfer shifts all data in the destination variable to the right, one position for each byte inserted. The instruction uses the following format:

 

 

[label]

SINSERT

{dest}{sep}{source}[{sep}{count}]

 

Where:

label

Optional. A Program Execution Label.

dest

Required. A previously defined Character String Variable into which {source} bytes are transferred.

sep

Required. A comma or one of the following prepositions: BY, TO, OF, FROM, USING, WITH, IN, or INTO.

source

Required. A previously defined Character String Variable from which bytes are transferred into {dest}.

count

Required. A previously defined Numeric Variable, Expression, or decimal constant indicating the number of bytes to transfer.

Flags Affected: LESS, OVER, ZERO

Note the following:

  1. SINSERT attempts to insert {count} bytes of the Logical String of {source} into {dest} beginning at the Form Pointer of {source}. If {count} is not specified, the entire Logical String of {source} is used. Both the Form Pointer and Length Pointer of {dest} are incremented for each byte inserted, up to the Physical Length.

  2. If {dest} is a Null String, the LESS Condition Flag is set and no action occurs.

  3. If {source} is a Null String and {count} was specified, blanks are inserted for the designated number of bytes. Otherwise, the ZERO Condition Flag is set.

  4. If {count} is greater than the Logical String of {source}, {dest} is blank-filled from the end of the Logical String of {source} through the designated number of bytes.

  5. If {count} equals zero, the ZERO Condition Flag is set and no operation occurs.

  6. If significant (non-blank) data could be lost in {dest} as a result, the OVER Condition Flag is set and no operation occurs.

  7. The SINSERT instruction is obsolete and the SPLICE instruction should be used instead.

 

 

See Also: Example Code, SDELETE, Character String Instructions

 



PL/B Language Reference SFORMAT SMAKE