View previous topic :: View next topic
|
Author |
Message |
ragin
New User
Joined: 20 Feb 2005 Posts: 16
|
|
|
|
Hi frndz,
I need the following o/p with calculation of how to calculate the total no of bytess in the following:
01 rec1 .
02 a pic x(6).
02 b redefines a.
03 c occurs 6 times pic 9.
02 d occurs 4 times.
03 e pic x(5).
03 f pic 999.
Answer:
a)38.
b)44
c)14
d)32
Now i need to know how to calculate total no of bytess in the above prog.i need it with calculation.kindly update me ASAP. |
|
Back to top |
|
|
gorle_n4
New User
Joined: 11 Mar 2005 Posts: 8 Location: hyderabad
|
|
|
|
01 rec1 .
02 a pic x(6).
02 b redefines a.
03 c occurs 6 times pic 9.
02 d occurs 4 times.
03 e pic x(5).
03 f pic 999.
here b is a redefining a so same memory will be shared so there it is occupying only 6 bytes
c is a group element and d is an elementary item of c. (6+4=10)
e=5
f=3
6+10+5+3=24
so answer is 24
Answer:
a)38.
b)44
c)14
d)32 |
|
Back to top |
|
|
learnmf
Active User
Joined: 14 Mar 2005 Posts: 123
|
|
|
|
Quote: |
Hi frndz,
I need the following o/p with calculation of how to calculate the total no of bytess in the following:
01 rec1 .
02 a pic x(6).
02 b redefines a.
03 c occurs 6 times pic 9.
02 d occurs 4 times.
03 e pic x(5).
03 f pic 999.
|
hi friend the answer is 38.
A and b sharessame space.It is 6.
Dcontains 8*4=32
heceit is 38 |
|
Back to top |
|
|
rsshanmugam
New User
Joined: 08 Mar 2005 Posts: 62 Location: Basildon
|
|
|
|
hai friend the answer is 38 here we go how it happened
01rec1 .
02 a pic x(6).
02 b redefines a.
03 c occurs 6 times pic 9.
02 d occurs 4 times.
03 e pic x(5).
03 f pic 999
6 + 4 * 5 + 4 * 3 = 44 . since b redefines a they share same space |
|
Back to top |
|
|
satyanarayana.chitneni
New User
Joined: 28 Mar 2005 Posts: 4 Location: hyderabad
|
|
|
|
Hi friends,
rsshanmugam is right . |
|
Back to top |
|
|
satyanarayana.chitneni
New User
Joined: 28 Mar 2005 Posts: 4 Location: hyderabad
|
|
|
|
Hi,
Let me know where the 'c' will be stored?
'b' redefines 'a' means both variables adress is same, additional space(additional elementary items of 'b') of 'b' will be appended to space of 'a'.
So i hope 44 is the right answer.
Please give me clear answer whether i am right or not.
Regards,
Satya |
|
Back to top |
|
|
learnmf
Active User
Joined: 14 Mar 2005 Posts: 123
|
|
|
|
Quote: |
Hi,
Let me know where the 'c' will be stored?
'b' redefines 'a' means both variables adress is same, additional space(additional elementary items of 'b') of 'b' will be appended to space of 'a'.
So i hope 44 is the right answer.
Please give me clear answer whether i am right or not.
Regards,
Satya |
HI Satya Where u find aditional space. |
|
Back to top |
|
|
maverick05
New User
Joined: 14 Apr 2005 Posts: 54 Location: Earth
|
|
|
|
Hi Satya,
You have mentioned 6 + 4 * 5 + 4 * 3 = 44 . But i think
6 + 4 * 5 + 4 * 3 = 38. Just check the calculation.Correct me i am wrong as i'm weak in maths |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
HI Satya,
The 6 occurences of the 1 byte c occupy the same space as the 6 byte a.
BTW guys, to avoid confusion, it's best to use parens "()" when showing arith, e.g.:
6 + ( 4 * 5) + (4 * 3) = 38
or more closely describing the record layout:
(1)6 + ( 5 + 3)4 = 38 the numbers within the parens rpresent the
lengths of each elementary item; the numbers
outside the parens represent the occurs. |
|
Back to top |
|
|
Chandukc
New User
Joined: 25 Apr 2005 Posts: 2
|
|
|
|
Shanmugam is correct,but the equation he has given is wrong I think.Coorect me if I'm wrong. |
|
Back to top |
|
|
ovreddy
Active User
Joined: 06 Dec 2004 Posts: 211 Location: Keane Inc., Minneapolis USA.
|
|
|
|
Hi,
01 rec1 .
02 a pic x(6). (6 Bytes)+
02 b redefines a. (same memory so 0)+
03 c occurs 6 times pic 9. (same memory child so 0)+
02 d occurs 4 times. (4*8=32 total child length)+
03 e pic x(5). (5)
03 f pic 999. (3)
So 38 is the answer...
Tip: You can use Calculator to calculate the length.
Thanks,
Reddy. |
|
Back to top |
|
|
|