The text of a manual · part 16 of 42
DS/DD Series B Enhanced Bar Code Decoders User Manual (Bulletin 2755): 10 -Configuration: Host Message Replacement Rules, pages 136 to 145
Pages 136 to 145 of 361, from DS/DD Series B Enhanced Bar Code Decoders User Manual (Bulletin 2755)
The original document is the PDF (1.4 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Allen-Bradley 2755-DD and Allen-Bradley 2755-DS
Page 136
Chapter
10
Configuration: Host Message Replacement Rules Introduction to Host Message Replacement Rules
Function 5 on the Select Operation menu accesses the Host Message Replacement Rules configuration screen. Use this function to modify the message sent to the host.
Host message replacement rules may not be required in every application. They are unnecessary when your needs include simple object counting, or collection of raw bar code data. However, host message replacement rules will prove useful when you need to substitute a predetermined output message for specific bar code data during decoding. With them you can:
• send data in a particular, predefined order regardless of the order • • • • • in which the labels were read mask bar code characters to simplify operations and speed processing truncate or pad the length of the data package substitute a predetermined text string for one or more expected values. convert abstract bar code contents into more easily understood text form categorize labels based upon selected portions of their contents.
Both the search and replacement strings that make up a Host Message Replacement Rule can consist of a combination of standard ASCII characters and special characters known as metacharacters. Metacharacters are explained later in this section. Publication 2755-833
Page 137
10–2
Configuration: Host Message Replacement Rules
Symbols vs. Host Message Fields Understanding host message replacement rules and their use requires that you clearly understand the difference between two frequently confused terms. A bar code symbol is the set of bars and spaces from which the scanner gathers data for interpretation by the decoder. A message field is the decoded information sent from the decoder to a host after processing an incoming symbol. In the most simple terms, a symbol can be thought of as a stimulus to the decoder, and a message field (or group of message fields assembled into a host message) can be considered the response to that stimulus.
Introduction to Host Message Replacement Rules The decoder allows you to use up to 16 Host Message Replacement Rules. Each rule can be enabled and defined as necessary to meet your own application needs. In addition to the prompt line at the bottom of the screen, the Host Message Replacement Rules configuration screen is made up of three sections:
Publication 2755-833
Page 138
Configuration: Host Message Replacement Rules
10–3
• Rule status, located on the far left side of the screen Each number represents an available host message replacement rule. Currently enabled rules are marked with an asterisk (*). Rules are enabled by assigning a value to the Find String Containing field. • Host message replacement rule definition, located in the upper half of the screen This section displays the current search rule criteria (which include Source, Symbology, Symbol Number, and Find String Containing) and the replacement string to send to the host when matches are found. The rule definition also includes parameters to fix the length of the field, the character used to “fill” the field, and the alignment of the string within the field. • Example testing, in the lower portion of the screen This section provides a “worksheet” where you can insert sample bar code strings to test the performance of your rules. This feature allows you to conveniently “debug” your replacement rule expressions for structural and logical errors before going on-line. You simply input the test bar code string on the left. The string that will appear in the host message after application of the displayed rule appears on the right. If your test string does not create a match, you will be notified of that fact on the right side of the screen. Taken together, these three sections provide for full control over host message replacement rules, and enable you to format complete, comprehensible message fields as required. Each format parameter is defined below along with the field type and possible values. The default value is shown in bold letters in the parameter tables. A careful study of the examples that follow the parameter descriptions will help explain their use.
Metacharacters The decoder provides a complete set of special purpose characters you can use to perform logical functions on characters, expressions, or even entire strings. These characters are known as metacharacters. Simply put, they are string manipulation commands consisting of standard ASCII characters which you can embed within search or replacement strings. Each metacharacter conveys a specific instruction to the decoder software, and acts upon a clearly defined range within the string. Metacharacters can be used with standard alphanumeric characters to describe and manipulate even the most complex substitution scenarios with ease.
Publication 2755-833
Page 139
10–4
Configuration: Host Message Replacement Rules
A listing of valid metacharacters appears in the table below. Each appears with a general explanation of its function and syntax. More detailed examples of their use appear at the end of this chapter. Note: The host replacement rules interpret a question mark differently than does the match code table. As a metacharacter used with the host replacement rules, a question mark is not interpreted as a single character wild card. See Table 10.B and 10.C later in this chapter. Note: There are two distinct sets of metacharacters used by the host message replacement rule software. One set applies only to search patterns, and the other only to replacement strings. If the decoder encounters a search pattern metacharacter in a replacement message, it will interpret it as a standard ASCII character. Conversely, if the decoder detects a replacement string metacharacter in a search pattern, it will interpret it as a standard ASCII character. For example, a “*” in a replacement string will be treated as normal text, and “&” in a search pattern will be treated as normal text. Use the characters described in the following tables to help establish the exact search patterns that meet your needs. Proceed carefully, however. While the individual metacharacters perform easily understood actions, combining and nesting them will quickly create extremely complex logical expressions. Be sure to test your expressions thoroughly in the lower half of the screen to make certain your search and replace strings perform as you expect them to under the conditions you are liable to experience. Table 10.A Search pattern metacharacters – position dependent Character
Description and Use Note: The following two metacharacters are position-dependent. They must appear in the location specified to be matched.
^
If the circumflex ( ^ ) is used as the first character in the search pattern, it indicates that the characters, other metacharacters, expressions, or strings must occur at the beginning of the string to be matched. Note that the circumflex has a special meaning if used within square brackets, as explained elsewhere in this chapter.
$
When the dollar sign is used as the last character in the search pattern, it indicates that the characters, other metacharacters, expressions or strings must occur at the end of the string to be matched.
Table 10.B Search pattern metacharacters – wildcard Character .
Publication 2755-833
Description and Use The period represents any single character, and is used as a single-character “wildcard”.
Page 140
Configuration: Host Message Replacement Rules
10–5
Table 10.C Search pattern metacharacters – string manipulation Description and Use
Character
Note: These metacharacters refer to the character, metacharacter, string, or expression that immediately precedes them. ?
The question mark instructs the rule to match either no occurrence or one occurrence of what precedes it. This metacharacter is used in a search string where the character may not appear at all, or may appear once.
+ The plus sign instructs the rule to match one or more occurrences of what precedes it. This metacharacter is used in a search string where the character will be present, but you are unsure how many times it appears. * The asterisk instructs the rule to match none or more occurrences of what precedes it. This metacharacter is used in a search string in cases where the character may not appear, or may appear one or more times. Table 10.D Search patter metacharacters – logical operators and other special functions Character
Description and Use
[ ]
Square brackets ( [ ] ) instructs the rule to match an incoming string if any character enclosed within the brackets appears in the string. A range of values can be represented within the brackets by separating the first and last characters in the range by a hyphen. Square brackets must be used in pairs. Note: The circumflex ( ^ ) can be used as the first character within the square brackets to reverse the sense of the expression. Examples [ABC]
Matches “A”, “B”, or “C”
[L–P]
Matches “L”, “M”, “N”, “O”, or “P”
[0 – 9]
Matches “0”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, or “9”
[^A – Z]
Matches any character that is not upper case alphabetic ( )
Parentheses can be used in two different ways. They can be used in search patterns to group characters and metacharacters to form expressions. Parentheses must be used in pairs. Examples (AB)+ The plus sign applies to the expression (AB). Strings that would match this expression include: “AB”, “ABAB”, “123AB”, and “AB123”. Parentheses can also be used to identify strings for use in the Replace Entire String With field. If a character, string, or expression is surrounded by parentheses in a search pattern, then it can be later recalled in a replace pattern with the “\n” metacharacter described elsewhere in this chapter. Note: Parentheses may be nested to form complex expressions.
Publication 2755-833
Page 141
10–6
Configuration: Host Message Replacement Rules
Character
Description and Use
|
A vertical bar (the shifted “\” character on the keyboard) instructs the rule to match an incoming string if the character or expression on the left or right of the vertical bar appears in the string. Examples
\
A|B
Matches “A” or “B” abc|123
Matches “abc” or “123”
The backslash indicates that the following character, which would normally be interpreted as a metacharacter, should instead be interpreted as a literal ASCII character. Note: The backslash is used differently in the Replace Patterns. See Table 10.E. Example \. rather than a
The period ( . ) will be interpreted as a period single character wildcard.
Publication 2755-833
Page 142
Configuration: Host Message Replacement Rules
10–7
Table 10.E Replacement string metacharacters Character
Description and Use
\n
The backslash plus a number 1 through 9 recalls a previously saved string. Any character, string or expression that is surrounded by parentheses in the search pattern (as described earlier) can be recalled by the replace pattern using the “\n” format. Since the parentheses may be nested, the number “n” represents the order of the groupings as defined by the order of the left parenthesis in the search pattern. Examples Search Pattern = Replace Entire String With = Incoming String = Result for Host Message =
123(ABC) \1 123ABC456 ABC
The search pattern above matches the incoming string. The Replace Entire String With value states that the string identified within the first parentheses should be sent to the host. Search Pattern = Replace Entire String With = Incoming String = Result for Host Message =
(123(ABC)) \1\2 123ABC456 123ABCABC
The search pattern above matches the incoming string. The Replace Entire String With value states that the string identified within the first parentheses (123ABC), plus the string identified by the second parentheses(ABC) should be sent to the host. &
When the ampersand ( & ) is used in a replacement pattern, it indicates that the part of the string that matches the search pattern should be sent to the host. Therefore, if the string read contains more characters than the search pattern, then the additional characters are discarded. Examples Search Pattern = Replace Entire String With = Incoming String = Result for Host Message =
123ABC & 123ABC 123ABC
The search pattern matches the incoming string. The Replace Entire String With value states that the string identified in the search pattern should be sent to the host. Search Pattern = Replace Entire String With = Incoming String = Result for Host Message =
123ABC & 123ABC456 123ABC
The search pattern matches the incoming string. The Replace Entire String With value states that the string identified in the search pattern should be sent to the host. This does not include the digits 456.
Processing Order Matches are determined for each of the Host Message Fields (1 through 16) by applying the rule parameters as follows:
Publication 2755-833
Page 143
10–8
Configuration: Host Message Replacement Rules
The lowest numbered rule with the Host Message Field Number value of 1 (or All) will be applied first. If that rule is successful, no other rule specifying field 1 (or All) will be applied. This will continue until a rule satisfies the field, or until all appropriate rules have been applied to field 1. The decoder will continue this process for all fields until each is satisfied, or until all appropriate rules have failed. No-read Replacement strings (if defined) will be substituted for the data if the rules fail. See Chapter 11. Important: You will want to set up your host message replacement rule table with care. Here are a few general guidelines:
• Prioritize your replacement rules. Only one rule can fill a field, and once one rule has filled a field, then no other rules will apply to that field. Define the rule which will lead to the most preferable result first, the next preferable result next, and so on. • If you need to fill specific fields, define the rules for those fields first. • When using metacharacters, define first those expressions which are most restrictive (most specific), and then proceed to those which are less so. • Define rules specifying All as the host message field number last. This is especially important, because if such a rule creates a match, then no other rules that occur after it and are directed to specific host fields can have any affect. (Remember: once one rule has filled a field, then no other rules will apply to that field.)
Configuration Parameters
Source Field Type Options Select
A (Default for DS Only) B A|B = A or B (Default for DD only) Aux
Specifies where an event can originate and meet the host message replacement rule requirements. For DS decoders, Scanner A is the default value. For DD decoders, the default value is A|B, which means that the decoder will accept input from either A or B to create a match. You can also select AUX or, if you have a DD decoder, Scanner B as the source. The decoder processes rules for the AUX and each of the scanners separately. For example, if all enabled rules specify Scanner A as the source, then data received from Scanner B or the auxiliary terminal does not pass through the rules and will not be affected by them.
Publication 2755-833
Page 144
Configuration: Host Message Replacement Rules
10–9
Note: If any rule is enabled for a given source, then all data from that source will pass through the rules. For example, if any rule is enabled for AUX data, then all AUX data will pass through the rules. Therefore, if you construct a rule with Scanner A as the source, and establish no rule for Scanner B, then all data from Scanner A will pass through the rules, while the data from Scanner B will not. In that case, a no-read from Scanner A would be represented by the appropriate no-read replacement string. A no-read from Scanner B (in Independent Mode) would be represented by the default no-read string. Use “A|B” as the source if you want the rule to apply to both scanners, or whenever Scanner B is set to coordinated mode. When AUX is selected as the source, the rule processor ignores that rule’s Host Field Number, Symbol Number, and Symbology parameters.
Symbology Field Type Options Code 39 Interleaved 2-of-5 Codabar UPC-A UPC-E Select EAN-8 EAN-13 Code 128 Pharma–Code① Any ① Applies only to decoders equipped with the optional Pharma–Code capabilities.
Selects the symbology to which the host message replacement rule should be applied. The default value is Any. Pharma–Code is available only on decoders equipped with the Pharma–Code option.
Symbol Number Field Type Options Edit Numeric
1 to 16 All
Determines the bar code symbol to which the displayed rule should be applied. 1 would apply the rule only to the first symbol read, 2 to the second symbol, and so on up through 16. The default value of All applies the rule to all symbols read. Use All in raster scanner applications, or whenever you are uncertain of the order in which the symbols will be read.
Publication 2755-833
Page 145
10–10
Configuration: Host Message Replacement Rules
Note: Using a combination of All in the symbol number field and All in the host message field number field within a rule creates a special situation in which the decoder will attempt to match the rule using only those symbols that have not previously satisfied a rule. A rule in which the host message field number is set to All will try to process every symbol to satisfy the search criteria until all of the host fields are satisfied. Important: Do not set the host message field number to All unless:
• The Number of Fields in Message parameter is set to 1 on the Host Message Format screen. OR • The Number of Fields in Message parameter is set to All on the Host Message Format screen and the Symbols per Package parameter is set to 1 on the Scanner Control screen OR • The Symbol Number parameter is set to All. Other configurations will result in multiple copies of the same data being set as different fields in the host message. For example, if the Number of Fields in Message parameter is set to a number greater than 1, with the host message field number set to All, then the same symbol will be processed through a single rule multiple times. For the purposes of this example, assume the number of fields in message value is set to 3, and the user has enabled rule number 1 as shown below.
Publication 2755-833