PRINT-BAR-CODE

Function

Prints bar codes.

Syntax

PRINT-BAR-CODE position
{TYPE={bar_code_type_num_lit|_var|_col}}
{HEIGHT={bar_code_height_num_lit|_var|_col}}
{TEXT={bar_code_txt_lit|_var|_col}}
[CAPTION={bar_code_caption_txt_lit|_var|_col}]
[CHECKSUM={bar_code_checksum_txt_lit|_var|col}]

Arguments

position

Position of the upper left corner. Position parameters can be relative. See POSITION for examples of relative positioning. Document markers are not allowed. After execution, the current position is returned to this location; however, the next listing line is the next line below the bottom of the bar code. (This is different than the way PRINT works.)

TYPE

Type of bar code to print. (See Table 64, Bar Code Types.)

HEIGHT

Height of the bar code in inches. The height must be between 0.1 and 2 inches. The code prints to the nearest one-tenth of an inch. For Zip+4 Postnet, the height of the bar code is fixed. The height should be between 0.2 and 2.0 for Zip+4 Postnet. If it is less than 0.2, the bar code extends above the position specified.

TEXT

Text to encode and print. The number and type of text characters permitted or required depends on the bar code type. See Table 64, Bar Code Types for specifications.

CAPTION

Optional text to print under the bar code in the current font. Production Reporting attempts to center the caption under the bar code; however, for proportional fonts this may vary slightly.

CAPTION is not valid for Zip+4 Postnet. If specified, it is ignored.

CHECKSUM

Optional check sum to compute and print in the bar code. Valid values are YES and NO, where NO is the default.

Note:

Some bar code types ignore the CHECKSUM qualifier. See Table 64 for those bar code types for which CHECKSUM is relevant.

Description

PRINT-BAR-CODE prints industry standard bar codes. Production Reporting supports the bar code types listed in Table 64.

Table 64. Bar Code Types

Type

Description

Text Length

Text Type[a]

CHECKSUM RECOGNIZED

1

UPC-A

11, 13, or 16

9

 

2

UPC-E

11, 13, or 16

9

 

3

EAN/JAN-13

12, 14, or 17

9

 

4

EAN/JAN-8

7, 9, or 12

9

 

5

3 of 9 (Code 39)

1 to 100

9, X, p

y

6

Extended 3 of 9

1 to 100

9, X, x, p, c

y

7

Interleaved 2 of 5

2 to 100

9

y

8

Code 128

1 to 100

9, X, x, p, c

 

9

Codabar

1 to 100

9, p

y

10

Zip+4 Postnet

5, 9, or 11

9

 

11

MSI Plessey

1 to 100

9

y

12

Code 93

1 to 100

9, X, p

y

13

Extended 93

1 to 100

9, X, x, p

y

14

UCC-128

19

9

 

15

HIBC

1 to 100

9

y

[a] 9- Numbers (0-9) X- Upper Case Letters (A-Z) x- Lower Case Letters (a-z) p- Punctuation c- Control Characters

Note:

Production Reporting does not check bar code syntax. (For example, with bar code type 9, Codabar, you must add your own start/stop character to the text argument.) See your bar code documentation for the proper formatting of certain bar codes.

Examples

This example shows how to use PRINT-BAR-CODE to create a UPC‑A bar code.

begin-program
  print-bar-code (3,1)
  type=1               ! UPC-A
  height=0.3
  text='01234567890'
  caption='0 12345 67890'
end-program
The image shows a sample UPC-A bar code.

This example shows how to use PRINT-BAR-CODE to create a ZIP+4 Postnet code.

begin-program
	  print 'John Q. Public'    (3,1)
  	print '1234 Main Street'  (4,1)
  	print 'AnyTown, USA 12345‑6789' (5,1)
  	print-bar-code            (7,1)
  		type=10
  		height=0.2
		  text='12345678934'
end-program
The image shows a sample ZIP+4 Postnet bar code

This example references the last page value from within a bar code. When the report runs, the meta sequence %LAST-PAGE% will be replaced with the value of the last page of the report. This functionality is not available with bar code types 1,2,3,4,10 and 14.

begin-report
let $Caption = 'Page ' || Edit(#Page-Count, '88888') || ' of %LAST-PAGE%'
let $Text = Edit(#Page-Count, '88888') || ' %LAST-PAGE%'
print-bar-code (,30)
  type=5
  height=0.3
  text=$Text
  caption=$Caption
  checksum=Yes
end-report