CMOVE


 

The CMOVE instruction transfers a single character from the source operand to the destination character string. The instruction uses the following format:

 

 

[label]

CMOVE

{source}{sep}{dest}

 

Where:

label

Optional. A Program Execution Label.

source

Required. A previously defined Character String Variable, a single character Literal, a National Character String Variable, a National Character String Literal, a {ctrl} representation or an EQUATEd value that is moved to the {dest} value.

sep

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

dest

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

Flags Affected: EOS

Note the following:

  1. The Form Pointed character of {source} or the character specified in {source} is moved into {dest} at its Form Pointed position.

  2. The Form Pointer and Length Pointer of both operands remain unchanged.

  3. If either operand is a Null String, no data transfer occurs and the EOS Condition Flag is set.

  4. Enhanced ARRAY processing is supported for the CMOVE instruction.

  5. Since CMOVE only accepts a single source character, no forcing character is required or allowed. To move a literal hash mark, use a single character literal source parameter ("#").

 

Example 1:

 

  

CMOVE

SENDING TO RECVING

 

 

Variable

PL

FP

LP

Contents

Before:

SENDING

10

5

8

ABCDEFGH··

 

RECVING

6

3

6

123456

 

After:

SENDING

10

5

8

ABCDEFGH··

 

RECVING

6

3

6

12E456

 

No Condition Flags are set (all FALSE).

 

Example 2:

 

 

Variable

PL

FP

LP

Contents

Before:

SENDING

10

5

8

ABCDEFGH··

 

RECVING

6

0

6

123456

 

After:

SENDING

10

5

8

ABCDEFGH··

 

RECVING

6

0

6

123456

 

The EOS Condition Flags are set. RECVING is a null string.

 

Example 3:

 

  

CMOVE

"X" TO RECVING

 

 

Variable

PL

FP

LP

Contents

Before:

RECVING

6

4

6

123456

 

After:

RECVING

6

4

6

123X56

 

No Condition Flags are set (all FALSE).

Example 4:

 

  

CMOVE

"#" TO RECVING

 

 

Variable

PL

FP

LP

Contents

Before:

RECVING

10

5

8

ABCDEFGH··

 

After:

RECVING

10

5

8

ABCD#FGH··

 

No Condition Flags are set (all FALSE).

 

 

See Also: MOVE, Character String Instructions

 



PL/B Language Reference CMATCH COMPRESS