# Insert a new record in adabas table

**URL:** <https://techcommunity.softwareag.com/t/insert-a-new-record-in-adabas-table/58049>\
**Category:** Forum\
**Tags:** Adabas-Natural, Adabas, Adabas-Basics-on-Linux-Unix-Windows, Adabas-on-Windows-UNIX, Adabas-on-Linux\
**Created:** [June 14, 2006, 3:31pm UTC](https://techcommunity.softwareag.com/t/insert-a-new-record-in-adabas-table/58049 "2006-06-14T15:31:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prabhus](https://avatars.discourse-cdn.com/v4/letter/p/aeb1de/32.png) [@Prabhus](https://techcommunity.softwareag.com/u/Prabhus)\
**Post date:** [June 14, 2006, 3:31pm UTC](https://techcommunity.softwareag.com/t/insert-a-new-record-in-adabas-table/58049/1 "2006-06-14T15:31:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [June 14, 2006, 3:39pm UTC](https://techcommunity.softwareag.com/t/insert-a-new-record-in-adabas-table/58049/2 "2006-06-14T15:39:49Z")

</div>

> [@Prabhus](#):
>
> How to insert a new record in adabas table

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](http://techcommunity.softwareag.com/ecosystem/documentation/natural/nat621win/pg/pg_dbms-over_0240.htm). 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

---

<div class="post-metadata">

**Author:** ![Prabhus](https://avatars.discourse-cdn.com/v4/letter/p/aeb1de/32.png) [@Prabhus](https://techcommunity.softwareag.com/u/Prabhus)\
**Post date:** [June 14, 2006, 3:56pm UTC](https://techcommunity.softwareag.com/t/insert-a-new-record-in-adabas-table/58049/3 "2006-06-14T15:56:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [June 14, 2006, 7:06pm UTC](https://techcommunity.softwareag.com/t/insert-a-new-record-in-adabas-table/58049/4 "2006-06-14T19:06:13Z")

</div>

> [@Prabhus](#):
>
> Please could you let me know the process for ADACompress and ADAload in windows based adabas.

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:

```auto
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:

```auto
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:

```auto
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](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.

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [June 19, 2006, 12:47pm UTC](https://techcommunity.softwareag.com/t/insert-a-new-record-in-adabas-table/58049/5 "2006-06-19T12:47:13Z")

</div>

> [@Matthias](#):
>
> 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…

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):

```auto
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.

---

<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:39pm UTC](https://techcommunity.softwareag.com/t/insert-a-new-record-in-adabas-table/58049/6 "2021-04-02T14:39:01Z")

</div>


