"Cheat sheet" printout
For convenience, here's the entire help screen from ADB.
(A)SC text file (D)ata (B)atch processor [http://www.rs-freeware.org/adb]:
=====================================================================
ADB takes *up to* 2 input (data) files, called the `master' (`mast') &
`transaction' (`trans'). Both must be sorted on their respective keys.
Masts must be unique on their key, although duplicates allowed for trans.
Mast keylength must be less than or equal to trans keylength. You specify
the master layout with the `mast' statement (and the trans file w/ `trans').
ADB produces *up to* three output (data) files. The `m&t' output is built
from fields that can be drawn from a mast and a trans which match *case
insensitively* on a key. (If mast key shorter, only this part of key is
used in match). `m-t' output built from masts with no corresponding trans.
`t-m' output is the trans with no matching masts.
Before input files matched against each other, they can (optionally): be
converted from commas-n'-quotes, & then go through `basic' preprocessing
(which aligns fields, checks record lengths, &removes any ASC EOF); & sorted
(with duplicate removal if requested); & run through an awk postprocess.
Output files can optionally be: sorted (dup removal is possible); & an awk
script can be run against them to massage field values; & converted back to
commas-and-quotes. If there's no commas-and-quotes conversion at the end,
the awk script is free to output anything (i.e. print a report, etc.--the
file format need not be followed.) `mast',`trans',`m-t',`t-m', and `m&t' all
have associated command line args. **FREEWARE** by Rog
ADB Fields and Fieldsets:
==========================
1. Layout specs read from ADB.xx (xx is project file suffix) and
then from any step definitions file (given in the "-step" parm).
2. Full case-insensitivity
3. Lowercase=literals, uppercase=values. Curlies for optional items.
fld FIELDNAME FIELDLEN {PRECISION}
fld FIELDNAME like PREVIOUSLY_DEFINED_FIELD
[Fields ending in "_" are right-justified and presumed integer in the awk
interface (and unquoted for commas-and-quotes). These fields must be at
least 2 long. Fields ending in "__" are fixed-decimal (they're the only ones
for which a PRECISION can--and must--be coded). The PRECISION is the number
of digits after the decimal point (1-16). There must be at least 3 extra
bytes in the total length (1 digit before decimal, 1 for sign and one for
decimal). The precision is only relevant to the awk interface. These are
also also unquoted for commas-and-quotes). Fields ending in "___" aren't
right justified, but are treated as strings in the awk interface, and
unquoted in commas-and-quotes format (e.g. time, date, currency.)
fset [FIELDNAME | @FIELDSETNAME | -FIELDNAME] ... {end}
[This statement can span as many lines as necessary until an `End'.]
ADB Input and Output Layouts:
=============================
1. File layout specs read from ADB.xx (xx is project file suffix) and
then from any step definitions file (given in the "-step" parm).
2. Full case-insensitivity
3. *Below*: all-lowercase used for literals, all-uppercase for values.
4. Parenthesis are used for grouping
5. `|' means alternatives--must choose one
6. Curly braces are for optional arguments or constructs
7. Double quotes means a string in double quotes
mast FIELDSET SORT_FIELDSET (none | prep | sort | nodups) {awk} {cq} {end}
[Mast keylength <= trans key length; awk must maintain field structure.]
m-t FIELDSET {SORT_FIELDSET {nodups}} {awk} {cq} {end}
FIELDNAME ({m.|t.}FIELDNAME | "FIELDVAL") {"PADCHAR"} {end}
[awk files must be named: FILENAME.xxA where "xx" is the project file
suffix. If cq is specified the awk file must write out a result which
conforms to the fixed-length standard. Otherwise output can be anything.
End must terminate m-t, t-m, and m&t . . . it can be on a line by itself.]
(trans format is the same as mast; t-m and m&t are the same as m-t)
ADB Command Line (all arguments optional and case insensitive):
===============================================================
1. To specify a master file, code -mastMASTERFILENAME ("-mast" is a literal);
the file name must have no extension or end in project file suffix.
2. Same for "-trans", "-m-t", "-t-m", "m&t" & any step def'ns file.
3. Code "-P" to echo file layout specs to log file ADBLOG.xx
4. Code "-LAXPRE" to allow basic preprocessing to pad short recs with spaces.
5. Code "-OUTDFLT" to supply defaults for output fields not in mast or trans.
If field is in both mast and trans, defaults to master.
6. Code "-STEPfilename" if you have file layout definitions for this step.
These are read in after any global definitions file.
7. Code "-Q" to turn on "quiet mode". Log files is still good.
8. To validate definitions, code no parms. For help: "ADB ?"
Hints on writing DOS batch files:
1. Call WhatEver.Bat [<-- If no arguments, can use to set environ. variables]
Command /e:4096 /c WhatEver.Bat Arg1 Arg2 ... [<-- call batch file w/ args]
2. To keep lines from echoing, preceed with at-sign (`@').
3. If [Not] (%VARNAME%)==(VALUE) . . . [<-- tests value of a variable]
4. If [Not] Exist FileName . . . [<-- tests file [non]existence; wildcards OK]
5. If [Not] ErrorLevel 2 . . . [<-- tests for return code [<] >= 2]
6. Labels begin with colon in column 1; You can say: "Goto LABELNAME"
ADB Awk Interface:
==================
1. Use the `awk' operand on the input or output file layout to indicate that
you have an awk script. It must have the same name except with an
extension of ".xxA" (where xx is project file suffix).
2. For input files, awk script runs after any commas-n'-quotes convert,
basic preprocessing &/or sort+duplicate removal. I.e. last thing before
the actual comparision of input files (file structure must be retained).
3. For output files, awk script is last thing run before any commas-n'-quotes
convert (awk script may output anything iff no commas-n'-quotes convert.)
4. Your ADB_BOJ fnc. is run last in BEGIN block (after FIELDWIDTHS). Your
ADB_EOJ fnc. is only thing in END block. You needn't define either.
5. You *must* define the ADB_Main fnc, which is called after all fields have
been assigned for current record. Fieldnames = what you declare. Those
ending in "___" have trailing spaces stripped (same as those ending in
no underscores: both are strings). All other fields are floating point.
6. Your ADB_Main function calls ADB_WriteFnc() *iff* it wishes to write out
the current record. You may also call ADB_BldOutLineFnc(), which
returns the output line in the proper structure (without a newline).
7. ADBAWKLIB environ. var. is for your awk fncs that can be used everywhere.
It can also be used to "import" global data for the application.
*. Don't forget about the valuable "system" function provided by GNU Awk.
ADB Awk Interface, part 2:
===========================
ADB_Main() - You *must* supply this function. No record will be
outputted unless you call ADB_WriteFnc or use printf
to write out the current record. This function is
called once for each record.
ADB_BOJ() - You *may* supply this. Called before any rec.s read.
ADB_EOJ() - Same as above, but called at end of job.
ADB_WriteFnc() - Writes the current reocrd out. Call in ADB_Main.
ADB_BldOutLineFnc() - Assembles all fields in current record into a string,
with proper field offsets, etc.
ADB_ClrFldsFnc() - Sets numeric fields to 0, string fields to nothing.
ADB_ErrorFnc("Msg") - Call with an error message. At most 1 more record
will be read. ADB prints "Msg" into ADBErr_A.xx
(`xx' is the proj. file suffix, and treats as a
catastropic error. ADB's log/error files tell
the reader to look at ADBErr_A.xx.
ADB_DebugFnc("Msg") - Call with a debug message. This will be written
to ADBDbg_A.xx. This file will be erased at
the start of each ADB run, but *not* before each
Awk script is called.
ADB Environmental variables:
============================
ADBPROJ is the 2-char project file suffix (1st char must be letter,
2nd must be digit or letter. Underscore is considered letter.
ADBAWKLIB is optional filename for awk library (always included first)
ADBSTEPNAME, ADBJOBNAME, ADBPROJNAME optional: echoed into the log file.
Be sure to put the following in C:\Config.Sys to increase DOS env. size:
SHELL = C:\Command.Com /e:4096 /p
ADB File Names:
===============
1. All data file names must not begin with ADB and must have an extension of
the project file suffix. Awk files end in ".xxA" where xx is the
project file suffix (except anything may be used for the ADBAWKLIB
environmental variable. Step definitions file must end in ".xx" too.)
2. All temporary files end in "xx$" and begin with "$ADB".
3. All permanent files for a project are thus of the form *.xx and *.xxA.
4. To get permanent and temporary files (for zipping and sending to
diagnose bugs off-site), use *.xx*.
5. Log file is ADBLOG.xx, error file is ADBERR.xx (ADB won't run if the
error file exists.) ADB never erases the log file.
ADB Misc. Utilities [run each with no arguments for detailed help]:
===================================================================
1 BE2 - Supports option menus in DOS batch files.
2. DBCvt - Called by ADB to convert commas-n'-quotes --> fixed length.
3. DOSDate - Outputs "SET DOSDATE=YYMMDD" (useful for naming bkup files)
4. ErrMsg - Prints command line args, asks user to enter space, returns 1.
Alternatively writes to both standard error and std output.
5. Excel.Awk - Converts Excel flat files to commas-n'-quotes.
6. GetFld.Bat - Gets a field (by column size) from a text file.
7. GetVal - Helps port variable values between programming languages.
8. FDateCmp - Compares dates between one file, and a set of files.
9. FileBrk - Splits into evenly-sized chunks or reverse. Binary files OK.
10. FileMux - "Multiplexor" for ASC text files, i.e. divides rec.s up into
mutually exclusive + exhaustive sets based on field values.
11. FileStat - Sees if files exist (or don't exist - erases automatically),
&/or are readable/writeable/executable/of length 0.
12. OSQLRF? - OSQLRf1 & OSQLRf2 help process output of OSQL selects.
13. Repl - "Stitches" files &/or constants together.
14. RPSort - Robert Pirko's "replacement sort" for DOS text files.
15. Sleep - Sleeps for a given number of seconds.
16. StrRepl - Search and replace utility for multiple files.
17. View - Large file viewer utility with line/column indicators.
Return
to local table of contents
Return
to global table of contents
Frames mode, or
No frames