MOVE - Arithmetic Expression to Numeric Field Examples


Example 1:

 

  

MOVE

(VAR1+VAR2+27.3) TO ANS

 

 

Variable

PL

Contents

Before:

ANS

8

•••85.10

 

VAR1

7

••10.15

 

VAR2

8

••100.05

 

After:

ANS

8

••137.50

 

Remaining variables are unchanged.

 

No Condition Flag is set.

 

Example 2:

 

  

MOVE

((((VAR1 + VAR2) / 10.5) - 2) * 2) TO ANS

 

 

Variable

PL

Contents

Before:

ANS

8

•••23.15

 

VAR1

2

•8

 

VAR2

3

••2

 

After:

ANS

8

•••-2.10

 

Remaining variables are unchanged.

 

The LESS Condition Flag is set.

 

Example 3:

 

  

MOVE

((ANS+1)*2),ANS

 

 

Variable

PL

Contents

Before:

ANS

3

••5

 

After:

ANS

3

•12

 

No Condition Flag is set.

 

Example 4:

 

  

MOVE

((AMOUNT/TOTAL)*100) TO PERCENT

 

 

Variable

PL

Contents

Before:

AMOUNT

3

•55

 

TOTAL

3

122

 

PERCENT

6

•54.23

 

After:

PERCENT

6

•45.08

 

No Condition Flag is set. If this same calculation was performed using the CALC statement, the result would be zero.

 



PL/B Language Reference MLITERAL Example MOVE - Character String to Character String Examples