ADD Examples


Example 1:

 

  

ADD

SENDING TO RECVING

 

 

Variable

Format

Contents

Before:

SENDING

5.2

•••85.10

 

RECVING

6.2

•••110.50

 

After:

SENDING

5.2

•••85.10

 

RECVING

6.2

•••195.60

 

No Condition Flag is set.

 

Example 2:

 

 

Variable

Format

Contents

Before:

SENDING

5.3

•••25.773

 

RECVING

5.1

••500.1

 

After:

SENDING

5.3

•••25.773

 

RECVING

5.1

••525.9

 

No Condition Flag is set. SENDING was rounded to 25.8 before the operation.

 

Example 3:

 

 

Variable

Format

Contents

Before:

SENDING

3.2

750.00

 

RECVING

3.2

425.00

 

After:

SENDING

3.2

750.00

 

RECVING

3.2

175.00

 

The OVER Condition Flag is set. RECVING was too small to contain the sum 1175.00. The LESS and ZERO Condition Flags are unpredictable.

 

Example 4:

 

  

ADD

SENDING TO RECVING,OPTDEST

 

 

Variable

Format

Contents

Before:

SENDING

5.2

•••85.10

 

RECVING

6.2

•••110.50

 

OPTDEST

6.2

••••••.00

 

After:

SENDING

5.2

•••85.10

 

RECVING

6.2

•••110.50

 

OPTDEST

6.2

•••195.60

 

No Condition Flag is set.

 

Example 5:

 

  

ADD

POSITION, “20" GIVING OFFSET

 

 

Variable

Format

Contents

Before:

POSITION

5

•••45

 

OFFSET

4

•••0

 

After:

POSITION

5

•••45

 

OFFSET +

4

••65

 

No Condition Flag is set.

 

Example 6:

 

Enhanced array processing may cross-foot an array as follows:

 

ARRAY1

FORM

3(10)

X

FORM

5

  

...

 

  

MOVE

"0",X

  

ADD

ARRAY1,X

 

Each of the values of the elements in ARRAY1 is added to the variable X.

 



PL/B Language Reference AAMDEX Examples AFILE Examples