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
 

 

Defining picture clause for a var having more than 31 digits

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

New User


Joined: 05 Dec 2006
Posts: 17
Location: Chennai

PostPosted: Thu Jan 18, 2007 5:44 pm    Post subject: Defining picture clause for a var having more than 31 digits
Reply with quote

hi,

Can anyone help me , what picture clause have to be defined for a variable having a value more than 31 digits.To my knowledge i am aware that cobol will supports only up to 18 digits to the maximum in a variable.
In my requirement i have a value havin 18 digits before decimal point and 17 digits after decimal point.
I tried with many options but so far nothin have worked out.
icon_sad.gif
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Jan 18, 2007 8:14 pm    Post subject:
Reply with quote

If you are going to need to do arithmetic against it, you can't directly. If you de need to you could split it up, say s9(18) and s9v9(17) and do the math on each and resolve the extra position in the decimal one back to the other.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 757
Location: Germany

PostPosted: Thu Jan 18, 2007 8:52 pm    Post subject:
Reply with quote

Hi !

I remember the compiler option ARITH(EXTEND).

With that COBOL for OS/390 supports 31 digit numbers. Packed and zoned decimal numbers may contain up to 31 digits.

I never tried it, cause there had been no need to do so.

So, plse search for that option.

Regards, UmeySan
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 Jan 18, 2007 9:54 pm    Post subject:
Reply with quote

Hello,

Please post some sample data that shows what kind of numbers you are working with that require both 18 digits before the decimal and 17 digits after the decimal.

An alternative is to use floating-point.
Back to top
View user's profile Send private message
sindhuvava
Currently Banned

New User


Joined: 05 Dec 2006
Posts: 17
Location: Chennai

PostPosted: Fri Jan 19, 2007 10:40 am    Post subject:
Reply with quote

hi,

this is the sample data which i am presently trying

00000000000000000.0485817382812
00000000000000000.0027688476562
00000000000000000.0000525390625

In this i have to check whether the usage value is negative and if it is negative i have to multiply it by -1.so if the value is negative i have to multiply the integer part by -1.so if fir eg i have a value as
-00000000000000000.0485817382812,and if i am splittin the value in to two parts based on the decimal,then i shd do -1*00000000000000000 and it will give a result 0.but i wants it as 00000000000000000.

can anyone help in this one
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 Jan 19, 2007 10:48 am    Post subject:
Reply with quote

Hello,

Will the value to the left of the decimal ever be non-zero?

If the result of an arithmetic operation is zero it is the same whether it is 0 or 00000000000000000. The code won't know the difference. The difference in which value you "see" will depend on what picture you use to format the number.

I may be misunderstanding what is needed and if so, please clarify.
Back to top
View user's profile Send private message
sindhuvava
Currently Banned

New User


Joined: 05 Dec 2006
Posts: 17
Location: Chennai

PostPosted: Fri Jan 19, 2007 11:05 am    Post subject:
Reply with quote

hi,

the left of the decimal may or may not be zeroes...it will depends upon the usage value gettin frm the input.actually as per the reqiirement its not possible to consider 00000000000000 will be equal to 0.the output of the program is further send to another feed for future billing purposes and there ,it will be defined to accept 0000000000000.we shd not get the result as 0.0485817382812 instead of 00000000000000000.0485817382812.
if the value before decimal is something like 00000000000000230.0485817382812 then th e result shd be the same.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Jan 19, 2007 2:46 pm    Post subject:
Reply with quote

Am I missing something or are you just looking for negative values and when found, making it positive?
Back to top
View user's profile Send private message
sindhuvava
Currently Banned

New User


Joined: 05 Dec 2006
Posts: 17
Location: Chennai

PostPosted: Fri Jan 19, 2007 3:00 pm    Post subject:
Reply with quote

The compiler option ARITH(EXTEND) is working fine.
Thanks
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Jan 19, 2007 3:09 pm    Post subject:
Reply with quote

sindhuvava wrote:
what picture clause have to be defined for a variable having a value more than 31 digits.
sindhuvava wrote:
The compiler option ARITH(EXTEND) is working fine.
Thanks
Even with the option the limit is 31 digits.....?????
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 757
Location: Germany

PostPosted: Fri Jan 19, 2007 3:19 pm    Post subject:
Reply with quote

Hi !

That's what i mentioned, and so what, it works !
Anyway, everywhere at some point there's a final cut.

Regards, UmeySan
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Jan 21, 2007 11:39 pm    Post subject:
Reply with quote

Sindy didn't say if the dec pt was implied or not, but counting the digits in the values he supplied, I get 30 digits and the # of digits is what's important here.

I use this old trick to force a positive value:

Define the variable as PIC 9(n)V9(n) (or redefine the orig PIC). Don't use the "S".
Then move the variable to itself (use the redef name if you redefed it). This strips the sign and doesn't require an IF stmt.

Technically, the result is "unsigned", but it's treated as a positive #.
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 Need help on SQL Dynamic WHERE Clause subratarec DB2 12 Sat Jul 16, 2016 3:11 pm
No new posts Syntax to check the first 4 digits of... kshirabdhi DFSORT/ICETOOL 10 Tue May 03, 2016 12:21 pm
No new posts [SQL0029] INTO clause missing from em... HABBIE DB2 2 Fri Sep 04, 2015 3:54 pm
No new posts 3-D Table with nested DEPENDING ON Cl... VivekKhanna COBOL Programming 5 Sat Aug 08, 2015 11:18 pm
No new posts when=group clause: question about the... tuxama DFSORT/ICETOOL 2 Thu Mar 26, 2015 12:51 pm


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