I am creating an SSIS package to read in unpacked data from a series of copybook files. I am unsure of the correct interpretation of the following field definitions and was hoping someone would know:
FIELD-NAME-1 PIC S9(15)V9(3) COMP-3.
FIELD-NAME-2 PIC S9(3)V9(8) COMP-3.
FIELD-NAME-3 PIC S9(3)V9(6) COMP-3.
The data is stored in fixed width text.
The data for the above fields has the following lengths:
FIELD-NAME-1: 19
FIELD-NAME-2: 11
FIELD-NAME-3: 9
How do we interpret the decimal place and sign?
Here we go:
PICis "picture"S9(15)means a 15 digit numeric signed field: S for sign, 9 is numeric, (15) is length.Vis the decimal position9(3)is a three digit numericand
COMP-3is BCD, a "binary decoded decimal". Each nybble (half-byte) of the field is a decimal value in binary, so0b01110110(duh)is "76".
18 digits requires 9 bytes, the sign is the low nybble of the low order byte.
Which worries me, those should require 10 bytes.
Here's a nice article on it.