Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
[Solved]How to calculate total no of Bytes

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
ragin

New User


Joined: 20 Feb 2005
Posts: 16

PostPosted: Thu Mar 31, 2005 9:05 am    Post subject: How to calculate total no of Bytes
Reply with 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.

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
View user's profile Send private message

gorle_n4

New User


Joined: 11 Mar 2005
Posts: 8
Location: hyderabad

PostPosted: Thu Mar 31, 2005 11:45 am    Post subject: Re: How to calculate total no of Bytes
Reply with quote

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
View user's profile Send private message
learnmf

Active User


Joined: 14 Mar 2005
Posts: 123

PostPosted: Thu Mar 31, 2005 1:18 pm    Post subject:
Reply with quote

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
View user's profile Send private message
rsshanmugam

New User


Joined: 08 Mar 2005
Posts: 54
Location: Chennai

PostPosted: Thu Mar 31, 2005 7:06 pm    Post subject:
Reply with quote

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
View user's profile Send private message
satyanarayana.chitneni

New User


Joined: 28 Mar 2005
Posts: 4
Location: hyderabad

PostPosted: Fri Apr 01, 2005 1:50 pm    Post subject: How to calculate total no of Bytes
Reply with quote

Hi friends,

rsshanmugam is right .
Back to top
View user's profile Send private message
satyanarayana.chitneni

New User


Joined: 28 Mar 2005
Posts: 4
Location: hyderabad

PostPosted: Fri Apr 01, 2005 2:08 pm    Post subject: How to calculate total no of Bytes
Reply with 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
Back to top
View user's profile Send private message
learnmf

Active User


Joined: 14 Mar 2005
Posts: 123

PostPosted: Fri Apr 15, 2005 8:13 pm    Post subject:
Reply with quote

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
View user's profile Send private message
maverick05

New User


Joined: 14 Apr 2005
Posts: 54
Location: Earth

PostPosted: Sat Apr 16, 2005 9:41 pm    Post subject: Re: How to calculate total no of Bytes
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Apr 17, 2005 8:50 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Chandukc

New User


Joined: 25 Apr 2005
Posts: 2

PostPosted: Mon Apr 25, 2005 12:30 pm    Post subject: Shanmuga is correct
Reply with quote

Shanmugam is correct,but the equation he has given is wrong I think.Coorect me if I'm wrong.
Back to top
View user's profile Send private message
ovreddy

Active User


Joined: 06 Dec 2004
Posts: 211
Location: Keane Inc., Minneapolis USA.

PostPosted: Tue Apr 26, 2005 2:55 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Error in SQL-PLIST3 'Above value tru... rikdeb DB2 4 Wed Sep 06, 2017 1:34 pm
No new posts Wanted to calculate TRK when i have B... Balu5491 JCL & VSAM 10 Wed Jul 19, 2017 5:43 pm
No new posts DSNACCOX (can it be run on 1 db/ts, t... SRICOBSAS DB2 5 Sat May 06, 2017 12:59 am
No new posts How to calculate an specific transact... lind sh CICS 2 Tue Sep 13, 2016 9:20 pm
No new posts Calculate a timeframe with DFsort Gerd Hofmans DFSORT/ICETOOL 6 Thu Jan 14, 2016 5:30 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us