DC305 command syntax
Definition
Section titled “Definition”DairyComp 305 (DC305) is driven by one-line text commands. Every command has the same general shape:
VERB[\switches] [items] [FOR conditions] [BY item | DOWNBY item] [\switches]- Verb: what to do (list, summarize, count, chart).
- Items: the fields to show, such as
ID PEN DIM. See item codes. - FOR clause: which animals (or events) to include.
- BY / DOWNBY: grouping or sort order.
- Switches: options after a backslash that change the layout or content.
The VAS and Select Sires examples write switches straight after the verb
(BREDSUM\E FOR LACT>0, ECON\ID750) and also at the end
(EVENTS MAST:10 FOR LACT>0\5), and put BY either before or after FOR
(BREDSUM BY LCTGP FOR LACT>0, PCT DCC>0 FOR LACT>0 BY PEN). This KB writes
switches after the verb with no space.
| Verb | What it does | Example |
|---|---|---|
LIST / SHOW |
One row per animal with the listed items | LIST ID PEN DIM MILK FOR LACT>0 |
SUM |
Counts and averages of numeric items (up to 7 items), overall or by group | SUM MILK DIM BY PEN FOR LACT>0 |
COUNT |
Number of animals matching the conditions | COUNT FOR RC=4 LACT>0 |
PCT |
Percent of the animals in the FOR group that meet the first conditions |
PCT DCC>0 FOR LACT>0 |
EVENTS |
Event lists and tables; see events | EVENTS\2SI |
BREDSUM |
Breeding and conception summary; see BREDSUM | BREDSUM\E FOR LACT>0 |
GRAPH |
One item = histogram; item BY item = scatter |
GRAPH MILK BY DIM FOR LACT>0 |
PLOT |
Test-day items over DIM (or test date with \R) |
PLOT MILK FOR LACT>0 |
EGRAPH |
Events by calendar date, DIM (cows) or AGE (heifers) | EGRAPH BRED\SN1 |
ECON |
Economic and inventory reports; see inventory reports | ECON\I |
FILEOUT |
Write items to a CSV or TXT file; see exports | FILEOUT\CH ID LACT DIM FOR LACT>0 |
SETDAY |
Change the “today” that dates and DIM are computed from | SETDAY\T |
Other verbs include MONITOR (monthly herd statistics: \3 calculate,
\4 display, \S save, \R restore), COWVAL (cow value relative to an
average fresh heifer, plus pregnancy value), EPLOT (body score, height,
weight) and ALTER (set-up: ALTER\2 item definitions, ALTER\9 event
settings).
FOR clause operators
Section titled “FOR clause operators”| Form | Meaning | Example |
|---|---|---|
item=value |
equals | RC=5 |
item>value |
greater than | LACT>1 |
item>=value |
greater than or equal | DIM>=60 |
item<value |
less than | DIM<60 |
item<=value |
less than or equal | DIM<=150 |
item<>value |
not equal | RC<>1 |
item=low-high |
in the range, inclusive | PEN=1-9 |
item=high-low |
reversed range: everything except that range | PEN=9-1 (all pens except 1–9) |
item=a;b;c |
any of these values (OR) | PEN=1;2;4;8 |
(cond)(cond) |
either set of criteria (OR) | (PEN=1)(PEN=4) |
- Several conditions separated by spaces must all be true (AND):
FOR LACT>0 RC=3 DIM>100. - A reversed range is the standard way to say “not in”:
RC=3-2keeps every RC except 2 and 3. - In
PLOT,WITHacts as a secondFORclause, giving two lines on one chart:PLOT MILK FOR LACT=1 SCC1<200 WITH LACT=1 SCC1>=200.
Date items (FDAT, BDAT, CDAT, DDAT, EDAY …) accept two forms:
- Relative dates: a negative number is days before today.
FDAT>-30means “fresh within the last 30 days”;EDAY>-7means “events in the last week”. - Absolute dates: a calendar date or a date range, e.g.
FDAT=1/1/26-3/31/26.
A day-count item gives the same filter another way: FOR DIM<30 and
FOR FDAT>-30 both pick cows fresh in the last 30 days (they differ only at
the boundary day).
“Today” is the computer’s date unless it is moved with SETDAY:
SETDAY\* (back to today), SETDAY\T (most recent test day), SETDAY\E
(last event entry date), SETDAY\mm/dd/yy (a given date) or SETDAY\n
(n days ahead or behind). DIM, DCC, relative dates and the 21-day table all
follow the set day.
BY and DOWNBY
Section titled “BY and DOWNBY”- In
SUM,COUNT,PCTandBREDSUM,BY itemgroups: one row per value of the item (SUM MILK BY PEN,BREDSUM BY LCTGP FOR LACT>0). - In
LIST,BY itemsorts ascending;DOWNBY itemsorts descending (LIST ID MILK FOR LACT>0 DOWNBY MILK). - In
GRAPH,item BY itemmakes a scatter plot.
Switches
Section titled “Switches”Switches go after a backslash, letters and digits right after it, e.g.
BREDSUM\E, EVENTS\2. They change the table or layout of a specific
command, so the same letter means different things in different commands
(\E in BREDSUM is the 21-day table; \E in LIST ejects a page per group).
Live vs dead animals. LIST/SHOW, COUNT/PCT/SUM, EVENTS,
GRAPH and EXAM cover live animals only by default. Add:
\Bfor both live and dead (sold or died) animals,\Dfor dead animals only (those that have left the herd).
\L on EVENTS, BREDSUM, GRAPH and PLOT reads the archive files
(closed lactations).
Common LIST switches: \2 double space, \A averages per sort group,
\C compressed, \E eject per group, \Ln limit n per group, \N sequence
number, \P/\Pn columns, \Q summary only, \T totals, \U underline,
\V events under each cow (\Vn last n), \Z include zeroes.
COUNT/PCT/SUM switches: \I lists the individual animals with the
summary; \Z includes zeroes in averages; SUM\Qn splits into quartiles or
other n-tiles (\Q3, \Q4, \Q5).
Saved commands
Section titled “Saved commands”Herds save their own commands under short names (for example a daily fresh
cow list or a to-breed list), and DC305 expands the name when it is typed.
Saved command names, and the user-defined items they use, vary by herd.
Never assume another herd’s names; check the herd’s private dc305-vocab
mapping.
Special values
Section titled “Special values”- 0 means unset for numeric items: a cow that was never scored or tested
holds 0, not a blank.
COUNT,PCTandSUMexclude zeroes from averages by default;\Zputs them back in. Outside DC305 (exports), the zeroes are in the data and must be filtered out. - DOW (day of week) runs 1 = Saturday through 7 = Friday, not Sunday or Monday first.
How to pull it in DC305
Section titled “How to pull it in DC305”Patterns that combine the parts above:
LIST ID PEN LACT DIM RC FOR LACT>0 RC=3 DIM>100 BY PEN open cows past 100 DIM, by penLIST ID PEN MILK FOR LACT>0 DIM=0-30 DOWNBY MILK fresh cows, highest milk firstSUM MILK DIM FOR LACT>0 RC<>6 BY LACT lactating averages by lactationSUM SCC=200 PSCC=200 FOR SCC>0 PSCC>0 2×2 table: this test vs last test SCCCOUNT FOR LACT>0 PEN=9-6 adult cows outside pens 6–9COUNT FOR LACT>0 PEN=1;2;4;8 adult cows in pens 1, 2, 4 or 8COUNT\B FOR LACT>0 FDAT>-365 cows fresh in the last year, incl. sold/diedPCT DCC>0 FOR LACT>0 BY PEN % pregnant, by penPCT DOPN<150 DCC>0 FOR LACT>0 % conceived before 150 DIMLIST ID FDAT DIM FOR FDAT>-14 fresh in the last 14 daysEVENTS FRESH ID LACT FOR EDAY=1/1/26-1/31/26 calvings in JanuaryBREDSUM\E FOR LACT>0 21-day pregnancy risk table, cowsPLOT MILK FOR LACT=1 SCC1<200 WITH LACT=1 SCC1>=200 1st-lact milk, first-test SCC <200 vs >=200GRAPH MILK BY DIM FOR LACT>0 milk vs DIM scatterBefore running any command on a new herd:
- Look up the herd’s item, event and saved-command names in its private
dc305-vocabmapping. - Confirm switch letters with the command help on that install.
- Check the row count against an independent count (e.g.
COUNTwith the same FOR clause), and decide whether animals that left the herd belong in it (\B).
Typical range
Section titled “Typical range”Herd context: any DC305 herd; item names, saved commands, switches and limits vary by herd setup and DC305 version.
- Command length: DC305 limits a command line after saved names and abbreviations are expanded, at roughly 230–240 characters. A short saved command can expand past the limit.
- SUM: averages up to 7 items per command.
- Item names: usually up to about five characters.
- DOW values: 1–7 (1 = Saturday).
- Unset numeric items: 0.
Common mistakes
Section titled “Common mistakes”- Writing a range backwards by accident.
DIM=150-60means “except 60–150”, not “60 to 150”. The command runs and returns the wrong cows. - Forgetting animals that left. Most commands cover live animals only.
Counting past calvings, deaths or sales needs
\B(live and dead) or\D(dead only). - Averaging zeroes by mistake.
\Zon SUM, or averaging exported data yourself, counts never-tested cows as 0 and drags averages down. - Treating
BYthe same in every verb. It groups inSUM/COUNT/PCT, sorts inLISTand makes a scatter inGRAPH. - Using
PLOTfor non-test-day items. PLOT charts test-day items; useGRAPHfor other items. - Reading current items as past values. In
EVENTS, item columns such asPENshow today’s value, not the value on the event date. - Leaving
SETDAYmoved. Every DIM and relative date shifts until it is reset withSETDAY\*. - Assuming DOW 1 is Sunday or Monday. In DC305 it is Saturday.
- Copying saved commands or user items between herds. Names and definitions differ by herd.
- Using a switch letter from another command.
\Ein BREDSUM is not\Ein LIST. - Hitting the length limit. A long command can fail after expansion even though the typed text looks short. Split it, or save parts as items.
