numeric data >> how does implied decimal gets stored



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

numeric data >> how does implied decimal gets stored

Postby sri_mf » Thu Feb 04, 2016 2:10 pm

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.
sri_mf
 
Posts: 8
Joined: Thu Feb 04, 2016 1:54 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby enrico-sorichetti » Thu Feb 04, 2016 2:21 pm

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 )
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3003
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

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

Postby sri_mf » Thu Feb 04, 2016 2:30 pm

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
sri_mf
 
Posts: 8
Joined: Thu Feb 04, 2016 1:54 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby enrico-sorichetti » Thu Feb 04, 2016 3:03 pm

how does program recognizes how many digits are there before and after decimal point ,,,,,

as I said before it depends on the declaration
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3003
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

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

Postby BillyBoyo » Thu Feb 04, 2016 4:04 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

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

Postby Robert Sample » Thu Feb 04, 2016 8:31 pm

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.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post