Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes

 Maximum value of a comp-3 variable Goto page 1, 2  Next
Author Message
viveksingal

New User

Joined: 11 Sep 2005
Posts: 10

 Posted: Mon Sep 10, 2007 2:56 pm    Post subject: Maximum value of a comp-3 variable Hi, What can be the maximum value of a comp-3 variable and how that variable can be declared.

murmohk1

Senior Member

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

Posted: Mon Sep 10, 2007 3:01 pm    Post subject:

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.
viveksingal

New User

Joined: 11 Sep 2005
Posts: 10

 Posted: Mon Sep 10, 2007 3:07 pm    Post subject: 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...
CICS Guy

Senior Member

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

Posted: Mon Sep 10, 2007 3:10 pm    Post subject: Re: Maximum value of a comp-3 variable

 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)...
murmohk1

Senior Member

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

Posted: Mon Sep 10, 2007 3:12 pm    Post subject:

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

QUICK REFERENCE available in MF.
CICS Guy

Senior Member

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

Posted: Mon Sep 10, 2007 3:17 pm    Post subject:

 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....
viveksingal

New User

Joined: 11 Sep 2005
Posts: 10

 Posted: Mon Sep 10, 2007 3:39 pm    Post subject: 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 ...
CICS Guy

Senior Member

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

Posted: Mon Sep 10, 2007 3:42 pm    Post subject:

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

New User

Joined: 11 Sep 2005
Posts: 10

 Posted: Mon Sep 10, 2007 5:08 pm    Post subject: But i am in need of a solution without changing the Compile options ...
CICS Guy

Senior Member

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

Posted: Mon Sep 10, 2007 5:20 pm    Post subject:

 viveksingal wrote: But i am in need of a solution without changing the Compile options ...
Bull Pucky.....
Either your results are always going to be accurate or not, what is the requirement? Accuracy or close to accurate?
viveksingal

New User

Joined: 11 Sep 2005
Posts: 10

 Posted: Mon Sep 10, 2007 5:50 pm    Post subject: It has to be accurate ...
CICS Guy

Senior Member

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

Posted: Mon Sep 10, 2007 5:59 pm    Post subject:

 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......
viveksingal

New User

Joined: 11 Sep 2005
Posts: 10

 Posted: Mon Sep 10, 2007 6:08 pm    Post subject: 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 ....
CICS Guy

Senior Member

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

 Posted: Mon Sep 10, 2007 6:24 pm    Post subject: You can put the ARITH in a CBL (PROCESS) statement before the ID Division statement....
dick scherrer

Site Director

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

 Posted: Mon Sep 10, 2007 6:28 pm    Post subject: 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.
Bitneuker

CICS Moderator

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

 Posted: Mon Sep 10, 2007 11:39 pm    Post subject: Doesn't COBOL support floating point like PL/1 does?
CICS Guy

Senior Member

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

 Posted: Tue Sep 11, 2007 12:27 am    Post subject: Yes, COMP-1 & 2, but that still will not guarantee al the digits - another case of almost accurate....grin.....
Bitneuker

CICS Moderator

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

 Posted: Tue Sep 11, 2007 2:42 pm    Post subject: In that case split the digits and the decimals, calculate and join afterwards
CICS Guy

Senior Member

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

 Posted: Tue Sep 11, 2007 2:44 pm    Post subject: I don't think that will work for multiplication and division.....
Bitneuker

CICS Moderator

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

 Posted: Wed Sep 12, 2007 1:46 am    Post subject: Yep........I did it in the last century using PL/1 calculating interest over big money. Just deal with p- and q-parts.
 All times are GMT + 6 HoursGoto page 1, 2  Next
 Page 1 of 2

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm

 © 2003-2016 IBM MAINFRAME Software Support Division
 Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us