# The best solution?

**URL:** <https://techcommunity.softwareag.com/t/the-best-solution/80594>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-Code-Samples\
**Created:** [March 25, 2009, 8:52pm UTC](https://techcommunity.softwareag.com/t/the-best-solution/80594 "2009-03-25T20:52:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ekangal](https://avatars.discourse-cdn.com/v4/letter/e/edb3f5/32.png) [@Ekangal](https://techcommunity.softwareag.com/u/Ekangal)\
**Post date:** [March 25, 2009, 8:52pm UTC](https://techcommunity.softwareag.com/t/the-best-solution/80594/1 "2009-03-25T20:52:44Z")

</div>

The following sample code is a way of writing got better.

Thanks.

```auto

DEFINE DATA LOCAL
1 DDM1 VIEW OF TEST-JANUARY
 2 RECORD-1 (A10)
 2 RECORD-2 (A60)
1 DDM2 VIEW OF TEST-FEBRUARY
 2 RECORD-1 (A10)
 2 RECORD-2 (A60)
.................
.................
1 DDM12 VIEW OF TEST-DECEMBER
 2 RECORD-1 (A10)
 2 RECORD-2 (A60)
 
1 IN-RECORD (A10)
1 IN-MONTH (I4) 
END-DEFINE

INPUT IN-RECORD IN-MONTH

DECIDE ON FIRST VALUE OF IN-MONTH                                        
  VALUE 1                                                           
    PERFORM DISPLAY-01                                           
  VALUE 2                                                           
    PERFORM DISPLAY-02
...................
..................     
  VALUE 12                                                           
    PERFORM DISPLAY-12    
  NONE VALUE                                                            
    IGNORE                         
END-DECIDE 

DEFINE SUBROUTINE HESAPLA
FIND DDM1 WITH RECORD-1=IN-RECORD
 DISPLAY DDM1.RECORD-2
END-FIND
END-SUBROUTINE
DEFINE SUBROUTINE HESAPLA
FIND DDM2 WITH RECORD-1=IN-RECORD
 DISPLAY DDM2.RECORD-2
END-FIND
END-SUBROUTINE
..........................
.........................
DEFINE SUBROUTINE HESAPLA
FIND DDM12 WITH RECORD-1=IN-RECORD
 DISPLAY DDM12.RECORD-2
END-FIND
END-SUBROUTINE 
```

---

<div class="post-metadata">

**Author:** ![Jerome\_LeBlanc](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jerome_leblanc/32/111_2.png) [@Jerome\_LeBlanc](https://techcommunity.softwareag.com/u/Jerome_LeBlanc)\
**Post date:** [March 25, 2009, 9:19pm UTC](https://techcommunity.softwareag.com/t/the-best-solution/80594/2 "2009-03-25T21:19:25Z")

</div>

I am going to assume you are asking “Is there a better way to write this program?”

If all that you are doing is what you show then I would leave it the way it is. If there is more processing within each FIND, then I might suggest:

```auto
DEFINE DATA LOCAL
1 DDM1 VIEW OF TEST-JANUARY
 2 RECORD-2 (A60)
1 DDM2 VIEW OF TEST-FEBRUARY
 2 RECORD-2 (A60)
.................
.................
1 DDM12 VIEW OF TEST-DECEMBER
 2 RECORD-2 (A60)

1 HOLD
  2 RECORD-2 (A60)

1 IN-RECORD (A10)
1 IN-MONTH (I4)
END-DEFINE

INPUT IN-RECORD IN-MONTH

DECIDE ON FIRST VALUE OF IN-MONTH                                       
  VALUE 1                                                           
    PERFORM DISPLAY-01                                           
  VALUE 2                                                           
    PERFORM DISPLAY-02
...................
..................     
  VALUE 12                                                           
    PERFORM DISPLAY-12   
  NONE VALUE                                                           
    IGNORE                         
END-DECIDE

DEFINE SUBROUTINE DISPLAY-01
FIND DDM1 WITH RECORD-1=IN-RECORD
  MOVE DDM1.RECORD-2 TO HOLD.RECORD-2
  PERFORM PROCESS-RECORD
END-FIND
END-SUBROUTINE
DEFINE SUBROUTINE DISPLAY-02
FIND DDM2 WITH RECORD-1=IN-RECORD
  MOVE DDM2.RECORD-2 TO HOLD.RECORD-2
  PERFORM PROCESS-RECORD
END-FIND
END-SUBROUTINE
..........................
.........................
DEFINE SUBROUTINE DISPLAY-12
FIND DDM12 WITH RECORD-1=IN-RECORD
  MOVE DDM12.RECORD-2 TO HOLD.RECORD-2
  PERFORM PROCESS-RECORD
END-FIND
END-SUBROUTINE
DEFINE SUBROUTINE PROCESS-RECORD
DISPLAY HOLD.RECORD-2
END-SUBROUTINE
```

Also, since you don’t reference RECORD-1 except in the descriptor for your FIND loops, you don’t need to have it in your file views.

---

<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:** [March 26, 2009, 2:35am UTC](https://techcommunity.softwareag.com/t/the-best-solution/80594/3 "2009-03-26T02:35:22Z")

</div>

Are DDM1, DDM2, etc just different logical files within one physical file?

If so, you could just have something like:

FIND DDM WITH RECORD-1=IN-RECORD and month = in-month  
DISPLAY DDM.RECORD-2  
END-FIND

I am assuming here that there is some field on the record that identifies the month, and is a descriptor. If there is such a field, and it is not a descriptor, use a WHERE clause.

steve

---

<div class="post-metadata">

**Author:** ![Ekangal](https://avatars.discourse-cdn.com/v4/letter/e/edb3f5/32.png) [@Ekangal](https://techcommunity.softwareag.com/u/Ekangal)\
**Post date:** [March 26, 2009, 12:01pm UTC](https://techcommunity.softwareag.com/t/the-best-solution/80594/4 "2009-03-26T12:01:42Z")

</div>

I asked here to tell you simply gave this example. The current structure of this act will be customers Adabas files. There are about 25000000 records in an Adabas file. Process is more recent ones (to query). Approximately 800,000 by the daily motion (record) is created. These are first stored in an Adabas file. About every 15 minutes a month are transferred to the Adabas file.

In this case, your referral is appropriate for this structure? The logical structure, what happens to you?

Thanks.

---

<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:** [March 26, 2009, 4:43pm UTC](https://techcommunity.softwareag.com/t/the-best-solution/80594/5 "2009-03-26T16:43:51Z")

</div>

Hi Ekangal;

I am guessing a bit about your description of the problem.  
Please confirm, or correct, the following:

Every day you create 800,000 records, which are added to a “monthly” file. This file would be empty at the start of the month, and have about 25,000,000 records at the end of the month.

When a customer is querying the file, they would specify a month, and some sort of key (IN-RECORD). Does this combination determine a unique record in the file?

What happens at the end of a year? For example, I have a file or 25,000,000 records for January 2009. When we get to January 2010, is the January 2009 file archived in some way, so that there is only one January file at a time?

When the customer specifies a month, do they actually specify a month and a year?

steve

---

<div class="post-metadata">

**Author:** ![Ekangal](https://avatars.discourse-cdn.com/v4/letter/e/edb3f5/32.png) [@Ekangal](https://techcommunity.softwareag.com/u/Ekangal)\
**Post date:** [March 26, 2009, 5:59pm UTC](https://techcommunity.softwareag.com/t/the-best-solution/80594/6 "2009-03-26T17:59:28Z")

</div>

> [@](#):
>
> Every day you create 800,000 records, which are added to a “monthly” file. This file would be empty at the start of the month, and have about 25,000,000 records at the end of the month.

To follow correct.

> [@](#):
>
> When a customer is querying the file, they would specify a month, and some sort of key (IN-RECORD). Does this combination determine a unique record in the file?

For the first example I gave it a simple. Not an area called IN-RECORD. Description, account number (unique), action date, action type, the chip number(unique), movement details (peryodic group) as there is a lot of space. Between two dates here is a list of customers to take action. Example 01.01.2009 - 25.03.2009 between the customer’s actions.

> [@](#):
>
> What happens at the end of a year? For example, I have a file or 25,000,000 records for January 2009. When we get to January 2010, is the January 2009 file archived in some way, so that there is only one January file at a time?

January, February, March Adabas files 2009 information.  
April, May, June, July, August, September, October, November, December Adabas files 2008 information.

> [@](#):
>
> When the customer specifies a month, do they actually specify a month and a year?

An account number, account for the movements between the two dates are required to display.

---

<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:51pm UTC](https://techcommunity.softwareag.com/t/the-best-solution/80594/7 "2021-04-02T14:51:43Z")

</div>


