unload Data using ADACMP

How can I unload the data to flat file using ADACMP with delimiter ( | or % or # ).

any examples. … or steps


The best way would be to use NATURAL. There you got no problems with packed or unpacked formats, time- or date-fields, multiple fields, etc.

If you are forced to do it without natural, you have to write a converter. This can be really time-consuming:

  1. use ADAULD to unload data
  2. use ADADCU to uncompress data
  3. write a converter, which converts uncompressed data to ascii (but in consideration of the FDT)

do you have any sample natural programs for unloading data?

any help would be appreicated


You have to be careful with writing Numeric fields directly to a workfile. It is better to do a move edited before. So the signs of the numbers are translated correctly. Alphanumeric fields are no problem…

define data local
01 file1 view of ddm_name
02 AA       (A10)  /* A10 on database
02 AB      (P5.2)  /* P4  on database
02 AC        (N4)  /* U4  on database
01 #delimiter   (A1) CONST <';'>
01 #converted_p (A9)
01 #converted_u (A5)
define work file 1 '/tmp/test.txt'
read file1
  move edited AB         (EM=+99999.99) to #converted_p
  move edited AC         (EM=+9999)     to #converted_u
  write work file 1
    AA             #delimiter
    #converted_p   #delimiter
    #converted_u   #delimiter
close work file 1