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

Author Message
cobolunni

Active User

Joined: 07 Aug 2006
Posts: 128
Location: kerala,india

 Posted: Tue Aug 22, 2006 5:44 pm    Post subject: Find the size of the COBOL Group 01 TAB. 02 A PIC S9(11) USAGE IS COMP 02 B PIC S9(11) USAGE IS COMP SYNC 02 C USAGE IS INDEX 02 D USAGE IS POINTER 02 E PIC 9(11) USAGE IS COMP-3 PLEASE TELL THE SIZE OF TAB

DavidatK

Active Member

Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

Posted: Tue Aug 22, 2006 5:55 pm    Post subject: Re: SIZE OF GROUP

 Quote: 01 TAB. 02 A PIC S9(11) USAGE IS COMP 02 B PIC S9(11) USAGE IS COMP SYNC 02 C USAGE IS INDEX 02 D USAGE IS POINTER 02 E PIC 9(11) USAGE IS COMP-3 PLEASE TELL THE SIZE OF TAB

The length of TAB is 30.

A = 8
B = 8
C = 4
D = 4
E = 6

Total = 30

Dave
cobolunni

Active User

Joined: 07 Aug 2006
Posts: 128
Location: kerala,india

 Posted: Tue Aug 22, 2006 11:21 pm    Post subject: david can u please explain it for me
Archana_MF

New User

Joined: 21 Jul 2006
Posts: 49
Location: California

 Posted: Wed Aug 23, 2006 3:44 am    Post subject: Re: What's the size of the Group Below is a brief Desc of each Usage. 02 A PIC S9(11) USAGE IS COMP : This is Binary and the memory is defined as 2's complement numbers (2x) i.e 2, 4, 8, 16 etc etc So for PIC 1-4 : 2 bytes PIC 5-9 : 4 Bytes PIC 10-18: 8 Bytes and this is byte aligned. For Ur Ex it is 8 Bytes 02 B PIC S9(11) USAGE IS COMP SYNC : Similar to COMP but is synchronized to Word Boundaries. 8-Bytes 02 C USAGE IS INDEX : This is a 4-byte data-item to which the Index value is stored for refrences like table occurances and it need not be a part of the table. the Index data-item can be directly ref by SERACH/SET/COND. 02 D USAGE IS POINTER : This is a 4-Byte field to store address of any data-item or field. when u use this field in ur program ur actually using the address in it which in turn points to actual data. 02 E PIC 9(11) USAGE IS COMP-3 <== It uses a notation called BCD(Binary Coded Decimal) i.e two digits are stored in 1 byte (8 bits ) or u can say 1 digit in 4 bits(nybble). To calculate the storage add 1 to the number of PIC bytes and divide by 2. here it is (11+1)/2 i.e 6 bytes for Ex a number 12345678901(11 digits) is stored as 12 34 56 78 90 1C , C is sign stored in the last Nybble. Hope this helps
MKP

New User

Joined: 23 Aug 2006
Posts: 12
Location: Chennai

 Posted: Wed Aug 23, 2006 8:00 am    Post subject: Re: What's the size of the Group Hi Archana, If a group size is 12 , Now i am using comp-3 as an usage clause. will it take 6.5 bytes or 7 bytes.
Archana_MF

New User

Joined: 21 Jul 2006
Posts: 49
Location: California

 Posted: Wed Aug 23, 2006 9:29 am    Post subject: Re: What's the size of the Group It will be rounded to 7 Bytes for PIC (12) Comp-3 and the upper 4 bits will be ignored and can be zeroes .
guptae

Moderator

Joined: 14 Oct 2005
Posts: 1191
Location: Bangalore,India

 Posted: Wed Aug 23, 2006 9:31 am    Post subject: Hi MKP, For declaration 02 E PIC 9(12) USAGE IS COMP-3 It will take 6 Bytes 02 E PIC S9(12) USAGE IS COMP-3 It will take 7 bytes.
Archana_MF

New User

Joined: 21 Jul 2006
Posts: 49
Location: California

 Posted: Wed Aug 23, 2006 9:38 am    Post subject: Re: What's the size of the Group Correct me If I am wrong, I thought COMP-3 will reserve a Nibble for sign irrespective of Signed S9(12) / Unsigned 9(12) values, making it always 7 bytes for this ex.
MKP

New User

Joined: 23 Aug 2006
Posts: 12
Location: Chennai

 Posted: Wed Aug 23, 2006 9:39 am    Post subject: Re: What's the size of the Group Hi Guptae, Ru sure that if i wont specify s9(12) instead of 9(12) it iwll take only 6 bytes.
kondakonda

New User

Joined: 20 Mar 2006
Posts: 34

 Posted: Wed Aug 23, 2006 10:19 am    Post subject: Re: What's the size of the Group Hi, I am sure it will occupy 7 bytes irrespective of 9(12) or s9(12) Thanks.
guptae

Moderator

Joined: 14 Oct 2005
Posts: 1191
Location: Bangalore,India

 Posted: Wed Aug 23, 2006 11:43 am    Post subject: 02 E PIC 9(11) USAGE IS COMP-3 It will take 6 Bytes 02 E PIC S9(11) USAGE IS COMP-3 It will take 6 Bytes 02 E PIC 9(12) USAGE IS COMP-3 It will take 7 Bytes 02 E PIC S9(12) USAGE IS COMP-3 yeap it will occupie seven byte
cobolunni

Active User

Joined: 07 Aug 2006
Posts: 128
Location: kerala,india

 Posted: Wed Aug 23, 2006 11:53 am    Post subject: Re: What's the size of the Group In case i have given a sync clause in a group item is that clause applicable to all the members of the group or only for that item
jose.jeyan

New User

Joined: 28 Jul 2006
Posts: 60
Location: Mumbai

 Posted: Wed Aug 23, 2006 2:09 pm    Post subject: for 02 E PIC 9(12) USAGE IS COMP-3 it will take 6 bytes as sign is not specified for 02 E PIC s9(12) USAGE IS COMP-3 it will take 7 bytes as the genral formula is int((n/2)+1),sign is stored as hex value in the last nibble.
cobolunni

Active User

Joined: 07 Aug 2006
Posts: 128
Location: kerala,india

 Posted: Wed Aug 23, 2006 5:02 pm    Post subject: Re: What's the size of the Group Please tell me What is the default word boundary in minframe
Marso

REXX Moderator

Joined: 13 Mar 2006
Posts: 1284
Location: Israel

Posted: Wed Aug 23, 2006 5:56 pm    Post subject:

jose.jeyan,

 Quote: for 02 E PIC 9(12) USAGE IS COMP-3 it will take 6 bytes as sign is not specified

Wrong!
Each number occupies half a byte. The rightmost half-byte contains the sign:
C if it's positive,
D if it's negative,
F if it's unsigned.
If you specify an even number (multiple of 2), the leftmost half-byte will contain 0 and will be "wasted".
That's why it is of good practice to specify an odd number (not multiple of 2) for the size of COMP-3 fields, as the fine book says.
jose.jeyan

New User

Joined: 28 Jul 2006
Posts: 60
Location: Mumbai

 Posted: Wed Aug 23, 2006 6:14 pm    Post subject: thanks marso
mmwife

Super Moderator

Joined: 30 May 2003
Posts: 1592

 Posted: Thu Aug 24, 2006 3:30 am    Post subject: Let's change cobolunni's ques. Reverse all the 02 level variables in 01 TAB (i.e. E D C B A, instead of A B C D E). Now, what will the size of TAB be?
DavidatK

Active Member

Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

Posted: Thu Aug 24, 2006 4:09 am    Post subject: Re: What's the size of the Group

Tab starts on a word boundary (Multiple of 4 bytes)

 Code: Offset from ?TAB?  Variable Length          0      E        6 6      D        4 10     C        4 14     slack    2 (added to word align B) 16     B (sync) 8 24     A        8 Total Length 32

Dave
cobolunni

Active User

Joined: 07 Aug 2006
Posts: 128
Location: kerala,india

 Posted: Thu Aug 24, 2006 9:16 am    Post subject: Re: What's the size of the Group In the group (in my first question ) There is a SYNC in the data name B .B is in the group called tab . B has a size of 8 bytes SYNC will create a word boundary of 8 .Is this word boundary is applicable to all of the members in the group .Is that the condition then the answer of my first question will be 40 instead of 30 . Please tell me if SYNC clause is apllicable to all of the members in the group or not
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Issue in suppressing leading zeros &a... Vijay_Sirisha COBOL Programming 21 Thu Jun 07, 2018 8:01 pm VBS to VB in COBOL and JCL srajendran2 COBOL Programming 12 Fri Jun 01, 2018 3:04 am Rexx code to find greater then symobl... Bharath Vikraman CLIST & REXX 8 Tue May 29, 2018 9:40 am How to convert 2 bytes into single by... pkmurali DB2 6 Fri May 25, 2018 1:41 pm SYSADATA - COBOL - Structure displace... ganasrinivasan COBOL Programming 3 Thu May 24, 2018 9:45 pm

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