Files
rdb/man/check.rdb.man

157 lines
3.9 KiB
Groff

.TH check.rdb "" "" "/rdb Command"
.PC "Report any rows in which columns do not match head line"
\fBcheck.rdb < \fItableorlist\fR
.PP
.II "column^count"
.II "count columns"
.II "column^verify"
.II "verify columns
The command
.B check.rdb
counts the columns (number of tabs plus one) in the head line of an
.B /rdb
table or list formatted file.
Then it displays information on each row that does not match
the number of columns in the first head-line row.
You should use it to see if your data entry is correct.
If your head-line row is incorrect, then all of your rows will
be reported as errors.
.PP
.B check.rdb
returns zero when all is correct, and nonzero when
it has found an error.
You can use this status value (\fB$?\fR) in
a shell script to take different actions, depending upon
the validity of the table or list file.
.SH Examples
Here is a bad table, called
.BR badtable :
.DM
Date Account Debit Credit Description
------ ------- ------ ------ -----------
820102 101 25000 cash from loan
820102 211.1 25000 loan #378-14 Bank Amerigold
820103 150.1 10000 test equipment from Zarkoff
820103 101 5000 cash payment
820103 211.2 5000 note payable to Zarkoff
820104 130 30000 inventory - parts from CCPSC
820104 201.1 15000 accounts payable to CCPSC
820104 101 15000 cash payment to CCPSC for parts
.DE
.PP
It is hard to see anything wrong with it.
However, when we run the command
.DM
check.rdb < badtable
.DE
.PP
we see the following output:
.DM
check.rdb: Columns (4) do not equal headline columns (5) in row 3 (line 5).
820103 150.1 10000 test equipment from Zarkoff
.DE
.PP
The command
.DM
see < badtable
.DE
.PP
gives us the following output:
.DM
Date^IAccount^IDebit^ICredit^IDescription$
----^I ------^I-----^I------^I-----------$
820102^I101^I25000^I^Icash from loan$
820102^I211.1^I^I25000^Iloan number #378-14 Bank Amerigold$
820103^I150.1\ \ \ 10000^I^Itest equipment from Zarkoff$
820103^I101^I^I5000^Icash payment$
820103^I211.2^I^I5000^Inote payable to Zarkoff Equipment$
820104^I130^I30000^I^Iinventory - parts from CCPSC$
820104^I201.1^I^I15000^Iaccounts payable to CCPSC^I$
820104^I101^I15000^I^Icash payment to CCPSC for parts$
.DE
.PP
Note that a tab is missing from row 3 (line 5) of
.BR badtable ,
between values 150.1 and 10000.
The spaces hide the fact that it is missing.
.PP
When you work with a large file, run
.B check.rdb
first.
It will find the tab problems and give you the information you need to
find them.
Then use a text editor to correct the problem.
.\"When using
.\".BR vi ,
.\"turn on the number
.\"option so you can see line numbers:
.\".DM
.\" vi table
.\".sp
.\" :set number
.\".DE
.PP
You can move down to the first bad line by typing the following
.B vi
command
.BR :5 .
This takes you to line 5.
Then to see the line, type the list command
.BR l: .
(This is the letter
.BR el ,
not the number one).
Or to do it in one step (move and list), type
.BR :5l .
Or you can using the following colon command
to set all of the lines in the file to display tabs:
.DM
:set list
.DE
.PP
To return it to normal display, use the command:
.DM
:set nolist
.DE
.PP
Edit in whatever changes you need, then go to the next bad line.
You can change a space to a tab with the following command:
.DM
:s/ /^I/
.DE
.PP
where the
.B ^I
is the key on your keyboard that produces a tab.
If you want to list three lines above and below the bad line, type:
.DM
:-3,+3l
.DE
.PP
If you use \fBve\fP to enter your data, you will
have fewer problems like this.
Data from foreign sources should
be checked carefully before you use it with \fB/rdb\fR.
.SH "See Also"
.B
see,
ve
.R
.br
COHERENT Lexicon:
.B
elvis,
me,
vi
.R
.SH Notes
This command is named
.B check.rdb
rather than
.BR check ,
as in other implementations of
.BR /rdb ,
to avoid clashing with the COHERENT command
.BR check ,
which does something very different.