BARCODE (Bar Code) keyword in printer files

You use this field-level keyword to print a field as a user-specified bar code. The BARCODE keyword is valid only for Intelligent Printer Data Stream (IPDS) printers and only for printer files with device type *IPDS or *AFPDS specified.

The format of the keyword is:
BARCODE(bar-code-ID [height] [[*HRZ | *VRT]
        [*HRI | *HRITOP | *NOHRI] [*AST | *NOAST]
        [modifier] [unit-width]
        [wide/narrow-ratio]
        [PDF417 data]
        [Data Matrix data]
        [Maxicode data]])

The bar-code-ID parameter is required. You can specify the bar-code-ID parameter as a special alphanumeric value up to 10 characters long, or as a numeric ID. Valid special values for the bar-code ID are listed in Table 1. If you specify a numeric value for the bar-code ID, then you also must specify the bar-code modifier parameter. See the documentation for your printer for the bar-code IDs and modifiers that it supports.

The height parameter is optional, but if you specify it, it must be the second parameter following the keyword. You can specify the height in one of two ways:
  • Specify the height in number of print lines. Valid values for the bar-code height are 1 through 9 lines.
  • Specify the height in inches or centimeters. When you specify the height in this way, the valid format is (height *UOM). Valid values are 0.25 to 25.40 cm (0.10 to 10.00 inches). For PDF417 bar-code type, valid values are 0.02 to 25.40 cm (0.01 to 10.00 inches). The UOM parameter on the Create Printer File (CRTPRTF) command determines the unit of measure for the height.

The value you specify for the bar-code height does not include the human readable interpretation below the bar code. If you do not specify the height parameter, the printer uses a default height.

You can specify the last 9 parameters (all optional) in any order. Using these parameters, you can specify that BARCODE:

Note: The overall barcode width is dependent on:
  • Ratio or width parameter in user DDS.
  • Actual customer data in the barcode.
  • Limitations of printer hardware, such as PEL density, pins and so on.

The width and ratio parameters are ignored for the 4234 and 4224 printer models.

For more information about the 4224 printer models, see the 4224 Printer Models 1xx and 2xx Product and Programming Descriptions, GC31-2551.

If you specify an optional parameter that does not apply to the bar-code ID you have specified, the printer ignores the optional parameter.

If you attempt to print a bar code on a printer that does not support bar codes, the digits in the code are treated as text, and a diagnostic message results in stating that the bar code might not print.

The line and position you specify for the field is used as the upper left corner of the bar code. Because the line specified in the DDS is the base line (the imaginary line on which characters are printed) and this is used as the upper edge of the bar code, the bar code appears to extend down from the bottom of the line you specify.

The following table describes valid data types, field lengths, and the numeric IDs for the BARCODE field.

Table 1. Valid bar-code definitions
Bar Code ID Data type Field length Numeric ID
MSI S 1 through 31 2
UPCA S 11 3
UPCE S 10 5
UPC2 S 2 6
UPC5 S 5 7
EAN8 S 7 8
EAN13 S 12 9
EAN2 S 2 22
EAN5 S 5 23
CODEABAR A 1 through 50 13
CODE128 A 1 through 50 17
CODE3OF9 A 1 through 50 1
INTERL2OF5 S 1 through 31 12
INDUST2OF5 S 1 through 31 10
MATRIX2OF5 S 1 through 31 11
POSTNET S 1 through 31 24
POSTNET (PLANET) 5 S 1 through 31 24
RM4SCC A 1 through 50 26
AP4SCC A 8 through 39 31
DUTCHKIX A 1 through 50 26
JPBC A 7 through 50 27
PDF417 A 1 through 1850 30
MAXICODE A 1 through 138 29
DATAMATRIX A 1 through 3116 28

The following table describes the supported bar codes.

Table 2. Bar codes supported by DDS
BARCODE Digits per code Range of characters allowed Default bar code modifier generated Default bar code modifier printed Valid bar code modifier
MSI (changed Plessey) 311 0 through 9 2 Modulus 10 No 01 through 09
UPC-A 11 0 through 9 1 No 00
UPC-E 10 0 through 9 1 No 00
UPC-2 digit add on (must follow a UPC A or E bar code) 2 0 through 9 No No 00
UPC-5 digit add on (must follow a UPC A or E bar code) 5 0 through 9 No No 00
EAN-8 7 0 through 9 1 Yes 00
EAN-13 12 0 through 9 1 Yes 00
EAN-2 digit add on (must follow an EAN 8 or 13 bar code) 2 0 through 9 No No 00
EAN-5 digit add on (must follow an EAN 8 or 13 bar code) 5 0 through 9 No No 00
INDUST2OF5 or industrial 2 of 5 31 0 through 9 1 Yes 01 02
MATRIX2OF5 or matrix 2 of 5 31 0 through 9 1 Yes 01 02
INTERL2OF5 or interleaved 2 of 5 31 0 through 9 1 Yes 01 02
CODEABAR Up to 50 characters

0 through 9,
A through D
(begin/end only),
-, ., $, /, +, and :

1 Yes 01 02
CODE128 Up to 50 characters Refer to CODE128 character set in DDS 1 No 012 02
CODE3OF9 or code 3 of 9 Up to 50 characters

0 through 9,
A through Z
(upper case only),
-, ., $, /, +, %,
and a blank

No No 01 02
POSTNET Up to 31 characters 0 through 9 1 Yes Ignored
POSTNET (PLANET)5 Up to 31 characters 0 through 9 1 Yes 04
RM4SCC Up to 50 characters

0 through 9
A through Z

1 Yes 00
AP4SCC 13 through 39

0 through 9
A through Z
a through z
space, #

1 Yes 01 through 08
DUTCHKIX Up to 50 characters

0 through 9
A through Z
a through z

1 Yes 01
JPBC Up to 50 characters 0 through 9, A through Z, and - 1 Yes 00 013
PDF417 Up to 1850 characters 4 Any one-byte character No No 00 01
MAXICODE Up to 138 characters 4 Any one-byte character No No 00
DATAMATRIX Up to 3116 characters 4 Any one-byte character No No 00
Notes:
  1. The 4234 Printer only supports 14 digits.
  2. The value 01 for the bar code modifier is not valid for some printers.
  3. The value 01 provides migration support for application programs that use an AFP font to print Japan Postal Bar Codes. Data written into the field must be valid characters in the AFP font. The application program must also write the start, stop, and bar code modifier characters.
  4. For PDF417, up to 1850 text characters, or 1108 bytes of binary data, per symbol, depending on the security level; refer to the symbology specification. For Maxicode, up to 93 alphanumeric characters per symbol, depending on the encoding overhead, or up to 138 numeric characters per symbol; refer to the symbology specification. For Data Matrix, up to 3116, depending on whether the data is character or numeric; refer to the symbology specification.
  5. The PLANET bar code is selected by specifying the POSTNET bar-code-id and a bar code modifier of 04.

CODEABAR field data must begin with an A, B, C, or D and must end with an A, B, C, or D. For example, A11224455C or D33447799D.

Do not specify BARCODE in the same field with the CHRSIZ, CHRID, CVTDTA, DATE, EDTCDE, EDTWRD, FONT, HIGHLIGHT, PAGNBR, TIME, or UNDERLINE keywords.

See the CVTDTA keyword for information about coding IPDS bar code commands.

If you specify CHRSIZ at the record level, it applies to all fields in that record. If you specify BARCODE in one of those fields, the BARCODE keyword is not allowed.

You cannot specify BARCODE on the same record format with BLKFOLD, CPI, or DFNCHR.

When you specify BARCODE on a numeric field, the number of decimal positions must be zero.

When you specify BARCODE on a constant field, the only valid bar code IDs are CODEABAR, CODE128, and CODE3OF9, and you must also specify the DFT keyword either implicitly or explicitly.

You should specify DEVTYPE (*IPDS) or DEVTYPE(*AFPDS) on the CRTPRTF command when BARCODE is specified in the file.

BARCODE is allowed only on data types S and A (see Table 2 for restrictions).

Option indicators are not valid for this keyword.

Japan Postal Bar Codes (bar-code-ID = JPBC) uses only the bar-code-ID parameter, the bar code print orientation parameter ([*HRZ | *VRT]), and the bar code modifier parameter. All other parameters have predetermined values, so any input for them is ignored.

User-specified bar code modifiers are not checked for their validity, and might cause bar code errors if they are not valid. The Intelligent Printer Data Stream Reference manual contains more information about bar codes and valid bar code modifiers.

Specifying two-dimensional barcodes

You can specify additional parameters for the two-dimensional barcodes PDF417, Maxicode, and Data Matrix.

PDF417: The additional data is specified as an expression of the form:
(*PDF417 row-size number-rows security 
         [escape-indicator] [*MACRO(&data-field-name)])
row-size
This required parameter for PDF417 barcode specifies the number of data symbol characters per row. Valid values are in the range of 1 through 30.
number-rows
This required parameter for PDF417 barcode specifies the number of rows. Valid values are in the range of 3 through 90. You can specify a special value of *MIN (minimum) to instruct the printer to generate the minimum number of rows that are necessary.
security
This required parameter for PDF417 barcode specifies the security level. Valid values are in the range of 0 through 8. Each higher security level causes more error correction code words to be added to the symbol. At a particular security level, a number of code words can be missing or erased, and the symbol can still be recovered.
escape-indicator
This optional parameter for PDF417 barcode specifies whether the backslash character within the barcode data is treated as an escape character according to the PDF417 symbology specification. Escape characters (started with backslash) allow reader programming to be specified within the barcode data. Valid values for the escape-indicator are:
  • *NOESCAPE indicates that each backslash character found in the barcode data is treated as a normal data character and therefore all escape sequences are ignored. Specify *NOESCAPE if the barcode data is an image or binary data. *NOESCAPE is the default value if no escape indicator is specified.
  • *ESCAPE indicates that each backslash character found in the barcode data is treated as an escape character according to the PDF417 symbology specification.
*MACRO(&data-field-name)
This optional parameter allows PDF417 Control Block coding to be specified (as defined in section G.2 of the Uniform Symbology Specification PDF417). The macro-data must be specified as a program-to-system field. The field must exist in the same record format as the BARCODE keyword. The length of the macro data is limited by the rules for a record format; that is, the maximum combined length of all named fields and indicators in a record format is 32 767 bytes. The data type must be A (character), and usage P (program-to-system).
Maxicode: The additional data is specified as an expression of the form:
(*MAXICODE symbol-mode [zipper-indicator] [sequence-data])
symbol-mode
This required parameter for Maxicode barcode specifies the symbol-mode for the MaxiCode barcode. Valid values are in the range of 2 through 6:
  • 2 – Structured Carrier Message, numeric postal code
  • 3 – Structured Carrier Message, alphanumeric postal code
  • 4 – Standard code
  • 5 – Full ECC symbol
  • 6 – Reader program, SEC. No data is transmitted.
zipper-indicator
This optional parameter for Maxicode barcode specifies whether to print a zipper pattern and contrast block. The valid values for the zipper-indicator are:
  • *NOZIPPER indicates that a zipper pattern is not to be printed with the barcode. *NOZIPPER is the default value if no zipper-indicator is specified.
  • *ZIPPER indicates that a zipper pattern is to be printed with the barcode.
sequence-indicator
This optional parameter for Maxicode barcode specifies whether this barcode is part of a structured append. The Maxicode barcode can be logically linked together to encode large amounts of data. The logically linked symbols can be presented on the same or different media and are logically recombined after they are scanned. The sequence data for the Maxicode consists of two parts of the following form:
*SEQUENCE(sequence-indicator total-symbols)

sequence-indicator specifies the structured append sequence indicator. Valid values are 0 - 8.

total-symbols specifies the total number of structured append symbols. Valid values are 2 - 8.

Data Matrix: The additional data is specified as an expression of the form:
(*DATAMATRIX row-size number-rows [alternate-data-type] [reader] 
       [header-trailer] [sequence-indicator])                         
You can specify the following parameters for the Data Matrix barcode, in the following order:
row-size
This required parameter for Data Matrix barcode specifies the row size. Data Matrix barcodes are square symbols or rectangle symbols. The square symbols are 10 by 10 to 144 by 144 and the rectangle symbols are 8 by 18 to 16 by 48. A special value of *DFT can be specified to have the printer select the row size based on the amount of symbol data.
number-rows
This required parameter for Data Matrix barcode specifies the number of rows. Data Matrix barcodes are square symbols or rectangle symbols. The square symbols are 10 by 10 to 144 by 144 and the rectangle symbols are 8 by 18 to 16 by 48. A special value of *DFT can be specified to have the printer select the number of rows based on the amount of symbol data.
alternate-data-type
This optional parameter for the Data Matrix barcode specifies the data type for the defined symbol. Valid values are:
  • *USRDEF indicates that this is a user defined symbol. *USRDEF is the default value if no alternate-data-type is specified.
  • *AIMSTD indicates that the symbol conforms to the specific industry standards as authorized by AIM international.
  • *UCCEAN indicates that the symbol conforms to the UCC/EAN application identifier standard format.
reader
This optional parameter for Data Matrix barcode specifies whether this barcode encodes a message used to program the reader system. Valid values are:
  • *DATA indicates that barcode data is supplied. *DATA is the default value if no reader indicator is specified.
  • *RDRPRG indicates that the symbol contains a message used to program the barcode reader.
header-trailer
This optional parameter for Data Matrix barcode specifies whether header and trailers instructions to the barcode reader are to be included. Valid values are:
  • *NO indicates that no header or trailers are to be inserted. *NO is the default value if no header-trailer value is specified.
  • *HEADER5 indicates that the barcode reader will insert a 05 Macro codeword.
  • *HEADER6 indicates that the barcode reader will insert a 06 Macro codeword.
sequence-indicator
This optional parameter for Data Matrix barcode specifies whether this barcode is part of a structured append. The Data Matrix barcode can be logically linked together to encode large amounts of data. The logically linked symbols can be presented on the same or different media and are logically recombined after they are scanned. The sequence data for the Data Matrix consists of three parts of the following form:
*SEQUENCE(sequence-indicator total-symbols file-id)

sequence-indicator specifies the structured append sequence indicator. Valid values are in the range of 1 through 16.

total-symbols specifies the total number of symbols that is logically linked in a sequence of symbols. Valid values are in the range of 2 through 16.

file-id specifies a 2-byte unique file identification for a set of structured-append symbols. When specifying the file-id, the format is X'nnnn', where nnnn is the two byte file ID in hexadecimal.

Note: When a structured append is specified, you must specify *NO for the header and trailer, and you must specify *DATA for the reader. For valid combinations of row-size and number-rows, see the symbology specification.

EBCDIC-to-ASCII translation of two-dimensional barcodes

The two-dimensional barcodes PDF417, Maxicode, and Data Matrix are ASCII barcodes. The system extracts the CCSID of the job that generates the spooled file and translates EBCDIC data to code page 500. The printer then translates the data from code page 500 to the appropriate ASCII code page.

Maxicode and Data Matrix barcodes are assumed to start in ISO 8859-1 code page. The IBM® equivalent is ASCII code page 819. ASCII code page 437 is used for PDF417.

Example

The following example shows how to specify the BARCODE keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
     A            FIELD1        11S  O  2  4BARCODE(UPCA 6)
     A            FIELD2         3A    10  6BARCODE(CODE30F9 4 *NOHRI-
     A                                      *AST X'02')
     A            FIELD3        10S  O  4  5BARCODE(UPCE 6 (*RATIO 2.75) *HRZ +
     A                                      X'00' (*WIDTH .02))
     A            FIELD4        10A  O  5  5BARCODE(CODEABAR 1 (*RATIO 2.1) +
     A                                      *HRITOP)
     A                                  6  5'01234567'
     A                                      BARCODE(CODE128 2 *HRITOP *HRZ +
     A                                      (*WIDTH 0.1) (*RATIO 2) X'01')
     A            FIELD5        10A  0 12  5BARCODE(CODEABAR (2.0 *UOM))
     A            FIELD6        10S  0 15  5BARCODE(10 X'01')