Natural Program to Write ADABAS Data to Text or Excel File

Hello All,

I want to write a natural program to read all the adabas data files and write the data of each file to a text file or an excel file. Because I need to import the data to Oracle.

Any help will be appreciated :slight_smile:

Thanks in Advance,

You do not give any indication re. what operating system Natural
is running on, but if we are talking about Linux / Unix / Windows:

There are more direct ways like Entire Access to write to Oracle directly,
or both the Adabas SOA Gateway and the Adabas SQL Gateway will
provide means for a more direct transfer as well, but when you want
to go via Excel write to a CSV workfile from Natural.

Thanks for your quick reply :slight_smile:

Sorry but I’m new to Natural.

The used database is ADABAS 8.1.2 on an IMB 22096 computer and IBMz/OS version 1.9 operating system, and the natural version is 4.2.6 for mainframe

How to write the adabas data to csv workfile?
How can i get or download this file after writing to it? What’s the work file directory?

I tried to use (WRITE WORK FILE 1 #myVariable) and use (DOWNLOAD PC FILE 1 #myVariable), but i couldn’t get the file!!

DOWNLOAD PC requires Entire Connection, does your site have it ?

What does " i couldn’t get the file" mean, are you seeing error messages when writing the work file ?

If you have Entire Connection, it will take care of creating the CSV file for you when you use the DOWNLOAD PC # statement. Make sure you have the # (1 in your example) associated with PC in the work files startup parameter for Natural and either have PC=ON in the startup or issue %+ from the NEXT prompt before running your program.

If you don’t have Entire Connection, you need to format the data in CSV yourself and write the result to a sequential work file (in batch). Since you are unfamiliar with z/OS sequential file allocation, please consult your installation systems programmers and a JCL reference. The statement “WRITE WORK FILE 1” will expect a DDNAME of //CMWKF01 to be assigned in your JCL for output. An example might be:
//CMWKF01 DD DISP=(NEW,CATLG),DSN=ALY.ADABAS.CSV,
// LRECL=250,RECFM=VB,SPACE=(TRK,(5,5)),UNIT=DISK
(DSN, LRECL, UNIT, and other parameters will vary according to your application and system standards)

Once you have the sequential file, you can FTP to your mainframe host and download the sequential CSV file (in ASCII mode).

I have to question the decision to dump all your Adabas data into Excel or CSV format if the ultimate goal is to convert it all to Oracle. There are far better solutions than that. You may as well just print it all out and have someone key it in again. Seriously!

Wolfgang tried to say this as well. Even beyond his suggestions, you should think about replication products if systems need to co-exist for a while (in which case you’re definitely wasting your time with Excel and CSV files). Event Replicator, tRelational/DPS and other solutions will help you with pumping data in near real time or batched up as needed. Adabas utilities can help with one-time conversions by unloading and decompressing data into files you can import into Oracle from with the Oracle bulk loader and CTL files that define fixed width layouts.

Really we are just scratching the surface of the many options you have. I recommend you abandon the idea of dumping Adabas data into Excel for this process.