0

Can you explain what the += means in this statement?

Eval      AssGr2Pun += FinQty#        

Here is the rest of the code for context:

 Exsr      FinItmTot                 
 Eval      AssGr2Pun += FinQty#      
 If        OrderAdd = 'N'            
 Eval      Gr2TPass += 1             
 Eval      OrderAdd = 'Y'            
 Endif                               
 Eval      AssGr2Pst += 1            
 When      OhReqd = Today            
 Exsr      FinItmTot                 
 Eval      AssGr2Tun += FinQty#      
 If        OrderAdd = 'N'            
 Eval      Gr2TTday += 1             
 Eval      OrderAdd = 'Y'            
 Endif                               
 Eval      AssGr2Tod += 1            
 When      OhReqd = Tomorrow         
 Exsr      FinItmTot               
8
  • if that's anything like most other languages that use +=, then x += 1 is the equivalent of x = x + 1
    – Marc B
    Jun 24, 2014 at 21:54
  • It means to add and assign in a single operation. X += 4 is the same as X = X + 4. Jun 24, 2014 at 21:55
  • += does not seem to be in any of the RPG language references. Jun 24, 2014 at 21:58
  • but they are using it so it must be somewhere
    – Adams
    Jun 24, 2014 at 22:39
  • 2
    For current reference information regarding IBM i, please refer to the IBM i Knowledge Center as illustrated in JamesA's correct answer.
    – WarrenT
    Jun 24, 2014 at 22:51

2 Answers 2

9

This is an assignment operator.

Where <target> <assignment operator> <expression>:

  • = The expression is assigned to the target
  • += The expression is added to the target
  • -= The expression is subtracted from the target
  • *= The target is multiplied by the expression
  • /= The target is divided by the expression
  • **= The target is assigned the target raised to the power of the expression
0
1


This operator is useful with char varying variables as well.

D wVar S 32740a Varying

/Free

wVar='My name';
wVar+=' is';
wVar+=' Charly';

*INLR = *On;
/End-Free

Of course it's just an example to show this capability.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.