Please let me know how to handle exponential data format in Cobol.
I have a file of fixed length format and one of the field is amount field which is having values like 5.6843418860808015e-14 .
But it also has values like 328.88899999999995. I need to define the copybook structure for this file. How should I declare a variable to handle this type of values?
Joined: 06 Jun 2008 Posts: 8212 Location: Dubuque, Iowa, USA
I suspect you'll have to define the field as PIC X and use program logic to determine how to handle the contents. If you use an E in the PICTURE clause, I would think records without an E in the field would cause a problem. I have not had a chance to test this, though -- when I get a chance to, Ill post the results.
Is the precision really used for anything? These formats most of all look like values punched from some SAS program where the programmer didn't care or weren't instructed to specify a fixed precision format.
If you have a chance to challenge the input formatting, I would start there.