G Code - Group Extraction
The G code extracts from a data string one or more contiguous segments that are separated by a specified character.
Input Conversion
Input conversion does not invert. It simply applies the group extraction to the input data.
Syntax
G{m}xn
Syntax Elements
m is the number of separation characters to count in order to position at the start of the set of segments to be extracted (referred to as the extraction string below).
If omitted, extraction begins at the start of the first segment in the attribute.
If positive, m is the number of separation characters counted from the start of the attribute to the start of the extraction string.
If negative, m is the number of separation characters counted from the end of the attribute to the start of the extraction string.
x is the separation character.
n is the number of separation characters to count in order to position at the end of the set of segments to be extracted (referred to as the extraction string below).
If positive, n is the number of separation characters counted from start to the end of the extraction string; that is, the number of segments to be extracted.
If negative, n is the number of separation characters counted from the end of the attribute to the end of the extraction string.
Rules
You must specify an AMC in attribute 2 of the data definition, or a conversion code in attribute 7 or 8 which provides an input to the G code processor.
The attribute value can consist of any number of segments. Each segment must be separated by a common nonnumeric character. The separator can consist of any nonnumeric character including a space except for the system delimiters (value, subvalue, attribute, start buffer, and segment marks).
Special Cases
If m is zero or null and the processor does not find x, the processor returns the whole attribute.
If m is nonzero and the processor does not find x, the processor returns null.
If m and n are both negative and n<m, so that the end point of the extraction string is to the left of the start point, the processor returns null
If n is positive and greater than the number of segments to the right of the extraction start position, the processor outputs a truncated string comprising the set of segments between the extraction start point and the attribute end point.
Examples
The following examples illustrate the use of Group Extraction codes to extract segments from the attribute:
AB*CD*EF*GH*IJ*KL*MN*OP*QR*ST*UV*WX*YZ
G Code |
Value Extracted |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
null |
|
|