Page 1 of 1

COBOL file decimal read as 0.0

Posted: Fri Jun 21, 2013 5:24 am
by caltog
Hello,
I'm using a job reading a COBOL file PxCFF.
I read a column PIC 9(13)V9(4) COP-3.
Metadata for this columns are defined as follow 'Decimal (17,4)' in DataStage and in the DB.

When I read the COBOL file I retrieve only 0000000000000.0000 even if there is different data in the file!?

I've an other field Decimal (15,6) which works fine.

Any one as an Idea if there is a parameter to set or anything else?

Thanks for the help,

Tony

Posted: Fri Jun 21, 2013 5:54 am
by ArndW
Does your copybook read
PIC 9(13)V9(4) COP-3.
or

Code: Select all

PIC 9(13)V9(4) COMP-3. 
?

The COMP-3 is a type of BCD encoding where 2 digits are packed into each byte. What does your source file look like in this column - it should contain what looks like unreadable characters.

Posted: Fri Jun 21, 2013 6:33 am
by caltog
Sorry my mistake on the COBOL is reading COMP....
I misstyped when creating the post.

The source file is containing only numbers. No special chars

Tony

Posted: Fri Jun 21, 2013 7:35 am
by ArndW
If there are only numbers in your file, then the column was not exported as a COMP-3 field. You need to correct either the file or the COBOL definition.

Posted: Fri Jun 21, 2013 7:37 am
by ArndW
If there are only numbers in your file, then the column was not exported as a COMP-3 field. You need to correct either the file or the COBOL definition.

Posted: Fri Jun 21, 2013 7:37 am
by ArndW
Try removing the COMP-3 from your copybook definition; but if you are using a fixed-width file definition this will change your field lengths/positions.

"PIC 9(13)V9(4) COMP-3" uses 7 Bytes in the file,
"PIC 9(13)V9(4)." uses 13 Bytes in the file.

Posted: Fri Jun 21, 2013 9:13 am
by FranklinE
ArndW wrote:"PIC 9(13)V9(4) COMP-3" uses 7 Bytes in the file,
"PIC 9(13)V9(4)." uses 13 Bytes in the file.
Sorry, but that's not correct. The COMP-3 field will take 9 bytes in physical storage, and the DISPLAY field (default when no other qualifiers are in the PIC clause) will take 17 bytes.

Posted: Fri Jun 21, 2013 9:42 am
by ArndW
FranklinE - you are absolutely correct, I looked at the 13 and neglected the 4 decimal places. Thanks for correcting that.