IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

What's the size of -9(4).999


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
markanthos

New User


Joined: 28 Apr 2005
Posts: 14
Location: India

PostPosted: Wed May 11, 2005 12:24 pm
Reply with quote

At an HSBC interview I came across the query:

A pic clause is declared as -9(4).999

How many memory locations will this occupy

a)7
b)8
c)9
d)none of the above
and why?
Back to top
View user's profile Send private message
gnagakishore

New User


Joined: 26 Mar 2005
Posts: 25
Location: Hyderabad

PostPosted: Wed May 11, 2005 12:29 pm
Reply with quote

it will occupy 8(eight) bytes.
the reason for that is we have to count "." (dot) aslo.
and comming to "-" it wont occupy any memory unless if we stated "sign traling or leading separate character".[/b]
Back to top
View user's profile Send private message
markanthos

New User


Joined: 28 Apr 2005
Posts: 14
Location: India

PostPosted: Wed May 11, 2005 12:50 pm
Reply with quote

Thanks a lot
Back to top
View user's profile Send private message
Deepa.m

New User


Joined: 28 Apr 2005
Posts: 99

PostPosted: Wed May 11, 2005 2:03 pm
Reply with quote

since it is numeric edited character it will occupy 9 bytes..it will take one byte for '-' sign also.

please advice.

Thanks
Deepa
Back to top
View user's profile Send private message
avalanches

New User


Joined: 10 May 2005
Posts: 28

PostPosted: Wed May 11, 2005 2:33 pm
Reply with quote

Deepa,

The sign will occupy the lower nibble of the right most digit.

Cheers,
avalanches
Back to top
View user's profile Send private message
David P

Active User


Joined: 11 Apr 2005
Posts: 106
Location: Cincinnati Ohio

PostPosted: Wed May 11, 2005 2:44 pm
Reply with quote

Hi Markanthos,
I agree with deepa that the variable is going to take 9 bytes as storage.

An easy way to find out the lenght of any variable is to have a member (say test) in your copylib pds. Then define that variable whose length you want to find out in this member test. Now save this member and open it in fileaid (option F:8 or H:8 as per your installation). If the definition is syntactically correct you will get the lenght.

Let me know if you have any concerns.
David.
Back to top
View user's profile Send private message
kanak

Moderator


Joined: 12 Mar 2005
Posts: 252
Location: India

PostPosted: Wed May 11, 2005 3:05 pm
Reply with quote

even i aslo agree with deepa...i think it will take 9 bytes as it is just a simple declaration...not defined as s9(4).999, in this case it will take i think 8, but when you specify -9(4).999 then it will take 9.
Back to top
View user's profile Send private message
praveenhj

New User


Joined: 05 Apr 2005
Posts: 6
Location: bangalore

PostPosted: Wed May 11, 2005 5:19 pm
Reply with quote

hi, i agree with this it will take 9 bytes, not 8 bytes b'coz it id not declared with s9(4).999.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri May 13, 2005 9:03 pm
Reply with quote

In this case the sign is called a floating edit char and occupies one byte of storage.
Back to top
View user's profile Send private message
priya

Moderator


Joined: 24 Jul 2003
Posts: 568
Location: Bangalore

PostPosted: Fri May 13, 2005 9:26 pm
Reply with quote

So if I colored the reply in RED, it contains error. GREEN means, it is accepted by the moderator. Any Suggestions?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Using Java/C/C++ to retrieve dataset ... Java & MQSeries 6
No new posts Find the size of a PS file before rea... COBOL Programming 13
No new posts Masking variable size field - min 10 ... DFSORT/ICETOOL 4
No new posts Dataset size increase on adding 1 byt... DFSORT/ICETOOL 8
No new posts TWA size of the CPLT transaction CICS 0
Search our Forums:

Back to Top