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