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

Author Message
Allu

New User

Joined: 08 Jun 2005
Posts: 4

 Posted: Wed Jun 08, 2005 3:45 pm    Post subject: How can I declare a WS var to move a S9(5) comp-3 value Hi all, Can any one tell me the size that I have to declare for an var in WS to display a COMP-3 var (eg:S9(5) comp-3). Regards,

senthilkumar selvaraju

New User

Joined: 30 May 2005
Posts: 16

 Posted: Wed Jun 08, 2005 4:34 pm    Post subject: it takes 4 bytes( n/2 + 1) n- number of bytes (12345 i.e 5 bytes) 1 - for sign so (5/2 + 1) = 3.5. Then it rounduped as 4 bytes. So s9(5) comp-3 is equal to 4 bytes.
subhasis_50

Moderator

Joined: 09 Mar 2005
Posts: 363
Location: Earth

 Posted: Wed Jun 08, 2005 4:56 pm    Post subject: Re: How can I declare a WS var to move a S9(5) comp-3 value Hi, I think it will take 3 bytes. for example if we store +12345 in that variable, then it is internally stored as 12 34 5C So total 3 bytes will be taken. For even digit formula is (N/2+1) for even digit (N+1/2)
subhasis_50

Moderator

Joined: 09 Mar 2005
Posts: 363
Location: Earth

 Posted: Wed Jun 08, 2005 4:57 pm    Post subject: Re: How can I declare a WS var to move a S9(5) comp-3 value Hi, For ODD digit it is (N+1/2).
muraly
Currently Banned

New User

Joined: 02 Jun 2005
Posts: 2
Location: chennai

 Posted: Wed Jun 08, 2005 5:11 pm    Post subject: hi hi sentil check u r answer s9(5) com-3 will take 3 bites only. why b'cos each digit takes half byte sign takes half byte 5 digits takes 2 1/2 bytes. sign takes 1/2 byte. total 3 bytes... regards muraly..
srinivasareddy_80

New User

Joined: 07 Mar 2005
Posts: 4
Location: Chennai

 Posted: Mon Jun 13, 2005 12:29 am    Post subject: Re: How can I declare a WS var to move a S9(5) comp-3 value Hi Friends, we can count the size of Comp-3 field in 2 ways 1.S9(5) comp-3 It takes only N/2 1 Bytes,==>>5/2 1==>> 2.5 -.5(Remove the value which is available after Decimal point) 1==>>2 1=3 Bytes. 2.S9(5) comp-3. It is a Packed decimal, So each digit occupy 1/2 Byte 1/2 byte for sign(Right most 1/2 Byte), So 5*1/2 1/2==>>2.5 .5=3 Bytes
srinivasareddy_80

New User

Joined: 07 Mar 2005
Posts: 4
Location: Chennai

 Posted: Mon Jun 13, 2005 12:30 am    Post subject: Re: How can I declare a WS var to move a S9(5) comp-3 value Hi Friends, we can count the size of Comp-3 field in 2 ways. 1. S9(5) comp-3 It takes only N/2 1 Bytes,==>>5/2 1==>> 2.5 -.5(Remove the value which is available after Decimal point) 1==>>2 1=3 Bytes. 2. S9(5) comp-3. It is a Packed decimal, So each digit occupy 1/2 Byte 1/2 byte for sign(Right most 1/2 Byte), So 5*1/2 1/2==>>2.5 .5=3 Bytes. Srinivasa Reddy Lakki Reddy.
mmwife

Super Moderator

Joined: 30 May 2003
Posts: 1592

 Posted: Mon Jun 13, 2005 6:59 am    Post subject: Hi Folks, In my opinion the best way to calc the # of bytes in a comp-3 field is to total the # of 9s. If the total is even, divide by 2; if odd add 1 then divide by 2. It eliminates playing w/the fraction and makes the division straightforward. Just one man's opinion.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics RMM Cannot move a volume from SHELF l... tspr52 IBM Tools 0 Thu Mar 01, 2018 3:48 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