# Using automatic break

**URL:** <https://techcommunity.softwareag.com/t/using-automatic-break/60881>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Linux\
**Created:** [April 26, 2006, 7:55pm UTC](https://techcommunity.softwareag.com/t/using-automatic-break/60881 "2006-04-26T19:55:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![C11](https://avatars.discourse-cdn.com/v4/letter/c/71e660/32.png) [@C11](https://techcommunity.softwareag.com/u/C11)\
**Post date:** [April 26, 2006, 7:55pm UTC](https://techcommunity.softwareag.com/t/using-automatic-break/60881/1 "2006-04-26T19:55:21Z")

</div>

Hello everybody,

I have a doubt about automatic break. I started in a new job few months ago and at this position firstly I’m training in natural development.  
To getting a new employees report with details like job function, company, ID, etc…ordered by ID, I got a problem. I need insert some breaks when the crescent ID numbers reach some values. What is the best way to do these breaks?. For example:

Company --------- ID

```
 X -------------------- 00100
 X -------------------- 00200
 X -------------------- 00300

```

Employee number with ID lower than 500: 3 \<--------- BREAK

```
 X -------------------- 00650
 X -------------------- 00700
 X -------------------- 00810
 X -------------------- 00910
 X -------------------- 01001

```

Employee number with ID grater then 500: 5 \<--------- BREAK  
Total X company employees: 8

Company --------- ID

```
 Y -------------------- 00010
 Y -------------------- 00020
 Y -------------------- 00025

```

Employee number with ID lower than 30: 3 \<--------- BREAK

```
 Y -------------------- 00031
 Y -------------------- 00035
 Y -------------------- 00042
 Y -------------------- 00051

```

Employee number with ID grater then 30: 4 \<--------- BREAK  
Total Y company employees: 7

Total employees: 15

Thanks,

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [April 27, 2006, 12:40am UTC](https://techcommunity.softwareag.com/t/using-automatic-break/60881/2 "2006-04-27T00:40:42Z")

</div>

you may be able to use the AT BREAK to do what you want - set an additional variable based on the break criteria, sort the data appropriately, then use the AT BREAK to display COUNT(brker) and additional AT BREAK, AT END paragraphs to display higher totals.

---

<div class="post-metadata">

**Author:** ![C11](https://avatars.discourse-cdn.com/v4/letter/c/71e660/32.png) [@C11](https://techcommunity.softwareag.com/u/C11)\
**Post date:** [April 27, 2006, 2:01am UTC](https://techcommunity.softwareag.com/t/using-automatic-break/60881/3 "2006-04-27T02:01:22Z")

</div>

Hi Douglas,

How will the additional variable based on the break criteria work? And how will its relation with COUNT be?

Thanks for help,

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [April 27, 2006, 2:24am UTC](https://techcommunity.softwareag.com/t/using-automatic-break/60881/4 "2006-04-27T02:24:29Z")

</div>

I am guessing, but it seems like you will probably have a table of “break values”. Such tables have a way of changing (usually when you want to go away on vacation).

Trying to set up a separate value could be messy. (Hi Doug, long time no see).

I would suggest (if my “guess” is correct) that you start the application by reading in the appropriate table of break points into an array. Then, as you read each record, execute code to ascertain whether a break has occurred or not.

steve

---

<div class="post-metadata">

**Author:** ![Wilfried\_B](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/wilfried_b/32/83_2.png) [@Wilfried\_B](https://techcommunity.softwareag.com/u/Wilfried_B)\
**Post date:** [April 27, 2006, 1:15pm UTC](https://techcommunity.softwareag.com/t/using-automatic-break/60881/5 "2006-04-27T13:15:23Z")

</div>

C

---

<div class="post-metadata">

**Author:** ![C11](https://avatars.discourse-cdn.com/v4/letter/c/71e660/32.png) [@C11](https://techcommunity.softwareag.com/u/C11)\
**Post date:** [April 27, 2006, 9:41pm UTC](https://techcommunity.softwareag.com/t/using-automatic-break/60881/6 "2006-04-27T21:41:14Z")

</div>

Thanks all,

It’s almost working. I used an additional variable and the command with COUNT function to guide the breaks; all this is inside the READ function. But the break is one line after it would have to stay. Look it:

Company --------- ID --------- Additional variable

X -------------------- 00100 ----- A  
X -------------------- 00200 ----- A  
X -------------------- 00300 ----- A \<— The BREAK must be after this line  
X -------------------- 00650 ----- B

Employee number with ID lower than 500: 3 \<--------- actual BREAK

X -------------------- 00700 ----- B  
X -------------------- 00810 ----- B  
X -------------------- 00910 ----- B  
X -------------------- 01001 ----- B  
.  
.  
.  
.  
.

How can I resolve this situation?

Thanks,

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [April 28, 2006, 12:41am UTC](https://techcommunity.softwareag.com/t/using-automatic-break/60881/7 "2006-04-28T00:41:43Z")

</div>

During break processing, both the old and new field values are available to you. Verify that you are displaying the “old” values, using the System Function OLD. Wilfried gave an example of this in the code sample in his earlier posting.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 2:40pm UTC](https://techcommunity.softwareag.com/t/using-automatic-break/60881/8 "2021-04-02T14:40:36Z")

</div>


