83 lines
2.1 KiB
Groff
83 lines
2.1 KiB
Groff
.TH tabletofix "" "" "/rdb Command"
|
|
.PC "Convert /rdb table format to fixed-length format"
|
|
\fBtabletofix \fIcolumn\fB=\fIn\fB\|[r] ... < \fItableorlist\fR
|
|
.PP
|
|
.II "table^convert to fixed-length"
|
|
.II "record^convert to fixed-length"
|
|
The command
|
|
.B tabletofix
|
|
converts
|
|
.I tableorlist
|
|
from variable-length \fB/rdb\fR format to the
|
|
fixed-length format used by many other data-base management systems.
|
|
.PP
|
|
.B tabletofix
|
|
works by either padding or truncating each
|
|
.I column
|
|
to make it
|
|
.I n
|
|
characters wide.
|
|
If the letter \fIr\fR
|
|
is used with the width specification,
|
|
.B tabletofix
|
|
right-justifies the
|
|
.I column
|
|
in question \(em that is,
|
|
it pads the column with leading blanks, assuming any are necessary.
|
|
Otherwise, the
|
|
.I column
|
|
is left justified \(em that is, it pads the column with trailing blanks.
|
|
.PP
|
|
.B tabletofix
|
|
also throws away the head lines, as well as all tab characters and
|
|
blank records.
|
|
.SH Example
|
|
Consider table
|
|
.BR journal ,
|
|
which looks like this when viewed with the command
|
|
.BR see :
|
|
.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^I10000^I^Itest equipment from Zarkoff$
|
|
820103^I101^I5000^I^Icash payment$
|
|
820103^I211.2^I^I5000^Inote payable to Zarkoff Equipment$
|
|
820104^I130^I30000^I^Iinventory - parts from CCPSC$
|
|
.DE
|
|
.PP
|
|
The symbol \fB^I\fR indicate a tab, and the symbol
|
|
\fB$\fR indicates a newline.
|
|
.PP
|
|
Now, let's generate a fixed-length field data base from \fBjournal\fR.
|
|
We'll use the fields
|
|
.BR Date ,
|
|
.BR Account ,
|
|
.BR Credit ,
|
|
and
|
|
.BR Debit .
|
|
We'll give the first two fields six bytes each;
|
|
and we'll give the last two fields seven bytes each, right justified:
|
|
.DM
|
|
tabletofix Date=6 Account=6 Debit=7r Credit=7r < journal > newjournal
|
|
.DE
|
|
.PP
|
|
This commands writes its output into file
|
|
.BR newjournal ,
|
|
which appears as follows:
|
|
.DM
|
|
820102101 25000
|
|
820102211.1 25000
|
|
820103150.1 10000
|
|
820103101 5000
|
|
820103211.2 5000
|
|
820104130 30000
|
|
.DE
|
|
.SH "See Also"
|
|
.B
|
|
column,
|
|
fixtotable,
|
|
see
|
|
.R
|