ubbatch – batch process data
ubbatch -[0 A D P* Y* b c d e* f* n# o q s] <table>
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.
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.
|-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 YYMMDD. Normally, all dates are expected to be in the format DD.MM.YY (or DD/MM/YY). Using this option reads dates in the alternate format.
|-P||pipe||text||Named 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.
|-Y||dictionary||text||Use alternative data dictionary
ubbatch will use dictionary instead of the normal data dictionary.
|-b||Universal Dump Format / Ascii Dump Format
This option allows ubbatch to read UDF (Universal Dump Format) 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
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.
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
|-e||file||text||Error Log File
Records that can’t be written because of some error are normally written to the standard output. With this option they are saved in “file”.
|-f||separator||text||Input 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
|-n||number||number||Records Processsed Interval
Print record count every number records instead of default 10.
When this flag is given ubbatch writes the records to standard out instead of the table.
This is most userful when used as a part of a pipeline. eg echo “x,a” | ubbatch -A -o table
This option always sets the quiet flag (-q).
The record on standard output is exactly as it would be stored (dates in CCYYMMDD order).
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.