Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

[Closed]Why COMP-1 and COMP-2 dont hav picture clause
Goto page 1, 2  Next
 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
vsvsankar

New User


Joined: 10 Mar 2004
Posts: 7

PostPosted: Wed Mar 10, 2004 7:42 pm    Post subject: Why COMP-1 and COMP-2 dont hav picture clause
Reply with quote

Hi,
I hav seen the answers to the above question.but still it is vague to me.can anyone explain it to me in detail

Thanks,
Vijai icon_smile.gif
Back to top
View user's profile Send private message

mdtendulkar

Active User


Joined: 29 Jul 2003
Posts: 238
Location: USA

PostPosted: Thu Mar 11, 2004 10:54 am    Post subject:
Reply with quote

Hello vsvsankar,

Look at the following link

http://www.cis.scu.edu.tw/oproom/doc/acucobol/docs/comprun/gt400419.htm

Hope this helps

Regards

Mayuresh Tendulkar
Back to top
View user's profile Send private message
mcmillan

Site Admin


Joined: 18 May 2003
Posts: 1202
Location: India

PostPosted: Fri Mar 12, 2004 8:40 pm    Post subject: Re
Reply with quote

Dear,

COMP-1 & COMP-2 have predefined PICTURE clauses as:

COMP-1 : SV9(8)ES99

COMP-2: SV9(17)ES99
Back to top
View user's profile Send private message
vsvsankar

New User


Joined: 10 Mar 2004
Posts: 7

PostPosted: Sun Mar 14, 2004 12:33 pm    Post subject: thanks
Reply with quote

Hi,
Thanks for your prompt response.

Vijai
Back to top
View user's profile Send private message
praveenhj

New User


Joined: 05 Apr 2005
Posts: 6
Location: bangalore

PostPosted: Sat May 14, 2005 12:01 pm    Post subject: Re: Re
Reply with quote

mcmillan wrote:
Dear,

Who told you as, COMP-1 & COMP-2 don't have PICTURE clause?

They have predefined PICTURE clauses as:

COMP-1 : SV9(8)ES99

COMP-2: SV9(17)ES99



what is that ES i'm not getting u, can u explain in clear.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon May 16, 2005 4:18 am    Post subject:
Reply with quote

The eCOBOL Pgmr Ref states that COMP-1 & 2 data items cannot have PIC strings. Probably because the length of the item is fixed, whether it contains a value of 1 or 1 billion:

It contains a sign in the hi-ord bit, a 7 bit exponent, and the maining 3 bytes (COMP-1) or 7 bytes (COMP-2) define the mantissa.
Back to top
View user's profile Send private message
nave

New User


Joined: 16 May 2005
Posts: 10
Location: bangalore,india

PostPosted: Mon May 16, 2005 6:05 pm    Post subject:
Reply with quote

as jack said,
comp1 takes 4 bytes of memory space and comp2 takes 8 bytes of memory space .so no need of specyfying the bytes,then comp allowed only for numerics so no need of pic also
Back to top
View user's profile Send private message
prav_06
Warnings : 1

Active User


Joined: 13 Dec 2005
Posts: 154
Location: The Netherlands

PostPosted: Tue Jan 24, 2006 3:41 pm    Post subject: Re: why comp-1 and copm-2 dont hav picture clause
Reply with quote

Hi,
we indicate PICTURE clause for all the data types we declare, u shd first understand the need of this picture clause if u want to know why comp-1 and 2 does not have picture clause, c this PICTURE clause is the one which allocates the memory for the data item u have declared during the run time for eg
77 a pic 999.
when u using the above identifier in any operationinside u r cobol pgm it needs 3 bytes of memory durin the run time , PICTURE clause is one which is responsiable for this memory allocation, but when u consider COMP-1 or COMP-2 , the memory occupied by these variables are predefined as 1 word and 2 word respectively, so there is no use of coding PICTURE clause for COMP-1 and COMP-2 variables
Back to top
View user's profile Send private message
Brian's_song

New User


Joined: 27 Dec 2005
Posts: 21

PostPosted: Sun Feb 12, 2006 7:29 pm    Post subject:
Reply with quote

Hi all,
ANd How about the Com-3 and Display ?

Thanks.
Back to top
View user's profile Send private message
ap_mainframes

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Tue Mar 28, 2006 9:16 pm    Post subject:
Reply with quote

Quote:
Who told you as, COMP-1 & COMP-2 don't have PICTURE clause?

They have predefined PICTURE clauses as:

COMP-1 : SV9(8)ES99

COMP-2: SV9(17)ES99


All,

This picture clause is still not clear to me.
What exactly is SV and ES signifing here.
I know why it wont need a picture clause but whats SV and ES here????
I have read all the previous replies but i dont think any of them is explaining this clearly.

Thanks
ap_mainframes
Back to top
View user's profile Send private message
tushar_zibbu

New User


Joined: 10 Jan 2006
Posts: 3

PostPosted: Fri Mar 31, 2006 2:05 am    Post subject: why comp-1 and copm-2 dont hav picture clause
Reply with quote

Ya I am also confused about this SV and ES concept. icon_rolleyes.gif icon_biggrin.gif Can anyone please explain.
Regards,
Tushar
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Apr 01, 2006 11:45 pm    Post subject:
Reply with quote

S denotes the sign.
V denotes an implied decimal place.
E denotes an exponent.
Back to top
View user's profile Send private message
DeepaBala

New User


Joined: 20 Feb 2007
Posts: 13
Location: Trivandrum

PostPosted: Thu Feb 22, 2007 10:27 am    Post subject:
Reply with quote

Thanks for the useful question and a great replies
Back to top
View user's profile Send private message
kshalini

New User


Joined: 20 Feb 2007
Posts: 8
Location: Banglore

PostPosted: Thu Mar 08, 2007 5:04 pm    Post subject:
Reply with quote

can any1 explain where we use comp-1 and comp-2 and the pic clause mentioned exactly means what
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 685
Location: Earth

PostPosted: Thu Mar 08, 2007 8:18 pm    Post subject:
Reply with quote

Don't get confused with the PICTURE clause. 'SV9(8)ES99' is 'IMPLICIT' pic clause when we declare COMP-1

Lets verify it practically with small experiment.
I am moving a very small negative value to COMP-1 variable
Code:

  01  WS-AMOUNT-NU COMP-1.   
  PROCEDURE DIVISION.
    MOVE -.0000099999 TO WS-AMOUNT-NU.     
    DISPLAY WS-AMOUNT-NU.               
   


this is what I got in my spool
-.99998997E-05
-0.0000099999 is .99999 * 10 ^ 05
self explanatory, isn't it? icon_biggrin.gif
Back to top
View user's profile Send private message
cobolunni

Active User


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

PostPosted: Thu Mar 08, 2007 11:14 pm    Post subject:
Reply with quote

kshalini wrote:
can any1 explain where we use comp-1 and comp-2 and the pic clause mentioned exactly means what


COMPUTATIONAL or COMP is used in the case of arithmatic operations because computer uses binary form of integers to do the arithmatic process so it will be difficult to convert every time from default EBCDIC to binary when we need an arithmatic process. So we are going for comp also memmory management is another consideration

COMP has a default picture clause internaly so need to mension it
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Mar 08, 2007 11:31 pm    Post subject:
Reply with quote

Hello,

Not completely true.

Quote:
COMPUTATIONAL or COMP is used in the case of arithmatic operations because computer uses binary form of integers to do the arithmatic process

The computer does not always use binary arithmetic for computations (ASCII platforms typically do, but this forum is for mainframes).

In fact, business arithmetic on the mainframe is not binary most of the time. The mainframe has a complete set of packed-decimal arithmetic instructions. In most cases, the result of a calculation must be edited (i.e. $1,234.44-) for readability and the input to the edit instruction must be packed-decimal. If it is not, the system must first get the value into a packed-decimal field, so dollar fields and quantity fields are usually defined as packed-decimal.
Back to top
View user's profile Send private message
cobolunni

Active User


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

PostPosted: Thu Mar 08, 2007 11:41 pm    Post subject:
Reply with quote

yes dick but packed decimal itself is a form of binary format
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Mar 09, 2007 12:30 am    Post subject:
Reply with quote

Why would you think that icon_question.gif
Quote:
but packed decimal itself is a form of binary format

No, it is not - unless you want to say that everyting is a form of binary format.

The letter A is a hex 'C1' and in binary is '1100 0001'. I guess that is a binary format. Kinda silly, but it is binary. . . .

And yes, all 256 possible values for one byte have a binary internal storage of ones and zeros. That does not make them "binary format". The format is determined by the definition (i.e. PIC whatever).

Packed decimal by definition is not binary.
Back to top
View user's profile Send private message
cobolunni

Active User


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

PostPosted: Fri Mar 09, 2007 1:12 am    Post subject:
Reply with quote

dick scherrer wrote:
Packed decimal by definition is not binary.


defenition of packed decimal is
Quote:
Binary-coded decimal (BCD) is an encoding for decimal numbers in which each digit is represented by its own binary sequence.


so each digit is represented in binary format.

look at http://en.wikipedia.org/wiki/Binary-coded_decimal
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Need help on SQL Dynamic WHERE Clause subratarec DB2 12 Sat Jul 16, 2016 3:11 pm
No new posts Need help to populate date in COMP-3 ... chetanambi DFSORT/ICETOOL 3 Tue Jun 21, 2016 12:25 pm
No new posts comparing comp-3 and unpacked numbers juares castro COBOL Programming 3 Mon May 30, 2016 6:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us