Numeric/packed data within an Extraction Variable is right-aligned. To capture this data, it is recommended to specify a Position of 1 for a Length of 8. This captures the full data within an Extraction Variable, which holds 8 characters by default.
Since numeric/packed data is right-aligned, mimicking prior definitions to capture data, such as a Position of 1 for a Length of 3 for a 3-digit number, would cause the search range to be too small and the actual stored data is missed. More information and an example of this behavior are below.
Consider the input record below:
SAMPLE 2020/06/28 C 605
To capture 605 from the input source into an Extraction variable, you would define a Position of 30 and a Length of 3.
All numeric values within an Extraction Variable are stored as packed (hex) values, with the last hex character denoting a "C" for positive values (credits) or a "D" for negative values (debits). The number 605 is stored as the hex values 605C
, which translates to `\
in ASCII or -*
in EBCDIC.
This value is then stored into an Extraction Variable right-aligned:
position: 12345678
variable: -*
When capturing this value out of the Extraction Variable, specifying a Position of 1 and a Length of 3 wouldn't capture the data, as the data is right-aligned. Capturing a Position of 7 for a Length of 2 would work, but for ease of use, capturing the entire variable with a Position or 1 for a Length of 8 is recommended since all data would be captured regardless of how it is stored.
Comments
0 comments
Please sign in to leave a comment.