Search code examples
ibm-midrangerpgle

RPG - what is += here?


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               

Solution

  • 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