Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Calculating space for COMP variables

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

New User


Joined: 17 Mar 2006
Posts: 4

PostPosted: Sat Apr 22, 2006 11:55 am    Post subject: Calculating space for COMP variables
Reply with quote

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

iknow

Active User


Joined: 22 Aug 2005
Posts: 413
Location: Colarado, US

PostPosted: Sat Apr 22, 2006 8:17 pm    Post subject: Re: Calculating space for COMP variables
Reply with quote

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.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Apr 22, 2006 9:08 pm    Post subject:
Reply with quote

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.
Back to top
View user's profile Send private message
Pranjal

New User


Joined: 17 Mar 2006
Posts: 4

PostPosted: Sun Apr 23, 2006 12:33 pm    Post subject: Re: Calculating space for COMP variables
Reply with quote

Thanks for the replies. I must be checking the mauals first.
Back to top
View user's profile Send private message
KS

New User


Joined: 28 Feb 2006
Posts: 91
Location: Chennai

PostPosted: Tue Apr 25, 2006 3:18 pm    Post subject:
Reply with quote

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

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Apr 26, 2006 6:27 am    Post subject:
Reply with quote

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?
Back to top
View user's profile Send private message
KS

New User


Joined: 28 Feb 2006
Posts: 91
Location: Chennai

PostPosted: Thu Apr 27, 2006 4:08 pm    Post subject:
Reply with quote

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

New User


Joined: 01 May 2005
Posts: 55

PostPosted: Thu Apr 27, 2006 4:48 pm    Post subject: Re: Calculating space for COMP variables
Reply with quote

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.
Back to top
View user's profile Send private message
kamran

New User


Joined: 01 May 2005
Posts: 55

PostPosted: Thu Apr 27, 2006 4:58 pm    Post subject: Re: Calculating space for COMP variables
Reply with quote

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]
Back to top
View user's profile Send private message
new2cobol

New User


Joined: 04 Jan 2006
Posts: 77
Location: Bangalore

PostPosted: Sat Apr 29, 2006 12:49 am    Post subject:
Reply with quote

This should help!!!
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 255
Location: Cincinnati OH USA

PostPosted: Sat Apr 29, 2006 2:18 am    Post subject:
Reply with quote

Pranjal,

the official wisdom from IBM

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3LR30/5.3.17.1?DT=20050714120224
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 CONDITIONAL USING COMP-2 WITH PROBLEMS. JOSUEGENTIL COBOL Programming 7 Wed Nov 08, 2017 11:13 pm
No new posts how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am
This topic is locked: you cannot edit posts or make replies. Need help how to pass the ESP variabl... Venkichaitu JCL & VSAM 12 Thu Nov 02, 2017 3:53 am
No new posts The TS7720 is out of cache space. Rex Montemayor All Other Mainframe Topics 2 Mon Sep 25, 2017 7:18 am
No new posts VSAM Space Allocation mrgnndhmk JCL & VSAM 7 Sat Apr 22, 2017 12:42 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us