Database Design

I would like to create a new DB and within it a file that is a duplicate of one in 4 other DB’s. I want the applications written in NATURAL & COBOL to read the new DB when it comes to records from the new duplicate file. It may have to read from within a loop reading the original file in the old DB as well.

Is it possible and if so, how can it be achieved with minimum effort. I know ADABAS Vista is available from SAG and can do the job for you. I have had the experience of it in operation in previous organization (zVM and only NATURAL/ADABAS) however was not the one who set it up. Please see attached for a clear picture.

SAGDBDesignQuery.ppt (221 KB)

Does the new file have to be read in a single READ loop ?

In that case, as you say, you will have to set it up as a Vista partitioned file,
if it doesn’t have to be a single READ loop then you can use USR2005N to switch file numbers under the covers.

I am not sure what to make of this sentence in your post:

If you just wanted to have everything that accessed the old file read the file on the new database, you could use NTTF/TF parms to say everything that calls to this dbid/fnr call to that dbid/fnr instead. But I am not sure what conditions reads against the original dbid/fnr are supposed to hit the original one or the new one(s).

Can you elaborate on that, please?

In looking at your powerpoint slide, it seems as though your need is to continue reading all the other files on the original database (e.g. file 200) but any access to file 999 should go to this new one. In that case, a Natural parameter TF or macro NTTF will do the trick.

Include this in your Natural parms for dbid 10 environment:

NTTF 10,999,50,999 XLATE DBID OF FNR 999

Each Natural environment will need to have an updated parameter with the proper “from database” value.

Alternatively, you could re-generate your DDM to hard-code that it is for DBID 50 instead of DBID 0 and re-catalog all modules that reference it, but that would not be as quick or clean, especially if you miss objects or a CATALL fails to recatalog everything (e.g. new compile-time error).

Thanks for the replies …

"It may have to read from within a loop reading the original file in the old DB as well.’ is in error.

Will the solurtions suggested apply to COBOL as well - not COBOL called from Natural modules.


My suggestion will only work for Natural. I am not very familiar with COBOL accessing ADABAS. But for COBOL, I would assume you’re making direct calls and have no benefit of DDMs for that, but rather have to plug in specific DBID and FNR values, in which case, I assume you’ll have to scan all your COBOL code where you move 999 to FNR and ensure you assign 50 to DBID for each occurrence. Someone with COBOL programming that reads ADABAS might have a more helpful suggestion there.

In COBOL you will need to populate the Adabas CB (Control Block) and provide the file number yourself anyway (unless you are using Adabas Native SQL (where you write SQL and a pre-compiler translates it to low-level Adabas calls)), so you are free to point to anything you need at any time.

A few comments:
Beside the programming language data integrity could be an issue. In case you update
data in more than one database within the same database transaction Two-Phase-Commit is recommended.
Adabas Vista partitions typically a large file in to managable portions across different databases. One
partition criteria is required.
If Natural cannot be the preferred lanuage, I would use the Adabas SQL Gateway, or the Adabas Client for Java
which also contains a REST interface.
An option to change the database ID would be to use a user exit in the Adabas link module and which it there,
it is just one place. Adabas Vista also provides a file mapping.