Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

[Solved]What's the size of s9(17)v9(2) COMP-3

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

Active User


Joined: 14 Mar 2005
Posts: 123

PostPosted: Mon Jul 18, 2005 8:48 pm    Post subject: What's the size of s9(17)v9(2) COMP-3
Reply with quote

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

anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Mon Jul 18, 2005 8:57 pm    Post subject:
Reply with quote

It can be calculated as (No of bytes+1)/2. Now you tell me how many bytes A will occupy.
Back to top
View user's profile Send private message
ralph_v

New User


Joined: 07 Jul 2005
Posts: 27

PostPosted: Tue Jul 19, 2005 9:34 am    Post subject: Re: COMP-3 values
Reply with quote

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

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Tue Jul 19, 2005 7:43 pm    Post subject:
Reply with quote

Yes Ralph! You are correct. I overlooked it. We can't declare more than 18 digit positions for comp-3 items.
Back to top
View user's profile Send private message
learnmf

Active User


Joined: 14 Mar 2005
Posts: 123

PostPosted: Wed Jul 20, 2005 9:41 am    Post subject:
Reply with quote

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

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Wed Jul 20, 2005 9:28 pm    Post subject:
Reply with quote

Yes chandra! But remember you can't cross 18 digits
Back to top
View user's profile Send private message
mf_me

New User


Joined: 18 Jul 2005
Posts: 3

PostPosted: Wed Jul 20, 2005 9:43 pm    Post subject:
Reply with quote

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

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Wed Jul 20, 2005 9:52 pm    Post subject: Re: COMP-3 values
Reply with quote

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

Active User


Joined: 03 Jun 2003
Posts: 134

PostPosted: Wed Jul 20, 2005 11:24 pm    Post subject:
Reply with quote

mf_me
Quote:

can we define s9(18)v(2) ? if yes, what is the max that can be defined


Using the Enterprise COBOL for z/OS or the newer OS/390 version you can define upto 31 digits for a numeric field. You have to use the ARITH(EXTEND) compiler option.
Check this link
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG10/2.4.5?DT=20020923143836

hth
-Som
Back to top
View user's profile Send private message
batu544

New User


Joined: 21 Jul 2005
Posts: 16
Location: bangalore

PostPosted: Thu Jul 21, 2005 6:01 pm    Post subject:
Reply with quote

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

Active User


Joined: 06 Apr 2005
Posts: 180

PostPosted: Thu Jul 21, 2005 8:56 pm    Post subject: Hi
Reply with quote

It's the first one
Back to top
View user's profile Send private message
shobam

New User


Joined: 18 Jul 2005
Posts: 34
Location: CN

PostPosted: Fri Jul 22, 2005 10:11 am    Post subject: (n+1)/2 or n/2 +1
Reply with quote

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

Active User


Joined: 14 Mar 2005
Posts: 123

PostPosted: Fri Jul 22, 2005 10:18 am    Post subject:
Reply with quote

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

New User


Joined: 21 Jul 2005
Posts: 16
Location: bangalore

PostPosted: Fri Jul 22, 2005 4:46 pm    Post subject:
Reply with quote

thanks guys..
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 Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Increase the screen size after split mistah kurtz TSO/ISPF 2 Fri Sep 02, 2016 6:39 pm
No new posts Need help to populate date in COMP-3 ... chetanambi DFSORT/ICETOOL 3 Tue Jun 21, 2016 12:25 pm
No new posts comparing comp-3 and unpacked numbers juares castro COBOL Programming 3 Mon May 30, 2016 6:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us