5.1 Introduction
This section describes, in alphabetical order, commands available in UNIBASE.
5.1.1 Manual Page Command Syntax
Unless otherwise noted, commands in the SYNOPSIS section of a manual page accept options and other arguments according to the syntax. Interpret them as explained below:
name [-option…][cmdarg…]
where
[ ] Surrounding an option or cmdarg that is not required
… Indicates multiple occurrences of the option or cmdarg.
name the name of the executable file
option (Always proceeded by a “-“).
noargletter… or argletter optarg[,…]
noargletter A single letter representing an option without an option argument. Note: More than one noargletter option can be grouped after one “-“.
argletter A single letter representing an option requiring an option argument
optarg An option argument (character string) satisfying a preceding argletter. Note that groups of optarg’s following and argletter must be separated by commas or separated by a white space and quoted.
cmdarg Pathname (or other command argument) not beginning with “-“.
5.1.2 Environment Variables
UNIBASE substitutes environment variables for their values as it reads dictionaries or format files. If you do not define a variable, UNIBASE copies it as is, allowing another process (e.g., a shell) to perform the substitution later.
Using Environment Variables is a good way to get a customised application without writing separate programs.
UBERROR File for logging UNIBASE errors
UID User Login ID
PRINT Print Screen Command
TERM Terminal Type
MAIL See Mail (section )
MAIL CECK See Mail (section )
MAILER See Mail (section )
MAILPROGS See Mail (section )
MAXIDLE Idle time (no keystrokes) before terminal locked
UBDIR Location of UNIBASE configuration files (default /usr/lib/ub)
DICTIONARY Name of data dictionary file (default dict.dat)
TTY Terminal Line
UBPG Program to use for screen out put (default pg)
5.1.3 Included Files
You can use include files in the Data Dictionary, screen formats, report formats, and more. You can direct UNIBASE to read from an include file at any time by placing a line starting with ‘@’ in the input file. UNIBASE uses the remainder of that line (after skipping spaces or tabs) as the name of the include file to read. UNIBASE determines the include file name after it completes any environment variable substitutions.
@format.loc
Will direct UNIBASE to read from the file “format.loc” before reading the rest of the current file.
Include can be nested.
WARNING: No check is undertaken on recursive calls.
5.1.4 Line Draw Graphics
ubmulti, ubprompt and ubreport all recognise the following conventions from putting line drawing on the screen:
– in the first column, draw a line across the screen
~ draw a horizontal line
| draw a vertical line
Additionally these programs will adjust the graphics to include corners, tees, crosses etc as required.
5.1.5 Mail
UNIBASE can check form mail in much the same way as the shell. The same environment variables—plus a few extras—control this process and extend the mail system’s functionality.
5.1.5.1Mailcheck
The MAILCHECK environment variable specifies the time in seconds between checks for incoming mail. You must set this variable to enable the mail checking routines. UNIBASE stores the time it last checked mail in a file called /tmp/mail/<process group id>. This separate storage allows the mail checking variables to function even if the user is not running a program for MAILCHECK seconds.
5.1.5.2 Mailpath
‘:’ separated list of files to check.
NB. Each name can be followed be a ‘%’ and a message to be used rather than the default “you have mail”.
Eg. MAILPATH=”/usr/mail/john%mailx:/usr/stocknew%newstock”
5.1.5.3 Mailer
Mail program to use to read mail, default is “mail”
Mailprogs
‘:’ separated list of programs to use. Each list item pairs a mail file with a program, separated by a ‘%’. Use this program to read mail from the file instead of the default “mail” or the one in “MAILER”. You can only specify the mail file in the command by its name.
5.1.6 Error Codes
Note: There are gaps in this list as not all codes have been allocated.
Note: Not all errors cause UNIBASE to print a message with an error code. This section describes the codes that an error may return. Many of these codes are self-explanatory. UNIBASE marks certain codes as RESERVED, using these internally. Programmers or users should not see them.
To see the line in a program/dictionary that caused an error, call the program specifying the –d flag. (see section )
All program errors are recorded in a file “.uberror” in the directory where the program executes. (see uberror XXX) for the format of this file.
As this file can grow, it is good practice to regularly examine and remove it. For remote maintenance, you can email it to the support site.
1. | OPERATING SYSTEM ERROR When an operating system call returns an error, the system usually reports the operating system error code instead of the error itself. Most Unix Systems list these codes in the intro. |
2. | UNEXPECTED END OF FILE An end-of-file condition occurred while reading a record. This error usually indicates a corrupt key file; therefore, you must rebuild the table in question. Fortunately, users do not often encounter this error, but they are most likely to see it after an abnormal system shutdown. |
3. | NO FILE NAME ENTRY A table has been referenced that does not exist in the Data Dictionary |
4. | ACCESS PERMISSION DENIED A user has tried to access a file to which they have no access permission |
5. | RESERVED |
10. | NO DICTIONAY AVAILABLE The program cannot find a Data Dictionary. This happens when: The file dict.dat is missing from the current directory.The environment variable DICTIONARY does not exist.In some cases, you do not specify the D option on the command line. |
11. | NO TABLE NAME WHERE ONE WAS EXPECTED |
12. | DICTIONARY NOT LOADED This is an internal error and should be reported to Zenucom |
13. | TABLE NOT DEFINED IN DICTIONARY A table has been referenced that does not exist in the Data Dictionary |
14. | COMMA (,) AFTER FIELD NAME MISSING |
15. | INVALID OR MISSING FIELD SIZE |
16. | INVALID OR MISSING ARRAY SIZE |
17. | INVALID FIELD TYPE |
18. | RESERVED |
19. | TWO OR MORE ASSOCIATIONS BETWEEN TABLES Only 1 association between two tables is meaningful. This error is often caused by declaring a field a Foreign Key filed (which implies an association) and also declaring the association in the association list. |
20. | NO FILE DESCRIPTION FOR TABLE You have too many files open. This error indicates that UNIBASE needs more file descriptors, as it opens two files per table as required. Either reconfigure your kernel for more file descriptors (per user) or revise the application.. |
21. | RESERVED |
22. | RESERVED |
30. | CAN’T FIND FIELD NAME IN TABLE DEFINITION |
31. | INVALID SUB FIELD START POSITION |
32. | INVALID SUB FIELD END POSITION |
33. | A DASH (-) WAS EXPECTED IN THE SUB FIELD DEFINTION |
34. | KEY NOT FOUND A screen, report, dump, etc has asked for a key ordering that it is not defined in the Data Dictionary. |
35. | INVALID SUB FIELD LENGTH |
40-52 | RESERVED |
60. | QUIT KEY USED TO EXIT |
61. | PASSWORD FAILED A password required was not entered correctly |
70. | OPERAND MISSING IN AN EXPRESSION Operands are numbers, fields, dates, strings and expressions surrounded by ‘(‘and’)’. |
71. | ADJACENT OPERATORS Two operators (+ – * / ^ etc) are next to each other in an expression |
72. | BINARY OPERATOR AFTER A UNARY OPERATOR A binary operator (+ – * etc) is placed after a unary operator (SIN, COS, ABS etc) |
73. | UNEXPECTED OPERATOR/OPERAND Whatever it was UNIBASE doesn’t like it. |
74. | NOT ENOUGH OR TOO MANY FIELDS IN AN OPTION |
80. | NO NAME GIVEN TO A COMMAND SECTION IN A MENU |
81. | NO OPTION IS A MENU |
5.2 ubaudit
ubaudit –log audit trail deatils
ubaudit –[a]
This program reads lines of input and logs them into the audit trail file ”/usr/adm/audit” which is not generally readable or writ5able, except to root (because it can’t be stopped) and members of the group “security”.
The format of “/usr/adm/audit” is:
A<identifier> : <sys time> : <usr> : <group> : \
<directory> : <tty> : <description> : <command>
{M<identifier> : <message>}
ubaudit reads standard input until end of file. Each line of input comprises a command (single letter) followed by data.
The commands are:
A – Audit Identifier
C – Command being Audited
D – Directory command ran in
F – Alternate audit files name instead of “/usr/adm/audit”
G – Group name of user
M – Rest of input is a message to store in the audit file
N – Notify user (may be repeated) by email if user is not logged on. If the first character of the user name is a “*” then the name is interpreted as a group name and all members of the group are notified.
T – tty the user was logged on
U – User name
X – Description of Audit Trail Entry
NB. The system time is given in tics as returned by time (2) and is determined by ubaudit. Any field not given is left empty.
When called with the –a flag, ubaudit writes a unique Audit Identifier to it output. ou should pass this value to any audit write request to identify a group of related audit comments. In particular, you can use it when the system writes audit comments at different times even though they apply to the same event.
Audit trails have a habit of growing to excessive size. If you use audit trails, you should concurrently develop a policy for monitoring, archiving, and resetting them. For example, you can set cron to mail the audit trail to a supervisor, archive and compress it, and then remove it.
5.3 ubbatch
ubbatch – batch process data
ubbatch [-Dbcdqs] [-P pipe] [-e table] [-f separator] [-n number] table
Here is that text rewritten for better readability, flow, and active voice, also correcting the typo “Dictonary”:
Use ubbatch to batch load data into a UNIBASE file. Each input record must match the format of the record that the UNIBASE file stores. This means that expressions and unions must not be part of the input record. Input records are lines of text where line feeds terminate each line. Each field in the input record must have the same width as defined in the Data Dictionary.
Command line options are:
-D 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 alternative format.
-P pipe ubbatch will read its input from the named pipe pipe. To do this ubbatch becomes a daemon and continuously reads pipe. IYou must manually kill the process to terminate it. Ensure the named pipe exists before calling ubbatch, as ubbatch will not create it if it does not exist.
-b 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 the text and date fields, but not numbers.
eg. “FRED SMITH”,”10 JOHN STREET”,”TOWN”,49,3.72
-c Print only the total count of processed records. This option will suppress the normal “Records Processed” message that ubreport prints every ten records. Instead, it will print a single number showing the total records processed.ed.
-d TThis option gives a debug output. As ubbatch reads the Data Dictionary, it echoes each line to the screen. In this way, you can observe and correct the exact point at which an error occurs.
-e file Records that can’t be written because of some error are normally written to the standard output, and saved in file.
-f 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 Print record count every number records instead of default 10.
-q Quiet mode. When this flag is given ubbatch doesn’t write any output.
-s This causes ubbatch to allocate new sequence numbers when it adds records to the file.
To batch lines of text in a standard text file called “sales.txt” to a UNIBASE file called “sales”:
ubbatch sales <sales.txt
When ubbatch is running it normally outputs a message every 10 records:
Records processed: 10
5.4 ubcheck
ubcheck – exhaustively check UNIBASE tables for structure errors
ubcheck <directory><application>{<table>}
Before ubcheck begins testing, it removes any existing .filecheck
file. Ubcheck then exhaustively checks every UNIBASE table in a directory for errors. It logs any errors it finds in a file called .filecheck
in that directory.
As ubcheck is exhaustive and can take a long time, you should best run it as an overnight process.
NB. UNIBASE routines are very robust. Machine failures are typically the only cause of table corruption, and the system usually detects these failures with a redundancy check performed each time a table is opened. This utility simply provides an extra level of assurance.
<directory> Directory to be tested.
<application> Application to be tested
<table> Optional table if only one table, rather than all tables, is to be tested.
5.5 ubcp
ubcp –copy one UNIBASE table to another
ubcp table1 [table2…] target
ubcp copies UNIBASE table (“.dat” and “.key” files) to a target name, table1 and target can not be the same. If target is an existing table, the contents of both of its “.dat” and “.key” files are going to be overwritten, but the mode, owner