Sum AT break

I have the following logic in my code
AT BREAK OF #FIELD1
WRITE(1) OLD(#AMOUNT-CODE)
OLD(#FIELD1)
OLD(#FIELD2)
SUM(#AMOUNT) (EM=+ZZZ,ZZZ,ZZZ,ZZ9.99)
ADD SUM(#AMOUNT) TO #TOTAL-AMOUNT

What does the ‘AT BREAK’ do?
does it sum up the amounts of the previous bunch when break is encountered?
Please help!
If there is any material available for natural commands, please let me know.

Thanks,
Pallavi

Education, Education, Education !! There is no substitute for it.

Try http://techcommunity.softwareag.com/ecosystem/documentation/natural/nat425mf/sm/atbreak.htm

Briefly, AT BREAK is a non procedural specification of code to be executed when the value of a variable (#FIELD1 in your example) changes.

OLD is a system function which retrieves the last value of the specified variable.

SUM the sum of the specified variable since the last “break”

The statement: ADD SUM(#AMOUNT) TO #TOTAL-AMOUNT is probably an indication that the person who wrote the code originally did not know the difference between SUM and TOTAL. TOTAL is a running sum, which appears to be what is being computed in the code excerpt you posted.

So, you are probably trying to learn Natural, without a class, by reading code, which seems to have been written by someone who is not very familiar with Natural.

steve

Thanks!! This helped!!