Exporting Data

Nathan Rector

Natec Systems

nater@northcoast.com

http://www.northcoast.com/~nater/

At one time or another you may have wanted or needed to export your Multi-value data into a DOS format. Whether it was for your yearly taxes or to use the data in some DOS or Windows program to create graphs or spreadsheet.

In native platforms, exporting data seems impossible. It is not. There are several ways to export data in various DOS formats. Delimited is the easiest to do and requires no additional programming. Fixed field length data exports require an additional program, but can still be done in the native formats.

The first part of any format is gathering the information to be exported. If all the data can be generated from a standard LIST or SORT statement, then the REFORMAT command is the best for gathering information.

First thing to do when exporting data is to create a temp file to store the exportable items. This allows you to change the data without corrupting your existing database. From there, use the export command to transfer the needed data into the export DOS file.

The data in the temp file can be separate items even if you want to export all the data into one DOS file. The export command will take care of combining the individual items together.

Once you are satisfied with the data in the temp file, it is time to export onto the DOS disk. Most, if not all, Multi-value operating systems have some type of EXPORT verb. In this article I am using the EXPORT verb found the Pick flavors.

EXPORT TEMP.DATA * (CINOKTE

Replace: FE

With : 2C

Replace: FD

With : 5F

Select Pick item(s) to DOS File Name:

B:PICK.DAT

This example exports all the items in the TEMP.DATA file, sorts it, and then writes the data into one DOS file called PICK.DAT on a disk in the B: drive. All attribute marks (Hex FE) are converted to commas (Hex 2C), and all value marks (Hex FD) are converted to underscores (Hex 5F).

If you want to export the data into separate DOS files, then take out the 'c' option in the TCL statement's options section. Use the 's' option to use the item ids as the DOS file names.

As you can see exporting Multi-value data is not hard. As long as you don't have complex needs when exporting data, you can use this process or a variation of it.