Unloading to Binary and Line Sequential Format

The -unload option creates a binary sequential file or a line sequential file from a Vision file. The command is:

vutil  -unload  [ -v ]  [ -b | -t ] [-l] [ -q ] [ -r ] source  destination

The source file is the Vision file to unload; the destination is the name of the file to create. If a file with the name destination already exists, it is deleted first. The records in the destination file are ordered by the primary key of the source file. This can be used to export data to other applications. vutil will not let you unload records from an encrypted file.

The source file is buffered according to the value in the A_SEQ_DEFAULT_BLOCK_SIZE variable. The variable must be set in the environment for vutil to use it. If the variable is not set, the default buffer block size is 4096 bytes. If the variable is set to "0", vutil -unload into a sequential file will perform record-based I/O. If the variable is set to a positive value, that value will be rounded up to the power of two equal to, or greater than the value. This will be the buffer size in bytes. The maximum buffer size is 1GB.

By default, the destination file is assumed to be a binary sequential file with an alternate format that is not compatible with the ACUCOBOL-GT runtime.

These are the destination file format options:

-v     This option produces a file that has variable-length records. Variable-length records occupy only as much disk space as necessary. Two or four bytes indicating record size are placed in front of each variable-length record when it is written to disk. (Different machines generate different prefixes. Thus, files produced with vutil -unload -v can be loaded with vutil -load -v on the source machine but are not necessarily portable to other machines.) The two- or four-byte field that is added to the record is not specified in your COBOL program, but some programs that access the records need to be aware of the extra bytes.

If -v is not present, fixed-length records are written.

-b This tells vutil -unload to produce a binary sequential file that is compatible with the ACUCOBOL-GT runtime.

If -v is not present, fixed-length records are produced.

The -v option causes vutil to produce variable-length records. The record length is stored in a two-byte record header.

-l This option places a read lock on the input Vision file. This improves performance, because the records can be read without needing to place and release locks on the individual records.
-t This tells vutil -unload to produce a file that has line sequential format. This means that the destination file is a simple text file, with records separated by line feeds.

This option implies -v (variable-length records), so the -v option is not necessary, although it is allowed.

-q This option causes vutil to exit (with status 99) if user interaction is required.
-r This option reads the records from the source file in the order that they occur in the data file, without using the index; the order of the records in the destination file is undefined.

Without this option, records are read in order according to the primary key as they are unloaded to the destination file. In a large file, reading all the records by the primary key can be slow if the actual record data is not generally ordered by the primary key.

Note: This option is not effective when unloading Vision 2 or Vision 3 files.