Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
learnmf

Active User

Joined: 14 Mar 2005
Posts: 123

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

Hi friends

 Code: 77     A     PIC   s9(17)v9(2) COMP-3

In the above code how much Bytes - A will occupy.

Thanks
Chandra

Active User

Joined: 06 Jan 2004
Posts: 247

 Posted: Mon Jul 18, 2005 8:57 pm    Post subject: It can be calculated as (No of bytes+1)/2. Now you tell me how many bytes A will occupy.
ralph_v

New User

Joined: 07 Jul 2005
Posts: 27

 Posted: Tue Jul 19, 2005 9:34 am    Post subject: Re: COMP-3 values 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.

Active User

Joined: 06 Jan 2004
Posts: 247

 Posted: Tue Jul 19, 2005 7:43 pm    Post subject: Yes Ralph! You are correct. I overlooked it. We can't declare more than 18 digit positions for comp-3 items.
learnmf

Active User

Joined: 14 Mar 2005
Posts: 123

 Posted: Wed Jul 20, 2005 9:41 am    Post subject: 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

Active User

Joined: 06 Jan 2004
Posts: 247

 Posted: Wed Jul 20, 2005 9:28 pm    Post subject: Yes chandra! But remember you can't cross 18 digits
mf_me

New User

Joined: 18 Jul 2005
Posts: 3

 Posted: Wed Jul 20, 2005 9:43 pm    Post subject: 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
priyesh.agrawal

Senior Member

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

Posted: Wed Jul 20, 2005 9:52 pm    Post subject: Re: COMP-3 values

 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.
somasundaran_k

Active User

Joined: 03 Jun 2003
Posts: 134

Posted: Wed Jul 20, 2005 11:24 pm    Post subject:

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.
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG10/2.4.5?DT=20020923143836

hth
-Som
batu544

New User

Joined: 21 Jul 2005
Posts: 16
Location: bangalore

 Posted: Thu Jul 21, 2005 6:01 pm    Post subject: 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.

Active User

Joined: 06 Apr 2005
Posts: 180

 Posted: Thu Jul 21, 2005 8:56 pm    Post subject: Hi It's the first one
shobam

New User

Joined: 18 Jul 2005
Posts: 34
Location: CN

 Posted: Fri Jul 22, 2005 10:11 am    Post subject: (n+1)/2 or n/2 +1 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.
learnmf

Active User

Joined: 14 Mar 2005
Posts: 123

 Posted: Fri Jul 22, 2005 10:18 am    Post subject: 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
batu544

New User

Joined: 21 Jul 2005
Posts: 16
Location: bangalore

 Posted: Fri Jul 22, 2005 4:46 pm    Post subject: thanks guys..
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics VSAM - Accessing beyond record size Benchwarmer JCL & VSAM 6 Wed Apr 11, 2018 9:20 pm COMP Variables Mismatch gayu7 COBOL Programming 5 Wed Dec 20, 2017 5:06 pm Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm CONDITIONAL USING COMP-2 WITH PROBLEMS. JOSUEGENTIL COBOL Programming 7 Wed Nov 08, 2017 11:13 pm how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us