Zur Homepage www.HI-Tier.de Sources LomCoder
Home Nach oben Weiter
Öffentlicher Bereich für Entwickler


Hinweis: Diese Seite gibt es auch auf deutsch.


bullet lomcoder3.zip [latest version: 28-Apr-2015]

for Change history see end of page


These are the elementary classes. The LomCoder2 provide the generic methods for processing eartags, no matter to which country they belong to. That class calls itself the country specific classes (see below) automatically.

The recognition and conversion returns a result which is stored in an object of the class LomNumber - assumed that no error has been yielded. Details about the error code can be obtained by the class LomCoderErrors.



For each of the 27 countries a class exists that implements the uniform functions calls on the functionality of the eartag numbers. The abbreviation after the Lom_ is equivalent to the ISO standard.

Lom_DY is a particular case: this are eartags which can't be stored in HIT, so numbers in the "dummy" format were used then. Within HIT there's a translation table between these numbers and the "real" ones.

Note: before May 2004 greek eartag numbers were erroneous marked as GR, but they have the abbreviation EL according to the ISO standard. Therefore the class has been renamed, but the functionality remain unchanged.



LomEU is the base class of all the country classes above. It contains standardized methods which do preprocessing tasks (like nomalizing eartag strings etc) supporting the country classes. The LomCountryInterface defines the methods every country class has to implement.

The classes HitHelpers, HitSimpleDTS and HitException are subroutine classes that are used within HIT and were partially used from the eartag processors.

[20040902] At the end of August 2004 HitDate has been dissolved and refactorized into other classes, mainly  HitSimpleDTS, including a few methods from HitHelpers.

[20100811] LomDate has been created for converting Java into other programming languages. For example .NET does not have an object type for dates and therefore no exact replacement for java.util.Date. This is being simulated with LomDate.

LomSchafeZiegen and LomSchweine are classes to verify (german only) earmarks for sheeps/goats and swines (in that order).


The package HitLom contains two programs and a helper object.

The program LomsToCSV expects a text file containing earmarks and returns (depending on parameters) a CSV (comma separated values) file with the converted earmarks or bad earmarks including error messages respectively. Can be used in batch jobs for serial converting.

The LomObject just simplifies the usage of eartags, e.g. to allow manipulations via compiled COM or Dot.NET objects in Office products. The program Demo_LomObject is a demonstration example in Java (easily transferable into other programming languages) how to use that simple object.



Following example is valid for Java and similar OO programming languages.

To check an eartag the method sintEncodeLom() of LomCoder2 is called. Since we expect two return values (numeric eartag and error code), but only can retrieve one, LomNumber supports the retrieval of the checked and coded eartag.

So an object of LomNumber is instantiated first:

LomNumber objLom = new LomNumber();

After that we call the generic class LomCoder2 by its static method sintEncodeLom() which expects two or three parameters respectively (eartag as String, the LomNumber object and finally if necessary the Date for checking the eartag at this date):

String strLom = "DE0196442853";
int intError = LomCoder2.sintEncodeLom(strLom,objLom);

After the call we get an error number and the object objLom now may contain the encoded (numeric) eartag. For error tracking one has to use the class LomCoderErrors: using the method sintGetFehlerSchwere() it does return a 'more general' error code which is equivalent to the Schwere (=weight) of the HIT system (means 0=Ok, 1=Note, 2=Request, 3=Error, 4=Panic). If the error weight is 0 or 1, then objLom contains the encoded eartag (in numeric form). With error weights larger than 1 nothing has been encoded and the (unfortunately german) error message can be retrieved by the method sstrGetError().

int intErrWeight = LomCoderErrors.sintGetFehlerSchwere(intError);

if (intErrWeight > 1)  {
   String strErrMsg = LomCoderErrors.sstrGetError(intError);
   System.err.println("Error at eartag "+strLom+": "+strErrMsg);
else  {
   System.out.println(strLom+" = "+objLom.getLom())

To print out the eartag in formatted form, one has to use the method sstrToFormattedString() of the class LomCoder2:

String strFormatted = LomCoder2.sstrToFormattedString(objLom);

With this call the above eartag example will be printed as DE 01 964 42853 then.

If you want the 15 digit numerical form of an EU eartag, you can get it via getLom() of objLom (assuming that no error appeared):

String strNumerisch = objLom.getLom();


Simple usage for external calls

To simplify the usage for own purposes (e.g. after a conversion into a COM or Dot.NET object) there is a class called LomObject. This class combines the procedure described above and provides simple calls:

LomObject objLomcoder = new LomObject();
String strFormatted = objLomcoder.encodeLom(strLom);
if (objLomcoder.wasError())   {
   System.err.println("Error: "+objLomcoder.getError());
else  {

First the eartag will be converted by encodeLom() (for formatted output) or decodeLom() (for numeric output), then wasError() checks, if an error occured on the latest conversion. If so, the (german) error message can be retrieved by getError(); otherwise the encodeLom() or decodeLom() call respectively returned the eartag number.

It is possible to call getError() without calling wasError() before: if the eartag could be converted correctly, it returns an empty string. You also can ignore the error handling (not recommended), because in case of an error, the methods encodeLom() or decodeLom() return an empty string then.



The Zip archive above only contain the sources of the eartag coding. If you intend to use them precompiled, please download the applet archive. This one you can call in own application as decribed in the sections Usage or Simple usage for external calls above.

Starting with May 1st, 2004 10 new countries (EU eastern enlargement) were added (unfortunately we do not have the coding schemes for all new countries, so a 15 digit eartag number is required to be accepted). For more detailed schemes see Alpha-Lom-Codierungen (in german).

Starting with January 1st, 2007 two new countries (BG und RO) were added.

On July 1st, 2013 Croatia (HR) joined the EU.



10-Jul-2013 Updated lomcoder3.zip, HR has been added.
07-Feb-2013 Updated lomcoder3.zip, RO has been modified (new property codes), added swine and sheep/goat earmark numbers.
01-Aug-2010 Updated lomcoder3.zip, CH has been added.
22-Sep-2009 Updated lomcoder3.zip, since FI eartags had an error in checksum validation.
12-Feb-2007 Updated lomcoder3.zip, since BG and RO have been added.
02-Sep-2004 Updated lomcoder3.zip, because some methods and classes in HitUpros were refactorized.
02-Sep-2004 Added english documentation.


© 1999-2015 Bay.StMELF, Verantwortlich für die Durchführung sind die Stellen der Länder, Fachfragen ZDB: Frau Dr. Kaja Kokott, Technik: Herr Helmut Hartmann
Seite zuletzt bearbeitet: 26. März 2015 14:08, Anbieterinformation siehe hier im Impressum.