SPLICE


8.0.6

 

The SPLICE instruction replaces the logical contents of a string variable with the logical contents of another string variable. The replaced variable's contents are expanded or compressed so that the new contents exactly fit the replaced space. If nothing is added, the old information is deleted. If nothing is replaced, the new information is inserted into the string. The instruction uses the following format:

 

 

[label]

SPLICE

{source},{dest},{count}

 

Where:

label

Optional. A Program Execution Label.

source

Required. A previously defined Character String Variable or Literal whose Logical String is used.

dest

Required. A previously defined Character String Variable that is modified beginning at the Form Pointer for a length of {count}.

count

Required. A previously defined Numeric Variable, Expression, or decimal constant indicating the number of bytes to replace in the {dest} variable.

Flags Affected: EOS, OVER

Note the following:

  1. The data in {dest} starting at the Form Pointed character for a length of {count} is deleted. The data in {dest} after the last byte deleted is shifted to the Form Pointed character.

  2. The data in {source} starting at the Form Pointed character continuing to the Length Pointed character is inserted into {dest} starting at the Form Pointed character of {dest}. The data in {dest} starting at the Form Pointed character is shifted to make room for the new data.

  3. After the operation, the Logical Length of {dest} is changed by the difference between {source} and {dest}.

  4. If {count} is zero, nothing is deleted from {dest}.

  5. If {source} is a Null String, nothing is inserted into {dest}.

  6. If non-blank data is lost in {dest} or data is lost from {source} as it is moved to {dest}, the OVER flag is set.

  7. If {dest} is a Null String, the EOS flag is set and nothing else is done.

  8. If {dest} becomes null as a result of the SPLICE operation (all data is deleted between the FP and LL), the Form Pointer is set to zero.

 

 

See Also: Example Code, Character String Instructions

 



PL/B Language Reference SMAKE SQUEEZE