# How to access ADABAS file dynamically or Create a online screen tool to access ADABAS files

**URL:** <https://techcommunity.softwareag.com/t/how-to-access-adabas-file-dynamically-or-create-a-online-screen-tool-to-access-adabas-files/102557>\
**Category:** Forum\
**Tags:** Adabas-Natural, Adabas, Adabas-Basics-on-Linux-Unix-Windows, Adabas-on-Windows-UNIX, Adabas-on-Linux\
**Created:** [March 11, 2013, 10:24am UTC](https://techcommunity.softwareag.com/t/how-to-access-adabas-file-dynamically-or-create-a-online-screen-tool-to-access-adabas-files/102557 "2013-03-11T10:24:35Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vasanth\_Maringanti](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vasanth\_Maringanti](https://techcommunity.softwareag.com/u/Vasanth_Maringanti)\
**Post date:** [March 11, 2013, 10:24am UTC](https://techcommunity.softwareag.com/t/how-to-access-adabas-file-dynamically-or-create-a-online-screen-tool-to-access-adabas-files/102557/1 "2013-03-11T10:24:35Z")

</div>

Hello All,

Our team doesn’t have a tool to access/update an ADABAS file. So every time we need to view the records of an ADABAS file or update even a single record, we write a new ADHOC Natural program.

So I am trying to create an online screen to access a ADABAS file dynamically.

I just tried the below as a start to access ADABAS file dynamically.

Program

RESET #A (A30) #B (A30) #C (A30)  
MOVE ‘DATABASE-FILE’ TO #A  
MOVE ‘DATABASE-FIELD’ TO #B  
COMPRESS ‘READ’ #A INTO #C  
INCLUDE DYN-PGM ‘#C’ ‘#B’  
END

Copy code

&1&  
DISPLAY &2&  
ESCAPE BOTTOM  
LOOP

I am expecting the code in copy code to work as below

READ DATABASE-FILE  
DISPLAY DATABASE-FIELD  
ESCAPE BOTTOM  
LOOP

I am not sure why it doesn’t work. Could you please let me know your comments.

Also please let me know if there is anyother way of creating this tool.

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [March 11, 2013, 3:35pm UTC](https://techcommunity.softwareag.com/t/how-to-access-adabas-file-dynamically-or-create-a-online-screen-tool-to-access-adabas-files/102557/2 "2013-03-11T15:35:18Z")

</div>

CopyCode is included at compile time. So your resulting statement is

READ #C  
DISPLAY #B

What you need is to populate global variables.

```auto
RESET #A (A30) +B (A30) +C (A30) 
MOVE 'DATABASE-FILE' TO #A 
MOVE 'DATABASE-FIELD' TO +B 
COMPRESS 'READ' #A INTO +C 
RUN 'DYN-PGM'
END
```

Program DYN-PGM

```auto
+C 
DISPLAY +B 
ESCAPE BOTTOM 
LOOP 
END
```

The global variables will be evaluated when the program is RUN (which does a compile and execute).

---

<div class="post-metadata">

**Author:** ![Vasanth\_Maringanti](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vasanth\_Maringanti](https://techcommunity.softwareag.com/u/Vasanth_Maringanti)\
**Post date:** [March 12, 2013, 11:04am UTC](https://techcommunity.softwareag.com/t/how-to-access-adabas-file-dynamically-or-create-a-online-screen-tool-to-access-adabas-files/102557/3 "2013-03-12T11:04:14Z")

</div>

Thanks Douglas,

I am able to pass the variables from main program to the program called.

Main program

```auto

RESET #A (A30) +B (A30) +C (A30)   
MOVE 'ADABAS-FILE' TO #A       
MOVE 'ADABAS-FIELD' TO +B        
COMPRESS 'READ' #A INTO +C         
DISPLAY +C                         
 RUN 'DYN-READ'                    
END 
```

DYN-READ

```auto
WRITE '=' +C 'INSIDE DYN-READ'
+C                            
WRITE '=' +B                  
ESCAPE BOTTOM               
END                           
```

The below are the display statement

READ ADABAS-FILE

+C: ADABAS-FILE INSIDE DYN-READ  
READ ADABAS-FILE  
+B: ADABAS-FIELD

So I think it is taking READ ADABAS-FILE as a string and not as a statement, since it is not actually reading the records. In the +B field, we are having the field name instead of the field value.

SO do you think it is possible to access database this way?

Regards,  
Vasanth

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [March 12, 2013, 3:03pm UTC](https://techcommunity.softwareag.com/t/how-to-access-adabas-file-dynamically-or-create-a-online-screen-tool-to-access-adabas-files/102557/4 "2013-03-12T15:03:32Z")

</div>

You would greatly benefit if you purchased PEEK from Blenheim Software International, Ltd. You could cost-justify it by calculating how much time you and others spend writing adhocs to browse Adabas files (or the time and effort you will put into building and maintaining this yourself). We did the same years ago and I don’t know how we’d live without it.

The product is listed on this Software AG webpage:

[http://www.softwareag.com/corporate/products/adabas\_2010/integration/related\_products.asp](http://www.softwareag.com/corporate/products/adabas_2010/integration/related_products.asp)

or you can go directly to Blenheim’s website:

[http://www.blenheimintl.co.uk/adabas-details.php?s=peek-adabas-file-browser-editor](http://www.blenheimintl.co.uk/adabas-details.php?s=peek-adabas-file-browser-editor)

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [March 12, 2013, 5:31pm UTC](https://techcommunity.softwareag.com/t/how-to-access-adabas-file-dynamically-or-create-a-online-screen-tool-to-access-adabas-files/102557/5 "2013-03-12T17:31:25Z")

</div>

my apologies: for DYN-READ to work you have to change the +vars to &vars…so DYN-READ should be

```auto
WRITE '=' +C 'INSIDE DYN-READ'
&C                            
WRITE '=' &B                  
ESCAPE BOTTOM               
END
```

That lets Natural distinguish between dynamic program code (“&var”) and using the globals as variables (“+var”).

---

<div class="post-metadata">

**Author:** ![Vasanth\_Maringanti](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vasanth\_Maringanti](https://techcommunity.softwareag.com/u/Vasanth_Maringanti)\
**Post date:** [March 14, 2013, 4:58am UTC](https://techcommunity.softwareag.com/t/how-to-access-adabas-file-dynamically-or-create-a-online-screen-tool-to-access-adabas-files/102557/6 "2013-03-14T04:58:22Z")

</div>

Yes Brain,

You are right. Don’t know the reason but our project doesn’t allow us to buy peek. So we all thought of checking how difficult it is to develop our own tool.

Hi Douglas,

It is working 🙂 🙂 🙂

So I have taken this as a base to create the tool. Hope I wont get stuck…I will let you know the progress.

Thanks again for the prompt help

---

<div class="post-metadata">

**Author:** ![Vasanth\_Maringanti](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vasanth\_Maringanti](https://techcommunity.softwareag.com/u/Vasanth_Maringanti)\
**Post date:** [March 17, 2013, 12:02pm UTC](https://techcommunity.softwareag.com/t/how-to-access-adabas-file-dynamically-or-create-a-online-screen-tool-to-access-adabas-files/102557/7 "2013-03-17T12:02:39Z")

</div>

Hello Douglas,

I created the tool to display the fields of a database. It is working as expected.

So I tried to go to the next level of the tool, to update fields of a single record of a database.

But the problem here is that I created the dynamic program in which we are reading the database and displaying the required fields.

This dynamic program should be in reporting mode because we are not defining any fields.

But now when I want to update fields, it doesn’t allow because it is in reporting mode.

Do you have any other plan how this can be resolved?

Regards,  
Vasanth

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [March 18, 2013, 1:06am UTC](https://techcommunity.softwareag.com/t/how-to-access-adabas-file-dynamically-or-create-a-online-screen-tool-to-access-adabas-files/102557/8 "2013-03-18T01:06:52Z")

</div>

You can write update programs in reporting mode. Typically, you have a FIND or READ to obtain the record, then modifications to the values, then the UPDATE statement (line number reference to the FIND/READ). Approximately  
READ/FIND view…  
assign viewfieldone = ‘new value’  
UPDATE  
LOOP  
END TRANSACTION  
So, you need to generate the content of the &variables to produce valid reporting mode updates.

You can use structured mode too. Just more work since you need the fields listed

---

<div class="post-metadata">

**Author:** ![Vasanth\_Maringanti](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vasanth\_Maringanti](https://techcommunity.softwareag.com/u/Vasanth_Maringanti)\
**Post date:** [March 19, 2013, 11:27am UTC](https://techcommunity.softwareag.com/t/how-to-access-adabas-file-dynamically-or-create-a-online-screen-tool-to-access-adabas-files/102557/9 "2013-03-19T11:27:18Z")

</div>

Thanks for the response Douglas,

I used UPDATE WITH SAME RECORD and it worked.

But incluDing the Update functionality seems to be complex.

It works fine when we are updating the alpha fields.

But when we want to update the numeric field OR date field it creates a problem ( NAT0300 Operands cannot be transfered)

The problem is that I defined 10 fields with A30 as common length and format.

When user wants to use update functionality, he will use a function key which will display the current values of all the fields that he selected. He will have to over ride on the current values and use another function key to update it.

So to display the current values I will have to move the current database values to Map fields. Since the map fields are defined as A30 commonly, if any date or numeric value needs to be updated, problem occurs.

Vasanth

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [March 19, 2013, 3:03pm UTC](https://techcommunity.softwareag.com/t/how-to-access-adabas-file-dynamically-or-create-a-online-screen-tool-to-access-adabas-files/102557/10 "2013-03-19T15:03:31Z")

</div>

You will need to use MOVE EDITED and/or the VAL function to assign values stored in A30 format variables to non-alpha fields (numbers, dates, etc).

---

<div class="post-metadata">

**Author:** ![Vasanth\_Maringanti](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vasanth\_Maringanti](https://techcommunity.softwareag.com/u/Vasanth_Maringanti)\
**Post date:** [March 19, 2013, 3:12pm UTC](https://techcommunity.softwareag.com/t/how-to-access-adabas-file-dynamically-or-create-a-online-screen-tool-to-access-adabas-files/102557/11 "2013-03-19T15:12:55Z")

</div>

Hi Brian,

The problem here is that…we dont know what field is what format.

To explain you more clearly…

The user will select some 5 fields to display data from database using the tool…

```
                    field 1
                    field 2
                    field 3
                    field 4
                    field 5

```

These fields that he has chosen are random and we dont have any idea which field is alpha and which field is numeric.

So I commonly defined all fields as A30.

Problem doesn’t occur when we simply display all the fields. But if we try to update/override a field, we will move these fields (of A30 format) to the database fields.

So if we try to move a date or numeric field to the map field defined as A30…it gives us Nat0300 error

let me know if i am still unclear

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [March 20, 2013, 4:48am UTC](https://techcommunity.softwareag.com/t/how-to-access-adabas-file-dynamically-or-create-a-online-screen-tool-to-access-adabas-files/102557/12 "2013-03-20T04:48:20Z")

</div>

To go much further, you are going to have to consult meta-data. There are several sources you can look into:

- Predict
- Natural DDM
- ADABAS FDT  
There are APIs around for accessing each of them. If you have Construct, it provides several utilities specifically for accessing Predict information. But the nature of what you are trying to write suggests that you don’t have access to Construct. Other options are to use SYSEXT API USR1051N or use the SYSDIC\* DDM’s to read the dictionary information (see especially views SYSDIC-FI, SYSDIC-EL).

If you do not have Predict either, then check out SYEXT API’s with the keyword “DDM”. USR1058N, for example, will read a DDM, which you can parse to figure out what the fields and formats are that you are dealing with.

Finally, you can use Adabas direct calls to read the FDT for the lengths and formats of fields in a physical file.

---

<div class="post-metadata">

**Author:** ![Vasanth\_Maringanti](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vasanth\_Maringanti](https://techcommunity.softwareag.com/u/Vasanth_Maringanti)\
**Post date:** [March 21, 2013, 3:17pm UTC](https://techcommunity.softwareag.com/t/how-to-access-adabas-file-dynamically-or-create-a-online-screen-tool-to-access-adabas-files/102557/13 "2013-03-21T15:17:03Z")

</div>

Thanks Douglas,

It all made sense to me now. I will use SYSDIC-EL and code it.

Will let you know if any issues

Vasanth

---

<div class="post-metadata">

**Author:** ![Ronald\_Wijchers](https://avatars.discourse-cdn.com/v4/letter/r/e5b9ba/32.png) [@Ronald\_Wijchers](https://techcommunity.softwareag.com/u/Ronald_Wijchers)\
**Post date:** [March 25, 2013, 10:01am UTC](https://techcommunity.softwareag.com/t/how-to-access-adabas-file-dynamically-or-create-a-online-screen-tool-to-access-adabas-files/102557/14 "2013-03-25T10:01:12Z")

</div>

You could have a look at Paul Macgowan’s toolkit, it’s free :

[http://scctoolkit.atspace.com](http://scctoolkit.atspace.com)

Ronald

---

<div class="post-metadata">

**Author:** ![Jason\_Bandicoot](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jason_bandicoot/32/634_2.png) [@Jason\_Bandicoot](https://techcommunity.softwareag.com/u/Jason_Bandicoot)\
**Post date:** [June 25, 2013, 8:46am UTC](https://techcommunity.softwareag.com/t/how-to-access-adabas-file-dynamically-or-create-a-online-screen-tool-to-access-adabas-files/102557/15 "2013-06-25T08:46:54Z")

</div>

Hi Vasanth,  
Just wondering how this went.  
Am trying to do something similar at present - but wanting all DDM fields available. Am currently on the path of a program generator - to generate static programs.  
I’m thinking that I may not be able to do this using the dynamic program method (unless I go field by field - which maybe quite inefficient :shock: ). Manual mentions not to use global variable with an index in dynamic modules.  
Similar situation - no budget for a 3rd party tool at the moment.  
Any advice / tips / techniques / code samples welcome. 😃

Thanks  
Justin

---

<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, 3:02pm UTC](https://techcommunity.softwareag.com/t/how-to-access-adabas-file-dynamically-or-create-a-online-screen-tool-to-access-adabas-files/102557/16 "2021-04-02T15:02:59Z")

</div>


