SQUEEZE


NCHAR

 

The SQUEEZE instruction moves the logical contents of a string variable, numeric variable, constant, or literal to another string variable while removing characters. The instruction uses the following format:

 

(1)

[label]

SQUEEZE

{source},{dest}[,{delete}]

(2)

[label]

SQUEEZE

{source},{dest}[,KEEP={chars}]

 

Where:

label

Optional. A Program Execution Label.

source

Required. A previously defined Character String Variable, National Character String Variable, Numeric Variable, Constant, or Literal whose Logical String is used.

dest

Required. A previously defined Character String Variable or National Character String Variable that receives the {source} value.

delete

Optional. A previously defined Character String Variable, National Character String Variable, Literal, or National Character String Literal indicating the characters to delete from the source string during the transfer.

chars

Optional. A previously defined Character String Variable, National Character String Variable, Literal or National Character String Literal indicating the characters to keep from the source string during the transfer.

Flags Affected: EOS

Note the following:

  1. When {source} is a character variable, the transfer begins at the Form Pointed character and continues through the Length Pointed character (i.e., the Logical String) or until {dest} is full (whichever occurs first). The {source} operand remains unchanged unless {source} and {dest} are the same.

  2. The transfer into {dest} begins at the first physical character. If any characters are transferred, the Form Pointer of {dest} is set to one (1) and the Length Pointer of {dest} is set to the last character moved. If no characters are transferred, the Form Pointer and Length Pointer of {dest} is set to zero (0).

  3. If the {dest} is too small for the transfer, the EOS Condition Flag is set.

  4. If {delete} is not specified or is a null variable, spaces are removed.

  5. If {chars} is specified, it indicates characters to keep from the source string during the transfer. The KEEP option was added in version 9.0.

  6. If {chars} is a Null String, spaces are the only characters kept when the {source} string data is transferred to the {dest} variable.

 

 

See Also: Example Code, Character String Instructions

 



PL/B Language Reference SPLICE STORE