Insert a new record in adabas table

I am working in Natural/adabas in windows based version
How to insert a new record in adabas table . Is there any direct option available in adabas to load the data in a table(Please provide some example) or do I need to write program for each new row insertion. Please let me know

I find load option available in the windows based version and tried this and it failed.

There are at least two ways to insert rows into an adabas database:

  1. Use Natural. In this case I would recommend the Natural Programming Guide. There you can find lots of examples.
  2. Use adabas-Utilities ADACMP (compress) and ADAMUP (mass update)

If you want to become a Programmer → use way #1
If you want to become a Database admin → use way #2

Please could you let me know the process for ADACompress and ADAload in windows based adabas. I tried the same, but its confusing.Could you pls help me

If you choose this way, you have to do the following steps:

  1. Prepare a file containing the records you want to import.
  2. Use ADACMP to convert the file to compressed format.
  3. Use ADAMUP to import it to the database.

Let’s say you got a very simple ADABAS file (database 1, file 10) with the following record structure:

Field Definition Table:

   Level  I Name I Length I Format I   Options      I Flags
-------------------------------------------------------------
  1       I  AA  I    1   I    A   I                I
  1       I  AB  I    7   I    U   I DE             I
  1       I  AC  I    3   I    U   I NU             I

Prepare a file with the folloing content:

A;1234567;001;
B;7654321;002;
Z;0012121;003;

Next step is to run the utilities. In the LINUX-World it would look like the following:

export CMPDTA=/path/file.txt                  # name input file
export CMPDTA=/path/file_compressed.dat       # name output file
adacmp db=1 file=10 single_file separator=';'

export MUPDTA=/path/file_compressed.dat       # name input file
adamup db=1 add=10 update

In the DBA-Workbench you have to click a little bit more. But you’re able to set the path to the files and the options (SINGLE_FILE or UPDATE) like I did.

With periodic groups and multiple fields, it’ll get a bit more complex. If you need more detailed information please have a look at your adabas-documentation
http://techcommunity.softwareag.com/ecosystem/documentation/adabas/ada512unw/admin/loaddata.htm

Please note, that you can get problems if your separator occur in the field-data, too. If you want to be on the save side, you can use the Adabas compressed format for your input file as well. But that’s another story…

Hope this helps.

The thing with the compressed format works like this.

If we take the example from above, your prepared file should have the following content (in Hexadecimal):

0B 00 41 31 32 33 34 35    36 37 30 30 31 0B 00 42
37 36 35 34 33 32 31 30    30 02 0B 00 5A 30 30 31
32 31 32 31 30 30 33

Explanation:

  • Each record is preceded by a 2-byte-integer-counter which indicates the length of the following record. In my example, each uncompressed record has a length of 11 byte (1+7+3). So the value of this counter is always “0B 00”.
  • This means: The records are not separated by newline or any other character.
  • To keep it simple, the fields should be in the sequence as they are in the FDT.
  • You don’t have to care about the field-options DE and NU
  • If you got packed numbers in your record structure, you have to write the regarding values in your file
  • Each periodic group or multiple field is preceded by a 1-byte-integer-counter containting the occurance. If you got varying occurences, you’ll get different record lengths. This is why the records must have a “record-length counter” at the beginning.