The best solution?

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

Thanks.


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 

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:

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.

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

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.

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

To follow correct.

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.

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

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