View previous topic :: View next topic
|
Author |
Message |
learnmf
Active User
Joined: 14 Mar 2005 Posts: 123
|
|
|
|
Hi friends
Code: |
77 A PIC s9(17)v9(2) COMP-3
|
In the above code how much Bytes - A will occupy.
Thanks
Chandra |
|
Back to top |
|
|
anuradha
Active User
Joined: 06 Jan 2004 Posts: 247 Location: Hyderabad
|
|
|
|
It can be calculated as (No of bytes+1)/2. Now you tell me how many bytes A will occupy. |
|
Back to top |
|
|
ralph_v
New User
Joined: 07 Jul 2005 Posts: 27
|
|
|
|
Is the declaration correct.
To my understanding we can store a maximum of length 18. ie.
01 A PIC S9(18) comp-3
which implies (18 / 2) + 1 =>10 bytes.
whereas in the post they have declared it as S9(17)V9(2). Is that correct ?
Correct if me if am wrong. |
|
Back to top |
|
|
anuradha
Active User
Joined: 06 Jan 2004 Posts: 247 Location: Hyderabad
|
|
|
|
Yes Ralph! You are correct. I overlooked it. We can't declare more than 18 digit positions for comp-3 items. |
|
Back to top |
|
|
learnmf
Active User
Joined: 14 Mar 2005 Posts: 123
|
|
|
|
Dear Friends
So overally the formula wil be like this:
S9(n)V9(m) Comp-3 Should be----((n+m)+1)/2
Is it?
Correct if it is wrong?
Thanks
Chandra |
|
Back to top |
|
|
anuradha
Active User
Joined: 06 Jan 2004 Posts: 247 Location: Hyderabad
|
|
|
|
Yes chandra! But remember you can't cross 18 digits |
|
Back to top |
|
|
mf_me
New User
Joined: 18 Jul 2005 Posts: 3
|
|
|
|
is the 18 didgit limit only for comp-3 item ? or for all numeric items e.g can we define s9(18)v(2) ? if yes, what is the max that can be defined |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Quote: |
is the 18 didgit limit only for comp-3 item ? or for all numeric items |
It is for all numeric items.......Not only for COMP-3....
Quote: |
can we define s9(18)v(2) |
Can not....
Quote: |
what is the max that can be defined |
18
Regards,
Priyesh. |
|
Back to top |
|
|
somasundaran_k
Active User
Joined: 03 Jun 2003 Posts: 134
|
|
Back to top |
|
|
batu544
New User
Joined: 21 Jul 2005 Posts: 17 Location: bangalore
|
|
|
|
hi everyone,
Can any body let me know which one is the correct formula to calculate the number of bytes used by a COMP-3 field.
1. (n+1)/2
2. (n/2+1)
plz let me know the correct one. |
|
Back to top |
|
|
vijayamadhuri
Active User
Joined: 06 Apr 2005 Posts: 180
|
|
|
|
It's the first one |
|
Back to top |
|
|
shobam
New User
Joined: 18 Jul 2005 Posts: 34 Location: CN
|
|
|
|
To make the calculations easy
use (n+1) / 2 for odd numbers
and for even numbers (n/2) + 1
Please correct me if I am wrong. |
|
Back to top |
|
|
learnmf
Active User
Joined: 14 Mar 2005 Posts: 123
|
|
|
|
Hi Prasanth
The formula is like this:
FOR COMP-3 VALUES
[code] IF n IS ODD
TOTAL NO OF BYTES= (N+1)/2
ELSE
TOTAL NO OF BYTES= (N/2)+1
THANKS |
|
Back to top |
|
|
batu544
New User
Joined: 21 Jul 2005 Posts: 17 Location: bangalore
|
|
|
|
thanks guys.. |
|
Back to top |
|
|
|