Generating bar code fields

What is the Database Utility?

The Database Utility (JITDBC.EXE) is a console application which runs under the MS-DOS shell. The program can be run from;

    - a batch file
    - the MS-DOS command line prompt in Windows
    - any application that can use the MS-DOS shell

If you wish, it is also possible to create a Windows icon to run the Database Utility with a set of fixed arguments.

What does the Database Utility do?

The Database Utility can read from an ASCII text files containing comma separated data fields. This type of file usually has a file type extension of; TXT, CSV or ASC. 

Suitable ASCII text files can be created by many applications (e.g. database, spreadsheet, text editor, etc.), but typically they are created by exporting records from some sort of database.

As the Database Utility reads each record from the ASCII text file, it outputs each record to a separate ASCII text file. For each record that is output, two additional fields (BARCODE and  HUMAN can be automatically generated and added to each record.

What does the ASCII text file look like?

Here is an example of the contents of a suitable ASCII file, that can be used with the Database Utility. This example ASCII file contains 2 records (one on each line) and each record contains 2 fields (each field separated by a comma);

"Mr Savage", "501472110"
"Colin Smith", "912377182"

If you wish, the file can include field names on the first line, so the example would look like this;

CLIENT_NAME, CLIENT_NUMBER
"Mr Savage", "501472110"
"Colin Smith", "912377182"

What does the generated ASCII file look like?

The output ASCII text file can be given any file name, but usually it is given a file type extension of; TXT, CSV or ASC. Here is an example of the contents of the output file created from the above example input file;

"Mr Savage", "501472110", "(RuQtClWdJj)"
"Colin Smith", "912377182", "(MjOcApWgMg)"

If the input file contains field names, then the output file will also contain the same field names and also the field names; BARCODE and HUMAN (if these fields are generated).

CLIENT_NAME, CLIENT_NUMBER, BARCODE
"Mr Savage", "501472110", "(RuQtClWdJj)"
"Colin Smith", "912377182", "(MjOcApWgMg)"

Note: The added BARCODE and HUMAN fields are in fact ordinary text fields. The BARCODE is only physically printed as a bar code when you print the field using a special bar code font. 

Running the Database Utility. Command line arguments.

The Database Utility has the following command line arguments, which are explained below;

JITDBC.EXE [-i] [-o] [-b] [-n|-f] [-s] [[-m|-g] [-a]] 

EXAMPLE:

JITDBC.EXE -i"IN.TXT" -o"OUT.TXT" -b"ITF-0.BA" -f"CLIENT NO" -s

Each argument is described below;

-i<Filename>
This argument is the name of the input ASCII text file (i.e. the file to be read). This file contains the data to process in order to create the output file.
-o<Filename>
This argument is the name of the output ASCII text file (i.e. the file to be created). This file will contain the original unaltered data and also generated fields.
-b<Barcode type>
This argument selects a type of bar code and affects what type of bar code (if any) is generated in the BARCODE field, and also affects what human-readable text (if any) is generated in the HUMAN field. See the following sections for details;

Specifying a bar code type

Printing human-readable characters

Bar code options / formats

Bar code check characters

-n<Field number>

If your file contains field names see the -f argument. The -n argument specifies the index position of the field within the record (1 is the first field) to be used as the data source, to generate the BARCODE or HUMAN field.

-f<Field name>

If your input ASCII text file does not contain field names, see the -n argument. The -f argument specifies the name of the field to be used as the data source, to generate the BARCODE or HUMAN field. If the field name contains a space, the field name should be put in quote. If -f or -g is used -s1 is assumed.

-s<Skip field names>

Use -s or -s1 if first line of input ASCII text file contains field names. Use -s0 if the input ASCII text file does not contain field names. If -s is not used -s0 is the default. If -f or -g is used -s1 is assumed.

-m<Field number>

If your input ASCII text file contains field names, see the -g argument. The generated BARCODE and HUMAN fields can be inserted after any field in the output ASCII text file. The -m argument specifies the index position of the field within the record (1 is the first field) that the generated fields will be inserted after. To insert generated fields before a specific field see the -a argument.

-g<Field name>

If your input ASCII text file does not contain field names see the -m argument. The generated BARCODE and HUMAN fields can be inserted after any field in the output ASCII text file. The -g argument specifies the name of the field that the generated fields will be inserted after. To insert generated fields before a specific field see the -a argument. If -f or -g is used -s1 is assumed.

-a<After>

By default the -m and -g arguments insert generated fields after the specified field (which is the same as specifying -a or a1.  Use -a0 to insert generated fields before the specified.

Command line examples

When you execute the following command, JITDBC.EXE will read records in ASCII text file IN.TXT. Each record will be written to ASCII text file OUT.TXT. As each record is written, field number 2 is used to create an additional bar code field which contains an Interleaved 2 of 5 bar code with check character. 

JITDBC.EXE -i"IN.TXT" -o"OUT.TXT" -b"ITF-0.BA" -n2 -s0

The following command is the same, except a bar code and human-readable field are generated. The human-readable field is useful because Interleaved 2 of 5 has an optional check character and the human-readable will contain the check digit.

JITDBC.EXE -i"IN.TXT" -o"OUT.TXT" -b"ITF-0.BHA" -n2 -s0

The following command is the same, but Code 128 bar code and human-readable field are generated using field "CLIENT_NUMBER" as the data source. Because the Code 128 check character is mandatory, the bar code will contain the check character, but because the check character is never printed in the human-readable text, the human-readable field will not contain the check character.

JITDBC.EXE -i"IN.TXT" -o"OUT.TXT" -b"C128-0.BHA" -f"CLIENT_NUMBER"

How do I print bar codes?

How do I use the output file?

How do I print the BARCODE field?

Once the output file has been created, you can import the file in to your application and print bar codes simply by printing the BARCODE field using one of the installed TrueType bar code font. 

For each type of bar code there is one or more specific fonts you can use to print the bar codes of that type.

See section Bar code font name and font size to use for full details.

How do I print the human-readable text?

Human-readable text is text printed using any regular font, that everyone can read (e.g. Arial, Times, Courier, etc.). This text is usually printed below the bar code and the text is usually the same data characters which were in the original input field.

Printing human-readable text can often be achieved simply by printing the original data field, using any regular text font.

Some of the bar code fonts automatically print the human-readable text characters below the bar code, so printing the bar code also prints the human-readable text.

If the bar code type you are using does not have a check character, or the standard for that bar code type states that the check character is never printed in the human-readable text, then the human-readable text will be the same as the text in the original field, so you can simply print the original field.

Do I need to use the HUMAN field?

If you generate the HUMAN field, it will contain the complete human-readable text you can print anywhere (e.g. below or above your bar code, or not at all).

If the bar code standard states that check characters should be printed in the human-readable text, then the generated HUMAN field will contain the check character.

If you see the generated HUMAN field simply contains a copy of the original field, this may be correct, because of this rule; 

Rule: If the bar code standard states that check characters should not be printed in the human-readable text, then the generated HUMAN field will not contain the check character. 

When the generated the HUMAN field is the same as the original field, there is no practical reason to generate the HUMAN field, because the original field is also in the output file.

Can I utilise the Database Utility in other applications?

Many Windows applications allow you to run other applications in a shell, so these applications are able to run the Database Utility.

 


Copyright 2000 CIA (BAR CODES) UK. All rights reserved. Reproduction prohibited.