Import CSV data into ADABAS

We have NaturalONE CE 8.2.

In order to play with data from an existing Non-Adabas database, we would like to import a CSV file into an Adabas database file which has been created with suitable field definitions.

Can you give us an example how to do it?

We looked in the DBA Workbench and in the Utilities section of the Adabas docs, but were unable to find any help.

Many thanks.

Hi Hubert,

Your best bet is to write a Natural program to load the data. I don’t know of any way to do it using Adabas utilities.

Maybe The ADACMP-Parameter SEPERATOR helps you…

http://techcommunity.softwareag.com/ecosystem/documentation/adabas/ada6110os/utils/cmp.htm#cmpseparator

When did that sneak in? :o It’s documented in v6.1 so it must be at least 4 years ago!

This old dog has learnt a new trick today. :slight_smile:

Cheers,
Graeme

Hi (Mate) Graeme :smiley: ,

The link points to open system v6.1 doco and the SEPERATOR feature is available there.

Looks like the Mainframe latest verison v8.2.3 still doesn’t support the same.

Thanks for mentioning the ADACMP tool. It must be used in conjunction with ADAMUP to do the job.
The documentation is quite hard to read, and a fully worked example would appear to be useful.
For the benefit of other readers, however, the following *.bat file shows how it is done.

The call is:
csv.bat input dbid filenumber [separator]
When no separator is given, semicolon is assumed.

Just remember to have the Adabas bin directory on your environment PATH variable so that ADACMP and ADAMUP can be found.

Cheers,
Hubert

@echo off
cls

rem ***
rem * Import a given csv file into an adabase file.
rem * Syntax: %0   csv-input-file   dbid   filenumber   [separator]
rem ***

set CMPIN=%1
if not "%CMPIN%" == "" goto continue

echo Syntax: %0   csv-input-file   dbid   filenumber   [separator]
goto exit

:continue
if exist %CMPIN% goto begin

echo Input file %CMPIN% not found.
goto exit

:begin

set CMPDTA=csv.dta
set CMPDVT=csv.dvt
set CMPERR=csv.err

if exist %CMPDTA% del %CMPDTA%
if exist %CMPDVT% del %CMPDVT%
if exist %CMPERR% del %CMPERR%

set sep=%4
if "%sep%" == "" set sep=\;

echo adacmp DBID=%2 FILE=%3 SEPARATOR=%sep%
echo.
adacmp DBID=%2 FILE=%3 SEPARATOR=%sep%

if exist csv.err goto error

set MUPDTA=csv.dta
set MUPDVT=csv.dvt
set MUPERR=csv.err

echo.
echo adamup   DBID=%2    UPDATE=%3    ADD
echo.
adamup   DBID=%2    UPDATE=%3    ADD

if exist csv.err goto error
goto exit

:error
set ERRIN=csv.err
adaerr dump

:exit