Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Comp-5 Type storage
Hi,

I have been trying to figure out what the storage repn. for comp-5
types is. IBM z/os docs says that they contain values upto the
capacity of the native binary representation rather than being implied
by the number of 9's in the pic clause.

Does this mean that a comp-5 type has a fixed size specific to a
certain system .for example 4 bytes if the machine addressing is 4
bytes.

Or does it mean that the size varies with the data being put into it.
For example 12345 in hex is 3039 so we need only 2 bytes. If there is
a larger value then comp-5 stores it in 4 bytes and so on...

Regards,
Ed

Report this thread to moderator Post Follow-up to this message
Old Post
Ed
09-02-04 08:55 PM


Re: Comp-5 Type storage
Ed wrote:
> Hi,
>
> I have been trying to figure out what the storage repn. for comp-5
> types is. IBM z/os docs says that they contain values upto the
> capacity of the native binary representation rather than being implied
> by the number of 9's in the pic clause.
>
> Does this mean that a comp-5 type has a fixed size specific to a
> certain system .for example 4 bytes if the machine addressing is 4
> bytes.
>
> Or does it mean that the size varies with the data being put into it.
> For example 12345 in hex is 3039 so we need only 2 bytes. If there is
> a larger value then comp-5 stores it in 4 bytes and so on...
>
> Regards,
> Ed

Obviously you can't put ten pounds (kilograms) of stuff in a five pound
(kilogram) bag. So you already know the outer limit of capacity.

Your example, 12345, will fit in two bytes. However, 98765 will not. These
numbers, 12345 and 98765 come into being at EXECUTION time whereas storage
allocation takes place at COMPILE time.

In general, you can define a variable as 9(4) at compile time and put a
5-digit number in that field at execution time (using several stratagies),
but it's up to you to make sure the source number does not exceed the
carrying-capacity of the field.

There are compiler directives that manipulate these rules. There are
compiler actions that fiddle with the numbers at execution time. There is no
universal standard inasmuch as the rules and actions depend on both the
compiler in use and the platform. Trust me, what you ask is a complicated
and arcane expedition down into the weeds.

Let me ask you a question: Why do you ask? There may be a simpler way of
attacking the problem that generated your question.



Report this thread to moderator Post Follow-up to this message
Old Post
JerryMouse
09-02-04 08:55 PM


Re: Comp-5 Type storage
On 2 Sep 2004 05:14:20 -0700, ed_narayanan@yahoo.com (Ed) wrote:

>I have been trying to figure out what the storage repn. for comp-5
>types is. IBM z/os docs says that they contain values upto the
>capacity of the native binary representation rather than being implied
>by the number of 9's in the pic clause.

It means whatever the compiler manual says it means. It's not in the
standard.

On compilers that try to be compatible with IBM -- Micro Focus,
Fujitsu and Realia, maybe others -- it means 1, 2, 4 or 8 bytes,
depending on the picture (and compiler options).

>Does this mean that a comp-5 type has a fixed size specific to a
>certain system .for example 4 bytes if the machine addressing is 4
>bytes.

Yes.

>Or does it mean that the size varies with the data being put into it.
>For example 12345 in hex is 3039 so we need only 2 bytes. If there is
>a larger value then comp-5 stores it in 4 bytes and so on...

No.

Report this thread to moderator Post Follow-up to this message
Old Post
Robert Wagner
09-02-04 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:57 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.