Question

I have a fixed width text file, which has been unpacked from Comp-3 data into fixed width strings.

I need to know how to interpret the following fields:

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.

These appear in my flat file as:

FIELD-NAME-1 0123456789123456780
FIELD-NAME-2 01234567890
FIELD-NAME-3 012345670

I need to know what numbers the above would represent.

Is this correct:

FIELD-NAME-1 123456789123456.780  --> The first 0 means +ve?
FIELD-NAME-2 012.34567890
FIELD-NAME-3 012.345670

Thanks for the help. Ham

Was it helpful?

Solution

The S9(15)V9(3) requires 19 nybbles (20 in reality since it must make an even number of nybbles) to store:

  • one for the sign.
  • 15 for the integer bit.
  • 3 for the non-integer bit (V is an implied decimal, not a real one).

The sign usually appears at the end as a C or a D nybble so the answer to this question depends entirely on what did the unpacking.

Your first example actually has the right number of digits without the sign so I'd be concerned with your statement that one of them represented the sign. Either that, or you've left off the "9". The other two examples have enough digits for both the sign and numeric part.

Best bet, see if you can get a negative number (and other test data like 1) into there to see what it generates.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top