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
 

 

Maximum value of a comp-3 variable
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
viveksingal

New User


Joined: 11 Sep 2005
Posts: 10

PostPosted: Mon Sep 10, 2007 2:56 pm    Post subject: Maximum value of a comp-3 variable
Reply with quote

Hi,

What can be the maximum value of a comp-3 variable and how that variable can be declared.
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Mon Sep 10, 2007 3:01 pm    Post subject:
Reply with quote

Vivek,

Did you refer any manaul? From the QW -

Quote:
PACKED-DECIMAL
Specified for internal decimal items. Such an item appears in
storage in packed decimal format. There are two digits for each
character position, except for the trailing character position,
which is occupied by the low-order digit and the sign. Such an
item can contain any of the digits 0 through 9, plus a sign,
representing a value not exceeding 18 decimal digits.

The sign representation uses the same bit configuration as the
4-bit sign representation in zoned decimal fields. For details,
see the Enterprise COBOL Programming Guide.
Back to top
View user's profile Send private message
viveksingal

New User


Joined: 11 Sep 2005
Posts: 10

PostPosted: Mon Sep 10, 2007 3:07 pm    Post subject:
Reply with quote

Thanks Murali,

So what you mean is we can declare a COMP-3 variable as s9(18)v9(any number less than 18) comp-3.

Do correct me if i am wrong.

QW? If you can expand on this...
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Mon Sep 10, 2007 3:10 pm    Post subject: Re: Maximum value of a comp-3 variable
Reply with quote

viveksingal wrote:
What can be the maximum value of a comp-3 variable and how that variable can be declared.

If the ARITH(COMPAT) compiler option is in effect: 18 digits or S9(18)...
If the ARITH(EXTEND) compiler option is in effect: 31 digits or S9(31)...
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Mon Sep 10, 2007 3:12 pm    Post subject:
Reply with quote

Vivek,
Quote:
QW? If you can expand on this...

QUICK REFERENCE available in MF.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Mon Sep 10, 2007 3:17 pm    Post subject:
Reply with quote

viveksingal wrote:
So what you mean is we can declare a COMP-3 variable as s9(18)v9(any number less than 18) comp-3.
No, tha max number of total digits is 18 or 31.....

Quote:
Do correct me if i am wrong.
Consider yourself corrected.... icon_wink.gif
Back to top
View user's profile Send private message
viveksingal

New User


Joined: 11 Sep 2005
Posts: 10

PostPosted: Mon Sep 10, 2007 3:39 pm    Post subject:
Reply with quote

Thanks guys,

Now comes my actual problem... I want to multipy two values with these declarations ...

Pic S9(11)V9(6) usage COMP-3 and S9(10)V9(2) usage COMP-3

so to capture the result of this multiplication i have to declare a variable in this manner (considering values is maximum in both the input variables)... S9(21)V9(8) usage COMP-3 ...

and my compiler options support declaration of variable with maximum as 18....

How can i handle such a case now ...
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Mon Sep 10, 2007 3:42 pm    Post subject:
Reply with quote

viveksingal wrote:
and my compiler options support declaration of variable with maximum as 18....
Simple, add ARITH(EXTEND) to your compile....
Back to top
View user's profile Send private message
viveksingal

New User


Joined: 11 Sep 2005
Posts: 10

PostPosted: Mon Sep 10, 2007 5:08 pm    Post subject:
Reply with quote

But i am in need of a solution without changing the Compile options ...
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Mon Sep 10, 2007 5:20 pm    Post subject:
Reply with quote

viveksingal wrote:
But i am in need of a solution without changing the Compile options ...
Bull Pucky..... icon_rolleyes.gif
Either your results are always going to be accurate or not, what is the requirement? Accuracy or close to accurate?
Back to top
View user's profile Send private message
viveksingal

New User


Joined: 11 Sep 2005
Posts: 10

PostPosted: Mon Sep 10, 2007 5:50 pm    Post subject:
Reply with quote

It has to be accurate ...
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Mon Sep 10, 2007 5:59 pm    Post subject:
Reply with quote

viveksingal wrote:
It has to be accurate ...
If it has to be accurate and the number of digits is greater than 18, you will have to use ARITH(EXTEND)......
One or the other, accurate or just close to accurate......
Back to top
View user's profile Send private message
viveksingal

New User


Joined: 11 Sep 2005
Posts: 10

PostPosted: Mon Sep 10, 2007 6:08 pm    Post subject:
Reply with quote

Ok, but when we try to compile it via Endevor ... we are not able to find the ARITH parameter any where ... even when the Compile JCl is JSCANED ... we are not able to find ARITH parameter ....

Any idea on where we have to provide this parameter ....
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Mon Sep 10, 2007 6:24 pm    Post subject:
Reply with quote

You can put the ARITH in a CBL (PROCESS) statement before the ID Division statement....
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: Mon Sep 10, 2007 6:28 pm    Post subject:
Reply with quote

Hello,

When your compile is submitted, there are most likely parameters supplied in the compile PARM. You would need to add ARITH to those parms.

If you need to change how the jcl is created, i'd suggest you talk with the people who support Endevor on your system.
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1105
Location: The Netherlands at Hole 19

PostPosted: Mon Sep 10, 2007 11:39 pm    Post subject:
Reply with quote

Doesn't COBOL support floating point like PL/1 does?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Tue Sep 11, 2007 12:27 am    Post subject:
Reply with quote

Yes, COMP-1 & 2, but that still will not guarantee al the digits - another case of almost accurate....grin.....
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1105
Location: The Netherlands at Hole 19

PostPosted: Tue Sep 11, 2007 2:42 pm    Post subject:
Reply with quote

In that case split the digits and the decimals, calculate and join afterwards
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Tue Sep 11, 2007 2:44 pm    Post subject:
Reply with quote

I don't think that will work for multiplication and division.....
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1105
Location: The Netherlands at Hole 19

PostPosted: Wed Sep 12, 2007 1:46 am    Post subject:
Reply with quote

Yep........I did it in the last century using PL/1 calculating interest over big money. Just deal with p- and q-parts.
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
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 Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts OPC JCL Variable passion_sujesh IBM Tools 5 Fri Jul 01, 2016 4:21 am


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