ubbatch

NAME

ubbatch – batch load data into a table

SYNOPSIS

ubbatch -[0 A D P* Y* a*-array* b -body* c d e* f* -head* -join* n# o q s -tail* u] <table>

DESCRIPTION

ubbatch is used to batch load data into a UNIBASE file.

Records to be imported are passed to the standard input of ubbatch either through a pipe or by redirecting standard input.

ubbatch supports a number of input formats: records, csv, and Unibase A format.

Each input record is normally in the same format as the record stored in the UNIBASE table. This means that expressions and unions must not be part of the input record.

Records are lines of text terminated by line feeds. Each field is the same width as the width in the Data Dictionary.

Some of the command line options allow for different data formats.

FLAGS

FLAGARGUMENTTYPEDESCRIPTION
-0  Use attribute/value format but don’t pad with zeroes

This format is the same as the -A format below except that sequence numbers and counters aren’t padded with zeroes.

Boolean fields aren’t initialised either.
-A  Use attribute/value format

In this format each attribute (field) in a record is on a separate line. The line is divided into two parts. The first part (ending with a ‘,’) is the attribute name, while the second is the attribute value. Missing attributes are set to their default values.


Each record is terminated by a line starting with “>”.

-D  Alternate Date Format

This option allows for the alternative date format CCYYMMDD.

Normally, all dates are expected to be in the format DD.MM.CCYY (or DD/MM/CCYY). Using this option reads dates in the alternate format.
-PpipetextNamed Pipe Input

ubbatch will read its input from the name pipe “pipe”.


To do this ubbatch becomes a daemon and continuously reads pipe. It must be manually killed to terminate it. The named pipe must exist before ubbatch is called, it will not create it if it doesn’t exist

-YdictionarytextUse alternative data dictionary

ubbatch will use dictionary instead of the normal data dictionary.

-aformattextPrint record format as each record is loaded

This is a standard record format. eg

[customerId] - [customer]

As each record is loaded this format is printed.

NB if new records get a new sequence number, the new sequence number will be printed if requested.

Using this option will suppress other reporting formats such as the record count.
–arrayformattextFormat out for new records as an array
Before any outout “[” is printed
After all new records “]” is printed
In between each new record the optional “–join” format is printed
-b  CSV format.

This option allows ubbatch to read CSV dump formats.

In this format each record is a line of ASCII text. Fields are separated by commas with “”surrounding text and date fields, but not numbers.

e.g “FRED SMITH”,”10 JOHN ST”,”TOWN”,49,3.72

–bodyformattextuse this as the format to echo for every new record
-c  Count Only

Only print a total of the records processed. This option will suppress the normal “Records Processed” message that is printed every ten records and will instead print a single number being the total records processed.

This switch is ineffective if the ‘-s’ switch is also used.
-d  Debug

This option gives a debug output.

As ubbatch reads the Data Dictionary each line is echoed to the screen. In this way the exact point at which an error occurs can be observed and corrected
-efiletextError Log File

Records that can’t be written because of some error are normally written to /dev/null.

With this option they are saved in “file”.
-fseparatortextInput Record Field (Attribute) Separator.

Instead of fixed length input records, this option allows for variable length records with each field separated by a field separator, which in the example below is the character “:”

ubbatch -f : stock < stock.txt

–headformattextFormat to echo before any new records
–joinformattextFormat to add after each new record when array format chosen
-nnumbernumberRecords Processed Interval

Print record count every number records instead of default 10.

-o  Standard Output

When this flag is given ubbatch writes the records to standard out instead of the table.

This is most useful when used as a part of a pipeline. eg


echo "x,a" | ubbatch -A -o table

The -o option will always sets the quiet flag (-q).

The record on standard output is exactly as it would be stored (dates in CCYYMMDD order).

-q  Quiet Mode

When this flag is given ubbatch doesn’t write any output.
-s  Allocate Sequence Numbers

This causes ubbatch to allocate new sequence numbers when it adds records to the file.

When ubbatch is running it normally outputs a message every 10 records:

Records processed: 10

When the -s option is used, each sequence number is printed as it is generated.

–tailformattextPrint format after all new records
-uIgnore duplicate records

Normally ubbatch will record an error if one of the keys for the record to be inserted is a duplicate when a unique key has been specified.

Using this flag means ubbatch will act as if the record was inserted with no error.

ERRORS

EXAMPLE

SEE ALSO