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

Author Message
Pranjal

New User

Joined: 17 Mar 2006
Posts: 4

 Posted: Sat Apr 22, 2006 11:55 am    Post subject: Calculating space for COMP variables How much space in terms of bytes will the following variables take and how is it calculated? S9(4) COMP S9(5) COMP S9(8) COMP S9(9) COMP S9(10) COMP

iknow

Active User

Joined: 22 Aug 2005
Posts: 413

 Posted: Sat Apr 22, 2006 8:17 pm    Post subject: Re: Calculating space for COMP variables Hi, COMP is a binary storage format . The sign stored in a COMP field will be in the most significant bit. Bit is ON if -ve, off if +ve. S9(4) COMP - 2 bytes S9(5) COMP - 2 bytes S9(8) COMP - 4 bytes S9(9) COMP - 4 bytes S9(10) COMP - 5 bytes Hope this is what you had expected.
mmwife

Super Moderator

Joined: 30 May 2003
Posts: 1592

 Posted: Sat Apr 22, 2006 9:08 pm    Post subject: Hi, The best place to find the ans to ques like yours is in the manuals. From the Zos Pgming Reference Manual: Digits in PICTURE clause Storage occupied 1 through 4 2 bytes (halfword) 5 through 9 4 bytes (fullword) 10 through 18 8 bytes (doubleword) Scroll to the top of this page; clk "manuals". Scroll down to manual selections and clk on your choice.
Pranjal

New User

Joined: 17 Mar 2006
Posts: 4

 Posted: Sun Apr 23, 2006 12:33 pm    Post subject: Re: Calculating space for COMP variables Thanks for the replies. I must be checking the mauals first.
KS

New User

Joined: 28 Feb 2006
Posts: 91
Location: Chennai

 Posted: Tue Apr 25, 2006 3:18 pm    Post subject: Hi, The COMP occupies Int(n/2) 4 bytes and COMP-3 occupies Int((n/2)+1) bytes. So using this we get the results as : S9(4) COMP - Int(4/2) = 2 bytes S9(5) COMP - Int(5/2) = 2 bytes S9(8) COMP - Int(8/2) = 4 bytes S9(9) COMP - Int(9/2) = 4 bytes S9(10) COMP - Int(10/2) =5 bytes Thanks, KS
mmwife

Super Moderator

Joined: 30 May 2003
Posts: 1592

 Posted: Wed Apr 26, 2006 6:27 am    Post subject: KS, The info I offered above was cut & pasted from IBM's eCOBOL Language Reference Manual (SC27-1408-01). Where did you get your info?
KS

New User

Joined: 28 Feb 2006
Posts: 91
Location: Chennai

 Posted: Thu Apr 27, 2006 4:08 pm    Post subject: HI mmwife, Sorry all , I was wrong on tht.. A binary number with a picture description, - less than 4 or fewer decimal digits will occupy 2 bytes. - 5 to 9 decimal digits will occupy 4 bytes. - 10 to 18 bytes occupies 8 bytes. Regret the inconvienience caused. Thanks, KS
kamran

New User

Joined: 01 May 2005
Posts: 55

Posted: Thu Apr 27, 2006 4:48 pm    Post subject: Re: Calculating space for COMP variables

 Pranjal wrote: How much space in terms of bytes will the following variables take and how is it calculated? S9(4) COMP S9(5) COMP S9(8) COMP S9(9) COMP S9(10) COMP

Hi ,

I have written a rexx routines named copyflds to compute the lenght and offset of each feild in a cobol copy member.
I think you don't need to change it much but you can customize it upon your name conventions.
One of The systax of calling it is:
TSO COPYFLDS dataset-name copy-member-name
which copy-member-name is the name of the cobol copy member name
and dataset-name is the name of the dataset which the copy members is reside in.
please copy both attach files COPYFLDS and COPYPICS into a dataset which is concatenated in your user sysproc ddname .

because I prepared it just for my site, I didn't prepared it any document so if there is any problem using it please put a message here.
kamran

New User

Joined: 01 May 2005
Posts: 55

 Posted: Thu Apr 27, 2006 4:58 pm    Post subject: Re: Calculating space for COMP variables Sorry I don't know why the mentioned bellow files didn't attached, So I will try it once!. I think the problem was that I didn't select any extention for the files. So use the attached files to this one! Hi , I have written a rexx routines named copyflds to compute the lenght and offset of each feild in a cobol copy member. I think you don't need to change it much but you can customize it upon your name conventions. One of The systax of calling it is: TSO COPYFLDS dataset-name copy-member-name which copy-member-name is the name of the cobol copy member name and dataset-name is the name of the dataset which the copy members is reside in. please copy both attach files COPYFLDS and COPYPICS into a dataset which is concatenated in your user sysproc ddname . because I prepared it just for my site, I didn't prepared it any document so if there is any problem using it please put a message here.[/quote]
new2cobol

New User

Joined: 04 Jan 2006
Posts: 77
Location: Bangalore

 Posted: Sat Apr 29, 2006 12:49 am    Post subject: This should help!!!
dneufarth

Active User

Joined: 27 Apr 2005
Posts: 317
Location: Inside the SPEW (Cincinnati OH USA)

 Posted: Sat Apr 29, 2006 2:18 am    Post subject: Pranjal, the official wisdom from IBM http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3LR30/5.3.17.1?DT=20050714120224
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Unable to display comp variable shub2204 COBOL Programming 4 Fri Oct 02, 2020 7:05 pm Compare two character variables Head ... Harold Barnes CLIST & REXX 3 Fri Aug 28, 2020 12:38 am Write 9(07) comp-3 data into output file clearskynot DFSORT/ICETOOL 4 Thu Apr 16, 2020 11:00 pm Eliminating blank space in XML parsed... elixir1986 COBOL Programming 0 Tue Feb 11, 2020 4:41 am Not able to view the values of variab... sattar_engg CA Products 1 Thu Jan 23, 2020 12:32 pm

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