Checking the Integrity of a Bar Code

Allows, in the manual collection of fields present in a bar code,
for the application to validate as the fields are being
entered, in order to alert the operator in advance and allow
it corrects the error. The routine activation format is as follows:

int ValidaCampoCodigoEmBarras (Data, Type)

ASCII Interface

ValidaCampoCodigoEmBarrasA (Result, Data, Type)

ParameterTypeStandard interfaceASCII interfaceDescription
ResultOutput, by valueNot usedFixed 6Contains the result of the response to the routine call.
DataInput, by valuechar *VariableMessage to be displayed on the PinPad display.
TypeOutput, by referenceshort *Fixed 6Informs the type of document collected according to the following encoding:
-1 → Unable to set type yet
0 → Collection
1 → Title

Recommendation:

It is recommended that the terminal application, once identified that the
document will be typed, open simulated collection fields for those present
in the documents to be paid. To do this, it will need to identify whether it is
a Compensation Sheet/Title/Block or
Collection/Taxes. This identification can be done through a
ask the operator or through the routine described here.

If the user opts for automatic recognition he must open a
field as if it were a Collection field and, with each digit provided by the
operator, pass the digits already supplied to the routine. That
procedure must be done until the routine returns if the
document in question is a Title or Collection. At that moment the
application no longer needs to call the routine for each digit provided and
If necessary, modify the formatting of the capture fields.

In addition to identifying the type of document, the routine ensures consistency
of check digits, returning to the application if there is an error and
where it is located. The application can call the routine by passing the
fields as they are being collected or at the end of collection,
where a global analysis of the entered content will be carried out. If the call
is during typing, the correct points are:

- Collection: each of the 4 typing blocks

- Titles: each group of two typing blocks

Upon return, the routine returns 0 if everything is correct so far, -1
if it is an unrecognized barcode or a number from 1 to 4
indicating which field is incorrect or even the value 5 to indicate
that the number as a whole is not correct.

Below we exemplify how the terminal application should proceed,
in the most generic way possible nowadays, to collect a document.
In the example we will use a title and let the automation be informed
which is this type of document. The document that will be used is the
Following:

23790.09505.91211.369656.04025.039209.1.17690000005625



Field opened by automation


2



After typing the first number, call the routine passing "2" as
parameter. Upon return, the routine returned the result 0 and Type = 0
(fictitious because at this moment, for the current configuration of codes in
bar, she would have already made the identification)


23



After typing the first number, call the routine passing "23" as
parameter. Upon return, the routine returned the result 0 and Type = 1


23790 09505



The automation re-presents the fields already knowing that it is a title. Only
After typing the first group of numbers, it calls the routine
passing "2379009505" as a parameter. Upon return, the routine continues
return Type = 1. The result may be 0, indicating that the block
is correct or 1 indicating that it is wrong.


23790 09505 91211 369656



The automation continues to collect the digits and only after typing the
second group of numbers she calls the routine passing
"237900950591211369656" as parameter. Upon return, the routine continues
to return Type = 1. The result may be 0, indicating that the
blocks are correct or 1 or 2 indicating that the first or second
block is wrong.


23790 09505 91211 369656 04025 039209 1 17690000005625



The automation continues to collect the digits by calling the routine at the end of the
third block with the data 237900950591211369656 and at the end of the
fourth block with all the entered data. Upon return, the routine continues
to return Type = 1 and the result will reflect the error situation or not
of the blocks passed as a parameter. In particular, if you return the code
5 is because there is one of the blocks (it is not possible to identify which
them) with error.

Finally, automation can also, for the purpose of consistency,
bar code choose to check them only at the end of typing
all fields. In this case, the routine will return 1, 2, 3 or 4 in that order
priority if it finds one or more blocks with an error and 5 in the situation
of the internal blocks are right, but the number as a whole has
some error.