Page 1 of 1

numeric data >> how does implied decimal gets stored

PostPosted: Thu Feb 04, 2016 2:10 pm
by sri_mf
How does cobol stores the implied decimal point data items. I mean how will be location of decimal value get stored.

eg:
99V99 4 bytes are stored
99.99 5 bytes are stored ...

in assumed decimal point(99V99) declaration ,,how does cobol stores the location of decimal point.

Re: numeric data >> how does implied decimal gets stored

PostPosted: Thu Feb 04, 2016 2:21 pm
by enrico-sorichetti
it is not stored.

numeric data with implied/virtual is processed according to the program specifications ...

You could read the same <field> with different PICs and everything would work even if the resulting numbers will be different ( In magnitude )

Re: numeric data >> how does implied decimal gets stored

PostPosted: Thu Feb 04, 2016 2:30 pm
by sri_mf
thanks enrico

just curiosity (in process of learning cobol)

how does it assumes ,,,
i mean how does it process ,, how does program recognizes how many digits are there before and after decimal point ,,,,,

is there any documentation to peep into

Re: numeric data >> how does implied decimal gets stored

PostPosted: Thu Feb 04, 2016 3:03 pm
by enrico-sorichetti
how does program recognizes how many digits are there before and after decimal point ,,,,,

as I said before it depends on the declaration

Re: numeric data >> how does implied decimal gets stored

PostPosted: Thu Feb 04, 2016 4:04 pm
by BillyBoyo
You define a field, as enrico has said. The compiler then knows how many decimal digits you have. All actual calculations or other use of the field take into account how many decimal places any relevant fields have. The COBOL compiler knows. If you coded it in Assembler, you'd know, and cater for it yourself.

Re: numeric data >> how does implied decimal gets stored

PostPosted: Thu Feb 04, 2016 8:31 pm
by Robert Sample
One way to learn more about what COBOL is doing would be to compile your program with the LIST option so you can see the pseudo-assembler code generated. Then change the location of the implied decimal point and compile the program again, then compare the two assembler listings. You will see that COBOL adjusts the generated code for the location of the implied decimal point, so there is no need to store the location anywhere.