View previous topic :: View next topic
|
Author |
Message |
Gopalakrishnan V
Active User
Joined: 28 Jun 2010 Posts: 102 Location: chennai
|
|
|
|
Can anyone please explain how this declaration works in cobol
Code: |
05 OUT-CNT-MF PIC -(8)9.
|
This code is working fine. But i want to know how the size and length of data is assigned? |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
What experiments have you undertaken to find out for yourself? Have you looked at the manual? have you asked colleagues? Have you written a little program with a variable defined like that and looked at the compiler output to see how much space the compiler assigned it? |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Gopalakrishnan V wrote: |
Can anyone please explain how this declaration works in cobol
Code: |
05 OUT-CNT-MF PIC -(8)9.
|
This code is working fine. But i want to know how the size and length of data is assigned?
Thanks in advance |
As your comprehension of written English is too limited to allow you to understand the manual, I will try to make my explanation of the phenomenon simple enough for you to follow.
Since no USAGE clause is specified, the variable is USAGE IS DISPLAY. There are eight ("(8)") floating minus signs ("-"), and one digit ("9"), making a total of nine (8+1) bytes used. Capisce? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
But i want to know how the size and length of data is assigned? |
Did you start by looking at the data map output of the compiler to see how the compiler interpreted the PICTURE? If not, why not? Seeing what the compiler generated is usually a good way to understand any PIC clauses you don't understand. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
Robert Sample wrote: |
Did you start by looking at the data map output of the compiler ... |
compiler ? data map? |
|
Back to top |
|
|
|